Skip to content

Commit b3d8c60

Browse files
committed
Merge branch 'intel-wired-lan-driver-updates-2023-11-13-i40e'
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2023-11-13 (i40e) This series contains updates to i40e driver only. Justin Bronder increases number of allowable descriptors for XL710 devices. Su Hui adds error check, and unroll, for RSS configuration. Andrii changes module read error message to debug and makes it more verbose. Ivan Vecera performs numerous clean-ups and refactors to driver such as removing unused defines and fields, converting use of flags to bitmaps, adding helpers, re-organizing code, etc. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 8fedaac + 3f06462 commit b3d8c60

17 files changed

+764
-739
lines changed

drivers/net/ethernet/intel/i40e/i40e.h

+66-82
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#define I40E_MAX_VEB 16
2525

2626
#define I40E_MAX_NUM_DESCRIPTORS 4096
27+
#define I40E_MAX_NUM_DESCRIPTORS_XL710 8160
2728
#define I40E_MAX_CSR_SPACE (4 * 1024 * 1024 - 64 * 1024)
2829
#define I40E_DEFAULT_NUM_DESCRIPTORS 512
2930
#define I40E_REQ_DESCRIPTOR_MULTIPLE 32
@@ -33,11 +34,11 @@
3334
#define I40E_MIN_VSI_ALLOC 83 /* LAN, ATR, FCOE, 64 VF */
3435
/* max 16 qps */
3536
#define i40e_default_queues_per_vmdq(pf) \
36-
(((pf)->hw_features & I40E_HW_RSS_AQ_CAPABLE) ? 4 : 1)
37+
(test_bit(I40E_HW_CAP_RSS_AQ, (pf)->hw.caps) ? 4 : 1)
3738
#define I40E_DEFAULT_QUEUES_PER_VF 4
3839
#define I40E_MAX_VF_QUEUES 16
3940
#define i40e_pf_get_max_q_per_tc(pf) \
40-
(((pf)->hw_features & I40E_HW_128_QP_RSS_CAPABLE) ? 128 : 64)
41+
(test_bit(I40E_HW_CAP_128_QP_RSS, (pf)->hw.caps) ? 128 : 64)
4142
#define I40E_FDIR_RING_COUNT 32
4243
#define I40E_MAX_AQ_BUF_SIZE 4096
4344
#define I40E_AQ_LEN 256
@@ -78,7 +79,7 @@
7879
#define I40E_MAX_BW_INACTIVE_ACCUM 4 /* accumulate 4 credits max */
7980

