Skip to content

Commit b74f571

Browse files
jacob-kellerJeff Kirsher
authored andcommitted
i40e/i40evf: organize and re-number feature flags
Now that we've reduced the number of flags, organize similar flags together and re-number them accordingly. Since we don't yet have more than 32 flags, we'll use a u32 for both the hw_features and flag field. Should we gain more flags in the future, we may need to convert to a u64 or separate flags out into two fields. One alternative approach considered, but not implemented here, was to use an enumeration for the flag variables, and create a macro I40E_FLAG() which used string concatenation to generate BIT_ULL values. This has the advantage of making the actual bit values compile-time dynamic so that we do not need to worry about matching the order to the bit value. However, this does produce a high level of code churn, and makes it more difficult to read a dumped flags value when debugging. Change-ID: I8653fff69453cd547d6fe98d29dfa9d8710387d1 Signed-off-by: Jacob Keller <[email protected]> Reviewed-by: Mitch Williams <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent a5340d9 commit b74f571

File tree

3 files changed

+68
-68
lines changed

3 files changed

+68
-68
lines changed

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

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -403,57 +403,57 @@ struct i40e_pf {
403403
struct timer_list service_timer;
404404
struct work_struct service_task;
405405

406-
u64 hw_features;
407-
#define I40E_HW_RSS_AQ_CAPABLE BIT_ULL(0)
408-
#define I40E_HW_128_QP_RSS_CAPABLE BIT_ULL(1)
409-
#define I40E_HW_ATR_EVICT_CAPABLE BIT_ULL(2)
410-
#define I40E_HW_WB_ON_ITR_CAPABLE BIT_ULL(3)
411-
#define I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE BIT_ULL(4)
412-
#define I40E_HW_NO_PCI_LINK_CHECK BIT_ULL(5)
413-
#define I40E_HW_100M_SGMII_CAPABLE BIT_ULL(6)
414-
#define I40E_HW_NO_DCB_SUPPORT BIT_ULL(7)
415-
#define I40E_HW_USE_SET_LLDP_MIB BIT_ULL(8)
416-
#define I40E_HW_GENEVE_OFFLOAD_CAPABLE BIT_ULL(9)
417-
#define I40E_HW_PTP_L4_CAPABLE BIT_ULL(10)
418-
#define I40E_HW_WOL_MC_MAGIC_PKT_WAKE BIT_ULL(11)
419-
#define I40E_HW_MPLS_HDR_OFFLOAD_CAPABLE BIT_ULL(12)
420-
#define I40E_HW_HAVE_CRT_RETIMER BIT_ULL(13)
421-
#define I40E_HW_OUTER_UDP_CSUM_CAPABLE BIT_ULL(14)
422-
#define I40E_HW_PHY_CONTROLS_LEDS BIT_ULL(15)
423-
#define I40E_HW_STOP_FW_LLDP BIT_ULL(16)
424-
#define I40E_HW_PORT_ID_VALID BIT_ULL(17)
425-
#define I40E_HW_RESTART_AUTONEG BIT_ULL(18)
406+
u32 hw_features;
407+
#define I40E_HW_RSS_AQ_CAPABLE BIT(0)
408+
#define I40E_HW_128_QP_RSS_CAPABLE BIT(1)
409+
#define I40E_HW_ATR_EVICT_CAPABLE BIT(2)
410+
#define I40E_HW_WB_ON_ITR_CAPABLE BIT(3)
411+
#define I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE BIT(4)
412+
#define I40E_HW_NO_PCI_LINK_CHECK BIT(5)
413+
#define I40E_HW_100M_SGMII_CAPABLE BIT(6)
414+
#define I40E_HW_NO_DCB_SUPPORT BIT(7)
415+
#define I40E_HW_USE_SET_LLDP_MIB BIT(8)
416+
#define I40E_HW_GENEVE_OFFLOAD_CAPABLE BIT(9)
417+
#define I40E_HW_PTP_L4_CAPABLE BIT(10)
418+
#define I40E_HW_WOL_MC_MAGIC_PKT_WAKE BIT(11)
419+
#define I40E_HW_MPLS_HDR_OFFLOAD_CAPABLE BIT(12)
420+
#define I40E_HW_HAVE_CRT_RETIMER BIT(13)
421+
#define I40E_HW_OUTER_UDP_CSUM_CAPABLE BIT(14)
422+
#define I40E_HW_PHY_CONTROLS_LEDS BIT(15)
423+
#define I40E_HW_STOP_FW_LLDP BIT(16)
424+
#define I40E_HW_PORT_ID_VALID BIT(17)
425+
#define I40E_HW_RESTART_AUTONEG BIT(18)
426426

427427
u64 flags;
428-
#define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(1)
429-
#define I40E_FLAG_MSI_ENABLED BIT_ULL(2)
430-
#define I40E_FLAG_MSIX_ENABLED BIT_ULL(3)
431-
#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT_ULL(4)
432-
#define I40E_FLAG_RSS_ENABLED BIT_ULL(6)
433-
#define I40E_FLAG_VMDQ_ENABLED BIT_ULL(7)
434-
#define I40E_FLAG_IWARP_ENABLED BIT_ULL(10)
435-
#define I40E_FLAG_FILTER_SYNC BIT_ULL(15)
436-
#define I40E_FLAG_SERVICE_CLIENT_REQUESTED BIT_ULL(16)
437-
#define I40E_FLAG_SRIOV_ENABLED BIT_ULL(19)
438-
#define I40E_FLAG_DCB_ENABLED BIT_ULL(20)
439-
#define I40E_FLAG_FD_SB_ENABLED BIT_ULL(21)
440-
#define I40E_FLAG_FD_ATR_ENABLED BIT_ULL(22)
441-
#define I40E_FLAG_FD_SB_AUTO_DISABLED BIT_ULL(23)
442-
#define I40E_FLAG_FD_ATR_AUTO_DISABLED BIT_ULL(24)
443-
#define I40E_FLAG_PTP BIT_ULL(25)
444-
#define I40E_FLAG_MFP_ENABLED BIT_ULL(26)
445-
#define I40E_FLAG_UDP_FILTER_SYNC BIT_ULL(27)
446-
#define I40E_FLAG_DCB_CAPABLE BIT_ULL(29)
447-
#define I40E_FLAG_VEB_STATS_ENABLED BIT_ULL(37)
448-
#define I40E_FLAG_LINK_POLLING_ENABLED BIT_ULL(39)
449-
#define I40E_FLAG_VEB_MODE_ENABLED BIT_ULL(40)
450-
#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT_ULL(51)
451-
#define I40E_FLAG_CLIENT_RESET BIT_ULL(54)
452-
#define I40E_FLAG_TEMP_LINK_POLLING BIT_ULL(55)
453-
#define I40E_FLAG_CLIENT_L2_CHANGE BIT_ULL(56)
454-
#define I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED BIT_ULL(57)
455-
#define I40E_FLAG_LEGACY_RX BIT_ULL(58)
456-
#define I40E_FLAG_SOURCE_PRUNING_DISABLED BIT_ULL(59)
428+
#define I40E_FLAG_RX_CSUM_ENABLED BIT(0)
429+
#define I40E_FLAG_MSI_ENABLED BIT(1)
430+
#define I40E_FLAG_MSIX_ENABLED BIT(2)
431+
#define I40E_FLAG_RSS_ENABLED BIT(3)
432+
#define I40E_FLAG_VMDQ_ENABLED BIT(4)
433+
#define I40E_FLAG_FILTER_SYNC BIT(5)
434+
#define I40E_FLAG_SRIOV_ENABLED BIT(6)
435+
#define I40E_FLAG_DCB_CAPABLE BIT(7)
436+
#define I40E_FLAG_DCB_ENABLED BIT(8)
437+
#define I40E_FLAG_FD_SB_ENABLED BIT(9)
438+
#define I40E_FLAG_FD_ATR_ENABLED BIT(10)
439+
#define I40E_FLAG_FD_SB_AUTO_DISABLED BIT(11)
440+
#define I40E_FLAG_FD_ATR_AUTO_DISABLED BIT(12)
441+
#define I40E_FLAG_MFP_ENABLED BIT(13)
442+
#define I40E_FLAG_UDP_FILTER_SYNC BIT(14)
443+
#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT(15)
444+
#define I40E_FLAG_VEB_MODE_ENABLED BIT(16)
445+
#define I40E_FLAG_VEB_STATS_ENABLED BIT(17)
446+
#define I40E_FLAG_LINK_POLLING_ENABLED BIT(18)
447+
#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT(19)
448+
#define I40E_FLAG_TEMP_LINK_POLLING BIT(20)
449+
#define I40E_FLAG_LEGACY_RX BIT(21)
450+
#define I40E_FLAG_PTP BIT(22)
451+
#define I40E_FLAG_IWARP_ENABLED BIT(23)
452+
#define I40E_FLAG_SERVICE_CLIENT_REQUESTED BIT(24)
453+
#define I40E_FLAG_CLIENT_L2_CHANGE BIT(25)
454+
#define I40E_FLAG_CLIENT_RESET BIT(26)
455+
#define I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED BIT(27)
456+
#define I40E_FLAG_SOURCE_PRUNING_DISABLED BIT(28)
457457

458458
struct i40e_client_instance *cinst;
459459
bool stat_offsets_loaded;

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,7 +4095,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
40954095
struct i40e_netdev_priv *np = netdev_priv(dev);
40964096
struct i40e_vsi *vsi = np->vsi;
40974097
struct i40e_pf *pf = vsi->back;
4098-
u64 orig_flags, new_flags, changed_flags;
4098+
u32 orig_flags, new_flags, changed_flags;
40994099
u32 i, j;
41004100

41014101
orig_flags = READ_ONCE(pf->flags);
@@ -4147,12 +4147,12 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
41474147
return -EOPNOTSUPP;
41484148

41494149
/* Compare and exchange the new flags into place. If we failed, that
4150-
* is if cmpxchg64 returns anything but the old value, this means that
4150+
* is if cmpxchg returns anything but the old value, this means that
41514151
* something else has modified the flags variable since we copied it
41524152
* originally. We'll just punt with an error and log something in the
41534153
* message buffer.
41544154
*/
4155-
if (cmpxchg64(&pf->flags, orig_flags, new_flags) != orig_flags) {
4155+
if (cmpxchg(&pf->flags, orig_flags, new_flags) != orig_flags) {
41564156
dev_warn(&pf->pdev->dev,
41574157
"Unable to update pf->flags as it was modified by another thread...\n");
41584158
return -EAGAIN;

drivers/net/ethernet/intel/i40evf/i40evf.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -222,22 +222,22 @@ struct i40evf_adapter {
222222

223223
u32 flags;
224224
#define I40EVF_FLAG_RX_CSUM_ENABLED BIT(0)
225-
#define I40EVF_FLAG_IMIR_ENABLED BIT(5)
226-
#define I40EVF_FLAG_MQ_CAPABLE BIT(6)
227-
#define I40EVF_FLAG_PF_COMMS_FAILED BIT(8)
228-
#define I40EVF_FLAG_RESET_PENDING BIT(9)
229-
#define I40EVF_FLAG_RESET_NEEDED BIT(10)
230-
#define I40EVF_FLAG_WB_ON_ITR_CAPABLE BIT(11)
231-
#define I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE BIT(12)
232-
#define I40EVF_FLAG_ADDR_SET_BY_PF BIT(13)
233-
#define I40EVF_FLAG_SERVICE_CLIENT_REQUESTED BIT(14)
234-
#define I40EVF_FLAG_CLIENT_NEEDS_OPEN BIT(15)
235-
#define I40EVF_FLAG_CLIENT_NEEDS_CLOSE BIT(16)
236-
#define I40EVF_FLAG_CLIENT_NEEDS_L2_PARAMS BIT(17)
237-
#define I40EVF_FLAG_PROMISC_ON BIT(18)
238-
#define I40EVF_FLAG_ALLMULTI_ON BIT(19)
239-
#define I40EVF_FLAG_LEGACY_RX BIT(20)
240-
#define I40EVF_FLAG_REINIT_ITR_NEEDED BIT(21)
225+
#define I40EVF_FLAG_IMIR_ENABLED BIT(1)
226+
#define I40EVF_FLAG_MQ_CAPABLE BIT(2)
227+
#define I40EVF_FLAG_PF_COMMS_FAILED BIT(3)
228+
#define I40EVF_FLAG_RESET_PENDING BIT(4)
229+
#define I40EVF_FLAG_RESET_NEEDED BIT(5)
230+
#define I40EVF_FLAG_WB_ON_ITR_CAPABLE BIT(6)
231+
#define I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE BIT(7)
232+
#define I40EVF_FLAG_ADDR_SET_BY_PF BIT(8)
233+
#define I40EVF_FLAG_SERVICE_CLIENT_REQUESTED BIT(9)
234+
#define I40EVF_FLAG_CLIENT_NEEDS_OPEN BIT(10)
235+
#define I40EVF_FLAG_CLIENT_NEEDS_CLOSE BIT(11)
236+
#define I40EVF_FLAG_CLIENT_NEEDS_L2_PARAMS BIT(12)
237+
#define I40EVF_FLAG_PROMISC_ON BIT(13)
238+
#define I40EVF_FLAG_ALLMULTI_ON BIT(14)
239+
#define I40EVF_FLAG_LEGACY_RX BIT(15)
240+
#define I40EVF_FLAG_REINIT_ITR_NEEDED BIT(16)
241241
/* duplicates for common code */
242242
#define I40E_FLAG_DCB_ENABLED 0
243243
#define I40E_FLAG_RX_CSUM_ENABLED I40EVF_FLAG_RX_CSUM_ENABLED

0 commit comments

Comments
 (0)