Skip to content

Commit 0e8b9fd

Browse files
Ivan Vecerakuba-moo
authored andcommitted
i40e: Consolidate hardware capabilities
Fields .caps in i40e_hw and .hw_features in i40e_pf both indicate capabilities provided by hardware. Move and merge i40e_pf.hw_features into i40e_hw.caps as this is more appropriate place for them and adjust their names to I40E_HW_CAP_... convention. Signed-off-by: Ivan Vecera <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d0b1314 commit 0e8b9fd

File tree

7 files changed

+85
-90
lines changed

7 files changed

+85
-90
lines changed

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

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
#define I40E_MIN_VSI_ALLOC 83 /* LAN, ATR, FCOE, 64 VF */
3535
/* max 16 qps */
3636
#define i40e_default_queues_per_vmdq(pf) \
37-
(test_bit(I40E_HW_RSS_AQ_CAPABLE, (pf)->hw_features) ? 4 : 1)
37+
(test_bit(I40E_HW_CAP_RSS_AQ, (pf)->hw.caps) ? 4 : 1)
3838
#define I40E_DEFAULT_QUEUES_PER_VF 4
3939
#define I40E_MAX_VF_QUEUES 16
4040
#define i40e_pf_get_max_q_per_tc(pf) \
41-
(test_bit(I40E_HW_128_QP_RSS_CAPABLE, (pf)->hw_features) ? 128 : 64)
41+
(test_bit(I40E_HW_CAP_128_QP_RSS, (pf)->hw.caps) ? 128 : 64)
4242
#define I40E_FDIR_RING_COUNT 32
4343
#define I40E_MAX_AQ_BUF_SIZE 4096
4444
#define I40E_AQ_LEN 256
@@ -139,28 +139,6 @@ enum i40e_vsi_state {
139139
__I40E_VSI_STATE_SIZE__,
140140
};
141141

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-
164142
enum i40e_pf_flags {
165143
I40E_FLAG_MSI_ENA,
166144
I40E_FLAG_MSIX_ENA,
@@ -557,7 +535,6 @@ struct i40e_pf {
557535
struct timer_list service_timer;
558536
struct work_struct service_task;
559537

560-
DECLARE_BITMAP(hw_features, I40E_PF_HW_FEATURES_NBITS);
561538
DECLARE_BITMAP(flags, I40E_PF_FLAGS_NBITS);
562539
struct i40e_client_instance *cinst;
563540
bool stat_offsets_loaded;

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static void i40e_phy_type_to_ethtool(struct i40e_pf *pf,
502502
if (hw_link_info->requested_speeds & I40E_LINK_SPEED_1GB)
503503
ethtool_link_ksettings_add_link_mode(ks, advertising,
504504
1000baseT_Full);
505-
if (test_bit(I40E_HW_100M_SGMII_CAPABLE, pf->hw_features)) {
505+
if (test_bit(I40E_HW_CAP_100M_SGMII, pf->hw.caps)) {
506506
ethtool_link_ksettings_add_link_mode(ks, supported,
507507
100baseT_Full);
508508
ethtool_link_ksettings_add_link_mode(ks, advertising,
@@ -601,15 +601,15 @@ static void i40e_phy_type_to_ethtool(struct i40e_pf *pf,
601601
10000baseKX4_Full);
602602
}
603603
if (phy_types & I40E_CAP_PHY_TYPE_10GBASE_KR &&
604-
!test_bit(I40E_HW_HAVE_CRT_RETIMER, pf->hw_features)) {
604+
!test_bit(I40E_HW_CAP_CRT_RETIMER, pf->hw.caps)) {
605605
ethtool_link_ksettings_add_link_mode(ks, supported,
606606
10000baseKR_Full);
607607
if (hw_link_info->requested_speeds & I40E_LINK_SPEED_10GB)
608608
ethtool_link_ksettings_add_link_mode(ks, advertising,
609609
10000baseKR_Full);
610610
}
611611
if (phy_types & I40E_CAP_PHY_TYPE_1000BASE_KX &&
612-
!test_bit(I40E_HW_HAVE_CRT_RETIMER, pf->hw_features)) {
612+
!test_bit(I40E_HW_CAP_CRT_RETIMER, pf->hw.caps)) {
613613
ethtool_link_ksettings_add_link_mode(ks, supported,
614614
1000baseKX_Full);
615615
if (hw_link_info->requested_speeds & I40E_LINK_SPEED_1GB)
@@ -917,7 +917,7 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,
917917
if (hw_link_info->requested_speeds & I40E_LINK_SPEED_1GB)
918918
ethtool_link_ksettings_add_link_mode(ks, advertising,
919919
1000baseT_Full);
920-
if (test_bit(I40E_HW_100M_SGMII_CAPABLE, pf->hw_features)) {
920+
if (test_bit(I40E_HW_CAP_100M_SGMII, pf->hw.caps)) {
921921
ethtool_link_ksettings_add_link_mode(ks, supported,
922922
100baseT_Full);
923923
if (hw_link_info->requested_speeds &
@@ -2579,7 +2579,7 @@ static int i40e_get_ts_info(struct net_device *dev,
25792579
BIT(HWTSTAMP_FILTER_PTP_V2_L2_SYNC) |
25802580
BIT(HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ);
25812581

2582-
if (test_bit(I40E_HW_PTP_L4_CAPABLE, pf->hw_features))
2582+
if (test_bit(I40E_HW_CAP_PTP_L4, pf->hw.caps))
25832583
info->rx_filters |= BIT(HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
25842584
BIT(HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
25852585
BIT(HWTSTAMP_FILTER_PTP_V2_EVENT) |
@@ -2828,7 +2828,7 @@ static int i40e_set_phys_id(struct net_device *netdev,
28282828

28292829
switch (state) {
28302830
case ETHTOOL_ID_ACTIVE:
2831-
if (!test_bit(I40E_HW_PHY_CONTROLS_LEDS, pf->hw_features)) {
2831+
if (!test_bit(I40E_HW_CAP_PHY_CONTROLS_LEDS, pf->hw.caps)) {
28322832
pf->led_status = i40e_led_get(hw);
28332833
} else {
28342834
if (!test_bit(I40E_HW_CAP_AQ_PHY_ACCESS, hw->caps))
@@ -2840,19 +2840,19 @@ static int i40e_set_phys_id(struct net_device *netdev,
28402840
}
28412841
return blink_freq;
28422842
case ETHTOOL_ID_ON:
2843-
if (!test_bit(I40E_HW_PHY_CONTROLS_LEDS, pf->hw_features))
2843+
if (!test_bit(I40E_HW_CAP_PHY_CONTROLS_LEDS, pf->hw.caps))
28442844
i40e_led_set(hw, 0xf, false);
28452845
else
28462846
ret = i40e_led_set_phy(hw, true, pf->led_status, 0);
28472847
break;
28482848
case ETHTOOL_ID_OFF:
2849-
if (!test_bit(I40E_HW_PHY_CONTROLS_LEDS, pf->hw_features))
2849+
if (!test_bit(I40E_HW_CAP_PHY_CONTROLS_LEDS, pf->hw.caps))
28502850
i40e_led_set(hw, 0x0, false);
28512851
else
28522852
ret = i40e_led_set_phy(hw, false, pf->led_status, 0);
28532853
break;
28542854
case ETHTOOL_ID_INACTIVE:
2855-
if (!test_bit(I40E_HW_PHY_CONTROLS_LEDS, pf->hw_features)) {
2855+
if (!test_bit(I40E_HW_CAP_PHY_CONTROLS_LEDS, pf->hw.caps)) {
28562856
i40e_led_set(hw, pf->led_status, false);
28572857
} else {
28582858
ret = i40e_led_set_phy(hw, false, pf->led_status,
@@ -3653,22 +3653,22 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
36533653
switch (nfc->flow_type) {
36543654
case TCP_V4_FLOW:
36553655
set_bit(I40E_FILTER_PCTYPE_NONF_IPV4_TCP, flow_pctypes);
3656-
if (test_bit(I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE,
3657-
pf->hw_features))
3656+
if (test_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE,
3657+
pf->hw.caps))
36583658
set_bit(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK,
36593659
flow_pctypes);
36603660
break;
36613661
case TCP_V6_FLOW:
36623662
set_bit(I40E_FILTER_PCTYPE_NONF_IPV6_TCP, flow_pctypes);
3663-
if (test_bit(I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE,
3664-
pf->hw_features))
3663+
if (test_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE,
3664+
pf->hw.caps))
36653665
set_bit(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK,
36663666
flow_pctypes);
36673667
break;
36683668
case UDP_V4_FLOW:
36693669
set_bit(I40E_FILTER_PCTYPE_NONF_IPV4_UDP, flow_pctypes);
3670-
if (test_bit(I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE,
3671-
pf->hw_features)) {
3670+
if (test_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE,
3671+
pf->hw.caps)) {
36723672
set_bit(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP,
36733673
flow_pctypes);
36743674
set_bit(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP,
@@ -3678,8 +3678,8 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
36783678
break;
36793679
case UDP_V6_FLOW:
36803680
set_bit(I40E_FILTER_PCTYPE_NONF_IPV6_UDP, flow_pctypes);
3681-
if (test_bit(I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE,
3682-
pf->hw_features)) {
3681+
if (test_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE,
3682+
pf->hw.caps)) {
36833683
set_bit(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP,
36843684
flow_pctypes);
36853685
set_bit(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP,
@@ -5328,7 +5328,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
53285328

53295329
/* ATR eviction is not supported on all devices */
53305330
if (test_bit(I40E_FLAG_HW_ATR_EVICT_ENA, new_flags) &&
5331-
!test_bit(I40E_HW_ATR_EVICT_CAPABLE, pf->hw_features))
5331+
!test_bit(I40E_HW_CAP_ATR_EVICT, pf->hw.caps))
53325332
return -EOPNOTSUPP;
53335333

53345334
/* If the driver detected FW LLDP was disabled on init, this flag could

0 commit comments

Comments
 (0)