34
34
#define I40E_MIN_VSI_ALLOC 83 /* LAN, ATR, FCOE, 64 VF */
35
35
/* max 16 qps */
36
36
#define i40e_default_queues_per_vmdq (pf ) \
37
- (( (pf)->hw_features & I40E_HW_RSS_AQ_CAPABLE ) ? 4 : 1)
37
+ (test_bit(I40E_HW_RSS_AQ_CAPABLE, (pf)->hw_features) ? 4 : 1)
38
38
#define I40E_DEFAULT_QUEUES_PER_VF 4
39
39
#define I40E_MAX_VF_QUEUES 16
40
40
#define i40e_pf_get_max_q_per_tc (pf ) \
41
- (( (pf)->hw_features & I40E_HW_128_QP_RSS_CAPABLE ) ? 128 : 64)
41
+ (test_bit(I40E_HW_128_QP_RSS_CAPABLE, (pf)->hw_features) ? 128 : 64)
42
42
#define I40E_FDIR_RING_COUNT 32
43
43
#define I40E_MAX_AQ_BUF_SIZE 4096
44
44
#define I40E_AQ_LEN 256
@@ -139,6 +139,82 @@ enum i40e_vsi_state {
139
139
__I40E_VSI_STATE_SIZE__ ,
140
140
};
141
141
142
+ enum i40e_pf_hw_features {
143
+ I40E_HW_RSS_AQ_CAPABLE ,
144
+ I40E_HW_128_QP_RSS_CAPABLE ,
145
+ I40E_HW_ATR_EVICT_CAPABLE ,
146
+ I40E_HW_WB_ON_ITR_CAPABLE ,
147
+ I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE ,
148
+ I40E_HW_NO_PCI_LINK_CHECK ,
149
+ I40E_HW_100M_SGMII_CAPABLE ,
150
+ I40E_HW_NO_DCB_SUPPORT ,
151
+ I40E_HW_USE_SET_LLDP_MIB ,
152
+ I40E_HW_GENEVE_OFFLOAD_CAPABLE ,
153
+ I40E_HW_PTP_L4_CAPABLE ,
154
+ I40E_HW_WOL_MC_MAGIC_PKT_WAKE ,
155
+ I40E_HW_HAVE_CRT_RETIMER ,
156
+ I40E_HW_OUTER_UDP_CSUM_CAPABLE ,
157
+ I40E_HW_PHY_CONTROLS_LEDS ,
158
+ I40E_HW_STOP_FW_LLDP ,
159
+ I40E_HW_PORT_ID_VALID ,
160
+ I40E_HW_RESTART_AUTONEG ,
161
+ I40E_PF_HW_FEATURES_NBITS , /* must be last */
162
+ };
163
+
164
+ enum i40e_pf_flags {
165
+ I40E_FLAG_MSI_ENA ,
166
+ I40E_FLAG_MSIX_ENA ,
167
+ I40E_FLAG_RSS_ENA ,
168
+ I40E_FLAG_VMDQ_ENA ,
169
+ I40E_FLAG_SRIOV_ENA ,
170
+ I40E_FLAG_DCB_CAPABLE ,
171
+ I40E_FLAG_DCB_ENA ,
172
+ I40E_FLAG_FD_SB_ENA ,
173
+ I40E_FLAG_FD_ATR_ENA ,
174
+ I40E_FLAG_MFP_ENA ,
175
+ I40E_FLAG_HW_ATR_EVICT_ENA ,
176
+ I40E_FLAG_VEB_MODE_ENA ,
177
+ I40E_FLAG_VEB_STATS_ENA ,
178
+ I40E_FLAG_LINK_POLLING_ENA ,
179
+ I40E_FLAG_TRUE_PROMISC_ENA ,
180
+ I40E_FLAG_LEGACY_RX_ENA ,
181
+ I40E_FLAG_PTP_ENA ,
182
+ I40E_FLAG_IWARP_ENA ,
183
+ I40E_FLAG_LINK_DOWN_ON_CLOSE_ENA ,
184
+ I40E_FLAG_SOURCE_PRUNING_DIS ,
185
+ I40E_FLAG_TC_MQPRIO_ENA ,
186
+ I40E_FLAG_FD_SB_INACTIVE ,
187
+ I40E_FLAG_FD_SB_TO_CLOUD_FILTER ,
188
+ I40E_FLAG_FW_LLDP_DIS ,
189
+ I40E_FLAG_RS_FEC ,
190
+ I40E_FLAG_BASE_R_FEC ,
191
+ /* TOTAL_PORT_SHUTDOWN_ENA
192
+ * Allows to physically disable the link on the NIC's port.
193
+ * If enabled, (after link down request from the OS)
194
+ * no link, traffic or led activity is possible on that port.
195
+ *
196
+ * If I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENA is set, the
197
+ * I40E_FLAG_LINK_DOWN_ON_CLOSE_ENA must be explicitly forced
198
+ * to true and cannot be disabled by system admin at that time.
199
+ * The functionalities are exclusive in terms of configuration, but
200
+ * they also have similar behavior (allowing to disable physical
201
+ * link of the port), with following differences:
202
+ * - LINK_DOWN_ON_CLOSE_ENA is configurable at host OS run-time and
203
+ * is supported by whole family of 7xx Intel Ethernet Controllers
204
+ * - TOTAL_PORT_SHUTDOWN_ENA may be enabled only before OS loads
205
+ * (in BIOS) only if motherboard's BIOS and NIC's FW has support of it
206
+ * - when LINK_DOWN_ON_CLOSE_ENABLED is used, the link is being brought
207
+ * down by sending phy_type=0 to NIC's FW
208
+ * - when TOTAL_PORT_SHUTDOWN_ENA is used, phy_type is not altered,
209
+ * instead the link is being brought down by clearing
210
+ * bit (I40E_AQ_PHY_ENABLE_LINK) in abilities field of
211
+ * i40e_aq_set_phy_config structure
212
+ */
213
+ I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENA ,
214
+ I40E_FLAG_VF_VLAN_PRUNING_ENA ,
215
+ I40E_PF_FLAGS_NBITS , /* must be last */
216
+ };
217
+
142
218
enum i40e_interrupt_policy {
143
219
I40E_INTERRUPT_BEST_CASE ,
144
220
I40E_INTERRUPT_MEDIUM ,
@@ -481,77 +557,8 @@ struct i40e_pf {
481
557
struct timer_list service_timer ;
482
558
struct work_struct service_task ;
483
559
484
- u32 hw_features ;
485
- #define I40E_HW_RSS_AQ_CAPABLE BIT(0)
486
- #define I40E_HW_128_QP_RSS_CAPABLE BIT(1)
487
- #define I40E_HW_ATR_EVICT_CAPABLE BIT(2)
488
- #define I40E_HW_WB_ON_ITR_CAPABLE BIT(3)
489
- #define I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE BIT(4)
490
- #define I40E_HW_NO_PCI_LINK_CHECK BIT(5)
491
- #define I40E_HW_100M_SGMII_CAPABLE BIT(6)
492
- #define I40E_HW_NO_DCB_SUPPORT BIT(7)
493
- #define I40E_HW_USE_SET_LLDP_MIB BIT(8)
494
- #define I40E_HW_GENEVE_OFFLOAD_CAPABLE BIT(9)
495
- #define I40E_HW_PTP_L4_CAPABLE BIT(10)
496
- #define I40E_HW_WOL_MC_MAGIC_PKT_WAKE BIT(11)
497
- #define I40E_HW_HAVE_CRT_RETIMER BIT(13)
498
- #define I40E_HW_OUTER_UDP_CSUM_CAPABLE BIT(14)
499
- #define I40E_HW_PHY_CONTROLS_LEDS BIT(15)
500
- #define I40E_HW_STOP_FW_LLDP BIT(16)
501
- #define I40E_HW_PORT_ID_VALID BIT(17)
502
- #define I40E_HW_RESTART_AUTONEG BIT(18)
503
-
504
- u32 flags ;
505
- #define I40E_FLAG_MSI_ENABLED BIT(0)
506
- #define I40E_FLAG_MSIX_ENABLED BIT(1)
507
- #define I40E_FLAG_RSS_ENABLED BIT(2)
508
- #define I40E_FLAG_VMDQ_ENABLED BIT(3)
509
- #define I40E_FLAG_SRIOV_ENABLED BIT(4)
510
- #define I40E_FLAG_DCB_CAPABLE BIT(5)
511
- #define I40E_FLAG_DCB_ENABLED BIT(6)
512
- #define I40E_FLAG_FD_SB_ENABLED BIT(7)
513
- #define I40E_FLAG_FD_ATR_ENABLED BIT(8)
514
- #define I40E_FLAG_MFP_ENABLED BIT(9)
515
- #define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT(10)
516
- #define I40E_FLAG_VEB_MODE_ENABLED BIT(11)
517
- #define I40E_FLAG_VEB_STATS_ENABLED BIT(12)
518
- #define I40E_FLAG_LINK_POLLING_ENABLED BIT(13)
519
- #define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT(14)
520
- #define I40E_FLAG_LEGACY_RX BIT(15)
521
- #define I40E_FLAG_PTP BIT(16)
522
- #define I40E_FLAG_IWARP_ENABLED BIT(17)
523
- #define I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED BIT(18)
524
- #define I40E_FLAG_SOURCE_PRUNING_DISABLED BIT(19)
525
- #define I40E_FLAG_TC_MQPRIO BIT(20)
526
- #define I40E_FLAG_FD_SB_INACTIVE BIT(21)
527
- #define I40E_FLAG_FD_SB_TO_CLOUD_FILTER BIT(22)
528
- #define I40E_FLAG_DISABLE_FW_LLDP BIT(23)
529
- #define I40E_FLAG_RS_FEC BIT(24)
530
- #define I40E_FLAG_BASE_R_FEC BIT(25)
531
- /* TOTAL_PORT_SHUTDOWN
532
- * Allows to physically disable the link on the NIC's port.
533
- * If enabled, (after link down request from the OS)
534
- * no link, traffic or led activity is possible on that port.
535
- *
536
- * If I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED is set, the
537
- * I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED must be explicitly forced to true
538
- * and cannot be disabled by system admin at that time.
539
- * The functionalities are exclusive in terms of configuration, but they also
540
- * have similar behavior (allowing to disable physical link of the port),
541
- * with following differences:
542
- * - LINK_DOWN_ON_CLOSE_ENABLED is configurable at host OS run-time and is
543
- * supported by whole family of 7xx Intel Ethernet Controllers
544
- * - TOTAL_PORT_SHUTDOWN may be enabled only before OS loads (in BIOS)
545
- * only if motherboard's BIOS and NIC's FW has support of it
546
- * - when LINK_DOWN_ON_CLOSE_ENABLED is used, the link is being brought down
547
- * by sending phy_type=0 to NIC's FW
548
- * - when TOTAL_PORT_SHUTDOWN is used, phy_type is not altered, instead
549
- * the link is being brought down by clearing bit (I40E_AQ_PHY_ENABLE_LINK)
550
- * in abilities field of i40e_aq_set_phy_config structure
551
- */
552
- #define I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED BIT(26)
553
- #define I40E_FLAG_VF_VLAN_PRUNING BIT(27)
554
-
560
+ DECLARE_BITMAP (hw_features , I40E_PF_HW_FEATURES_NBITS );
561
+ DECLARE_BITMAP (flags , I40E_PF_FLAGS_NBITS );
555
562
struct i40e_client_instance * cinst ;
556
563
bool stat_offsets_loaded ;
557
564
struct i40e_hw_port_stats stats ;
@@ -1267,7 +1274,7 @@ struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, const u8 *macaddr);
1267
1274
void i40e_vlan_stripping_enable (struct i40e_vsi * vsi );
1268
1275
static inline bool i40e_is_sw_dcb (struct i40e_pf * pf )
1269
1276
{
1270
- return !!( pf -> flags & I40E_FLAG_DISABLE_FW_LLDP );
1277
+ return test_bit ( I40E_FLAG_FW_LLDP_DIS , pf -> flags );
1271
1278
}
1272
1279
1273
1280
#ifdef CONFIG_I40E_DCB
@@ -1301,7 +1308,7 @@ int i40e_set_partition_bw_setting(struct i40e_pf *pf);
1301
1308
int i40e_commit_partition_bw_setting (struct i40e_pf * pf );
1302
1309
void i40e_print_link_message (struct i40e_vsi * vsi , bool isup );
1303
1310
1304
- void i40e_set_fec_in_flags (u8 fec_cfg , u32 * flags );
1311
+ void i40e_set_fec_in_flags (u8 fec_cfg , unsigned long * flags );
1305
1312
1306
1313
static inline bool i40e_enabled_xdp_vsi (struct i40e_vsi * vsi )
1307
1314
{
@@ -1321,13 +1328,13 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
1321
1328
* i40e_is_tc_mqprio_enabled - check if TC MQPRIO is enabled on PF
1322
1329
* @pf: pointer to a pf.
1323
1330
*
1324
- * Check and return value of flag I40E_FLAG_TC_MQPRIO.
1331
+ * Check and return state of flag I40E_FLAG_TC_MQPRIO.
1325
1332
*
1326
- * Return: I40E_FLAG_TC_MQPRIO set state.
1333
+ * Return: true/false if I40E_FLAG_TC_MQPRIO is set or not
1327
1334
**/
1328
- static inline u32 i40e_is_tc_mqprio_enabled (struct i40e_pf * pf )
1335
+ static inline bool i40e_is_tc_mqprio_enabled (struct i40e_pf * pf )
1329
1336
{
1330
- return pf -> flags & I40E_FLAG_TC_MQPRIO ;
1337
+ return test_bit ( I40E_FLAG_TC_MQPRIO_ENA , pf -> flags ) ;
1331
1338
}
1332
1339
1333
1340
/**
0 commit comments