8081
/* driver state flags */
81-
enum i40e_state_t {
82+
enum i40e_state {
8283
__I40E_TESTING,
8384
__I40E_CONFIG_BUSY,
8485
__I40E_CONFIG_DONE,
@@ -126,7 +127,7 @@ enum i40e_state_t {
126127
BIT_ULL(__I40E_PF_RESET_AND_REBUILD_REQUESTED)
127128

128129
/* VSI state flags */
129-
enum i40e_vsi_state_t {
130+
enum i40e_vsi_state {
130131
__I40E_VSI_DOWN,
131132
__I40E_VSI_NEEDS_RESTART,
132133
__I40E_VSI_SYNCING_FILTERS,
@@ -138,6 +139,60 @@ enum i40e_vsi_state_t {
138139
__I40E_VSI_STATE_SIZE__,
139140
};
140141

142+
enum i40e_pf_flags {
143+
I40E_FLAG_MSI_ENA,
144+
I40E_FLAG_MSIX_ENA,
145+
I40E_FLAG_RSS_ENA,
146+
I40E_FLAG_VMDQ_ENA,
147+
I40E_FLAG_SRIOV_ENA,
148+
I40E_FLAG_DCB_CAPABLE,
149+
I40E_FLAG_DCB_ENA,
150+
I40E_FLAG_FD_SB_ENA,
151+
I40E_FLAG_FD_ATR_ENA,
152+
I40E_FLAG_MFP_ENA,
153+
I40E_FLAG_HW_ATR_EVICT_ENA,
154+
I40E_FLAG_VEB_MODE_ENA,
155+
I40E_FLAG_VEB_STATS_ENA,
156+
I40E_FLAG_LINK_POLLING_ENA,
157+
I40E_FLAG_TRUE_PROMISC_ENA,
158+
I40E_FLAG_LEGACY_RX_ENA,
159+
I40E_FLAG_PTP_ENA,
160+
I40E_FLAG_IWARP_ENA,
161+
I40E_FLAG_LINK_DOWN_ON_CLOSE_ENA,
162+
I40E_FLAG_SOURCE_PRUNING_DIS,
163+
I40E_FLAG_TC_MQPRIO_ENA,
164+
I40E_FLAG_FD_SB_INACTIVE,
165+
I40E_FLAG_FD_SB_TO_CLOUD_FILTER,
166+
I40E_FLAG_FW_LLDP_DIS,
167+
I40E_FLAG_RS_FEC,
168+
I40E_FLAG_BASE_R_FEC,
169+
/* TOTAL_PORT_SHUTDOWN_ENA
170+
* Allows to physically disable the link on the NIC's port.
171+
* If enabled, (after link down request from the OS)
172+
* no link, traffic or led activity is possible on that port.
173+
*
174+
* If I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENA is set, the
175+
* I40E_FLAG_LINK_DOWN_ON_CLOSE_ENA must be explicitly forced
176+
* to true and cannot be disabled by system admin at that time.
177+
* The functionalities are exclusive in terms of configuration, but
178+
* they also have similar behavior (allowing to disable physical
179+
* link of the port), with following differences:
180+
* - LINK_DOWN_ON_CLOSE_ENA is configurable at host OS run-time and
181+
* is supported by whole family of 7xx Intel Ethernet Controllers
182+
* - TOTAL_PORT_SHUTDOWN_ENA may be enabled only before OS loads
183+
* (in BIOS) only if motherboard's BIOS and NIC's FW has support of it
184+
* - when LINK_DOWN_ON_CLOSE_ENABLED is used, the link is being brought
185+
* down by sending phy_type=0 to NIC's FW
186+
* - when TOTAL_PORT_SHUTDOWN_ENA is used, phy_type is not altered,
187+
* instead the link is being brought down by clearing
188+
* bit (I40E_AQ_PHY_ENABLE_LINK) in abilities field of
189+
* i40e_aq_set_phy_config structure
190+
*/
191+
I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENA,
192+
I40E_FLAG_VF_VLAN_PRUNING_ENA,
193+
I40E_PF_FLAGS_NBITS, /* must be last */
194+
};
195+
141196
enum i40e_interrupt_policy {
142197
I40E_INTERRUPT_BEST_CASE,
143198
I40E_INTERRUPT_MEDIUM,
@@ -480,78 +535,7 @@ struct i40e_pf {
480535
struct timer_list service_timer;
481536
struct work_struct service_task;
482537

483-
u32 hw_features;
484-
#define I40E_HW_RSS_AQ_CAPABLE BIT(0)
485-
#define I40E_HW_128_QP_RSS_CAPABLE BIT(1)
486-
#define I40E_HW_ATR_EVICT_CAPABLE BIT(2)
487-
#define I40E_HW_WB_ON_ITR_CAPABLE BIT(3)
488-
#define I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE BIT(4)
489-
#define I40E_HW_NO_PCI_LINK_CHECK BIT(5)
490-
#define I40E_HW_100M_SGMII_CAPABLE BIT(6)
491-
#define I40E_HW_NO_DCB_SUPPORT BIT(7)
492-
#define I40E_HW_USE_SET_LLDP_MIB BIT(8)
493-
#define I40E_HW_GENEVE_OFFLOAD_CAPABLE BIT(9)
494-
#define I40E_HW_PTP_L4_CAPABLE BIT(10)
495-
#define I40E_HW_WOL_MC_MAGIC_PKT_WAKE BIT(11)
496-
#define I40E_HW_HAVE_CRT_RETIMER BIT(13)
497-
#define I40E_HW_OUTER_UDP_CSUM_CAPABLE BIT(14)
498-
#define I40E_HW_PHY_CONTROLS_LEDS BIT(15)
499-
#define I40E_HW_STOP_FW_LLDP BIT(16)
500-
#define I40E_HW_PORT_ID_VALID BIT(17)
501-
#define I40E_HW_RESTART_AUTONEG BIT(18)
502-
503-
u32 flags;
504-
#define I40E_FLAG_RX_CSUM_ENABLED BIT(0)
505-
#define I40E_FLAG_MSI_ENABLED BIT(1)
506-
#define I40E_FLAG_MSIX_ENABLED BIT(2)
507-
#define I40E_FLAG_RSS_ENABLED BIT(3)
508-
#define I40E_FLAG_VMDQ_ENABLED BIT(4)
509-
#define I40E_FLAG_SRIOV_ENABLED BIT(5)
510-
#define I40E_FLAG_DCB_CAPABLE BIT(6)
511-
#define I40E_FLAG_DCB_ENABLED BIT(7)
512-
#define I40E_FLAG_FD_SB_ENABLED BIT(8)
513-
#define I40E_FLAG_FD_ATR_ENABLED BIT(9)
514-
#define I40E_FLAG_MFP_ENABLED BIT(10)
515-
#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT(11)
516-
#define I40E_FLAG_VEB_MODE_ENABLED BIT(12)
517-
#define I40E_FLAG_VEB_STATS_ENABLED BIT(13)
518-
#define I40E_FLAG_LINK_POLLING_ENABLED BIT(14)
519-
#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT(15)
520-
#define I40E_FLAG_LEGACY_RX BIT(16)
521-
#define I40E_FLAG_PTP BIT(17)
522-
#define I40E_FLAG_IWARP_ENABLED BIT(18)
523-
#define I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED BIT(19)
524-
#define I40E_FLAG_SOURCE_PRUNING_DISABLED BIT(20)
525-
#define I40E_FLAG_TC_MQPRIO BIT(21)
526-
#define I40E_FLAG_FD_SB_INACTIVE BIT(22)
527-
#define I40E_FLAG_FD_SB_TO_CLOUD_FILTER BIT(23)
528-
#define I40E_FLAG_DISABLE_FW_LLDP BIT(24)
529-
#define I40E_FLAG_RS_FEC BIT(25)
530-
#define I40E_FLAG_BASE_R_FEC BIT(26)
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(27)
553-
#define I40E_FLAG_VF_VLAN_PRUNING BIT(28)
554-
538+
DECLARE_BITMAP(flags, I40E_PF_FLAGS_NBITS);
555539
struct i40e_client_instance *cinst;
556540
bool stat_offsets_loaded;
557541
struct i40e_hw_port_stats stats;
@@ -1267,7 +1251,7 @@ struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, const u8 *macaddr);
12671251
void i40e_vlan_stripping_enable(struct i40e_vsi *vsi);
12681252
static inline bool i40e_is_sw_dcb(struct i40e_pf *pf)
12691253
{
1270-
return !!(pf->flags & I40E_FLAG_DISABLE_FW_LLDP);
1254+
return test_bit(I40E_FLAG_FW_LLDP_DIS, pf->flags);
12711255
}
12721256

12731257
#ifdef CONFIG_I40E_DCB
@@ -1301,7 +1285,7 @@ int i40e_set_partition_bw_setting(struct i40e_pf *pf);
13011285
int i40e_commit_partition_bw_setting(struct i40e_pf *pf);
13021286
void i40e_print_link_message(struct i40e_vsi *vsi, bool isup);
13031287

1304-
void i40e_set_fec_in_flags(u8 fec_cfg, u32 *flags);
1288+
void i40e_set_fec_in_flags(u8 fec_cfg, unsigned long *flags);
13051289

13061290
static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi)
13071291
{
@@ -1321,13 +1305,13 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
13211305
* i40e_is_tc_mqprio_enabled - check if TC MQPRIO is enabled on PF
13221306
* @pf: pointer to a pf.
13231307
*
1324-
* Check and return value of flag I40E_FLAG_TC_MQPRIO.
1308+
* Check and return state of flag I40E_FLAG_TC_MQPRIO.
13251309
*
1326-
* Return: I40E_FLAG_TC_MQPRIO set state.
1310+
* Return: true/false if I40E_FLAG_TC_MQPRIO is set or not
13271311
**/
1328-
static inline u32 i40e_is_tc_mqprio_enabled(struct i40e_pf *pf)
1312+
static inline bool i40e_is_tc_mqprio_enabled(struct i40e_pf *pf)
13291313
{
1330-
return pf->flags & I40E_FLAG_TC_MQPRIO;
1314+
return test_bit(I40E_FLAG_TC_MQPRIO_ENA, pf->flags);
13311315
}
13321316

13331317
/**

0 commit comments

Comments
 (0)