xref: /linux/drivers/scsi/fnic/vnic_nic.h (revision 3d0fe49454652117522f60bfbefb978ba0e5300b)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
4  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
5  */
6 #ifndef _VNIC_NIC_H_
7 #define _VNIC_NIC_H_
8 
9 /*
10  * These defines avoid symbol clash between fnic and enic (Cisco 10G Eth
11  * Driver) when both are built with CONFIG options =y
12  */
13 #define vnic_set_nic_cfg fnic_set_nic_cfg
14 
15 #define NIC_CFG_RSS_DEFAULT_CPU_MASK_FIELD	0xffUL
16 #define NIC_CFG_RSS_DEFAULT_CPU_SHIFT		0
17 #define NIC_CFG_RSS_HASH_TYPE			(0xffUL << 8)
18 #define NIC_CFG_RSS_HASH_TYPE_MASK_FIELD	0xffUL
19 #define NIC_CFG_RSS_HASH_TYPE_SHIFT		8
20 #define NIC_CFG_RSS_HASH_BITS			(7UL << 16)
21 #define NIC_CFG_RSS_HASH_BITS_MASK_FIELD	7UL
22 #define NIC_CFG_RSS_HASH_BITS_SHIFT		16
23 #define NIC_CFG_RSS_BASE_CPU			(7UL << 19)
24 #define NIC_CFG_RSS_BASE_CPU_MASK_FIELD		7UL
25 #define NIC_CFG_RSS_BASE_CPU_SHIFT		19
26 #define NIC_CFG_RSS_ENABLE			(1UL << 22)
27 #define NIC_CFG_RSS_ENABLE_MASK_FIELD		1UL
28 #define NIC_CFG_RSS_ENABLE_SHIFT		22
29 #define NIC_CFG_TSO_IPID_SPLIT_EN		(1UL << 23)
30 #define NIC_CFG_TSO_IPID_SPLIT_EN_MASK_FIELD	1UL
31 #define NIC_CFG_TSO_IPID_SPLIT_EN_SHIFT		23
32 #define NIC_CFG_IG_VLAN_STRIP_EN		(1UL << 24)
33 #define NIC_CFG_IG_VLAN_STRIP_EN_MASK_FIELD	1UL
34 #define NIC_CFG_IG_VLAN_STRIP_EN_SHIFT		24
35 
36 static inline void vnic_set_nic_cfg(u32 *nic_cfg,
37 	u8 rss_default_cpu, u8 rss_hash_type,
38 	u8 rss_hash_bits, u8 rss_base_cpu,
39 	u8 rss_enable, u8 tso_ipid_split_en,
40 	u8 ig_vlan_strip_en)
41 {
42 	*nic_cfg = (rss_default_cpu & NIC_CFG_RSS_DEFAULT_CPU_MASK_FIELD) |
43 		((rss_hash_type & NIC_CFG_RSS_HASH_TYPE_MASK_FIELD)
44 			<< NIC_CFG_RSS_HASH_TYPE_SHIFT) |
45 		((rss_hash_bits & NIC_CFG_RSS_HASH_BITS_MASK_FIELD)
46 			<< NIC_CFG_RSS_HASH_BITS_SHIFT) |
47 		((rss_base_cpu & NIC_CFG_RSS_BASE_CPU_MASK_FIELD)
48 			<< NIC_CFG_RSS_BASE_CPU_SHIFT) |
49 		((rss_enable & NIC_CFG_RSS_ENABLE_MASK_FIELD)
50 			<< NIC_CFG_RSS_ENABLE_SHIFT) |
51 		((tso_ipid_split_en & NIC_CFG_TSO_IPID_SPLIT_EN_MASK_FIELD)
52 			<< NIC_CFG_TSO_IPID_SPLIT_EN_SHIFT) |
53 		((ig_vlan_strip_en & NIC_CFG_IG_VLAN_STRIP_EN_MASK_FIELD)
54 			<< NIC_CFG_IG_VLAN_STRIP_EN_SHIFT);
55 }
56 
57 #endif /* _VNIC_NIC_H_ */
58