在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ethernet/sfc/ef10.c | 33 +++++++++++++------- drivers/net/ethernet/sfc/ef100_nic.c | 39 ++++++++++++++++-------- drivers/net/ethernet/sfc/ef100_rx.c | 6 ++-- drivers/net/ethernet/sfc/ef100_tx.c | 11 ++++--- drivers/net/ethernet/sfc/ef10_sriov.c | 6 ++-- drivers/net/ethernet/sfc/efx.c | 30 +++++++++++-------- drivers/net/ethernet/sfc/efx_common.c | 36 ++++++++++++++-------- drivers/net/ethernet/sfc/falcon/efx.c | 45 ++++++++++++++++++---------- drivers/net/ethernet/sfc/falcon/net_driver.h | 4 +-- drivers/net/ethernet/sfc/falcon/rx.c | 6 ++-- drivers/net/ethernet/sfc/farch.c | 2 +- drivers/net/ethernet/sfc/mcdi_filters.c | 18 +++++++---- drivers/net/ethernet/sfc/mcdi_port_common.c | 3 +- drivers/net/ethernet/sfc/net_driver.h | 4 +-- drivers/net/ethernet/sfc/rx.c | 3 +- drivers/net/ethernet/sfc/rx_common.c | 3 +- 16 files changed, 162 insertions(+), 87 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index e7e2223..7bb1c8c 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -627,7 +627,8 @@ static int efx_ef10_probe(struct efx_nic *efx)
if (nic_data->datapath_caps & (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_INCLUDE_FCS_LBN))
efx->net_dev->hw_features |= NETIF_F_RXFCS;
netdev_feature_set_bit(NETIF_F_RXFCS_BIT,
&efx->net_dev->hw_features);
rc = efx_mcdi_port_get_number(efx); if (rc < 0)
@@ -1304,9 +1305,11 @@ static void efx_ef10_fini_nic(struct efx_nic *efx) static int efx_ef10_init_nic(struct efx_nic *efx) { struct efx_ef10_nic_data *nic_data = efx->nic_data;
- netdev_features_t hw_enc_features = 0;
netdev_features_t hw_enc_features; int rc;
netdev_feature_zero(&hw_enc_features);
if (nic_data->must_check_datapath_caps) { rc = efx_ef10_init_datapath_caps(efx); if (rc)
@@ -1351,18 +1354,27 @@ static int efx_ef10_init_nic(struct efx_nic *efx)
/* add encapsulated checksum offload features */ if (efx_has_cap(efx, VXLAN_NVGRE) && !efx_ef10_is_vf(efx))
hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM,
/* add encapsulated TSO features */ if (efx_has_cap(efx, TX_TSO_V2_ENCAP)) { netdev_features_t encap_tso_features;&hw_enc_features);
encap_tso_features = NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM;
hw_enc_features |= encap_tso_features | NETIF_F_TSO;
efx->net_dev->features |= encap_tso_features;
netdev_feature_zero(&encap_tso_features);
netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_GRE |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE_CSUM,
&encap_tso_features);
netdev_feature_or(&hw_enc_features, hw_enc_features,
encap_tso_features);
netdev_feature_set_bit(NETIF_F_TSO_BIT, &hw_enc_features);
netdev_feature_or(&efx->net_dev->features,
efx->net_dev->features,
}encap_tso_features);
- efx->net_dev->hw_enc_features = hw_enc_features;
netdev_feature_copy(&efx->net_dev->hw_enc_features, hw_enc_features);
/* don't fail init if RSS setup doesn't work */ rc = efx->type->rx_push_rss_config(efx, false,
@@ -2694,7 +2706,8 @@ static u16 efx_ef10_handle_rx_event_errors(struct efx_channel *channel, bool handled = false;
if (EFX_QWORD_FIELD(*event, ESF_DZ_RX_ECRC_ERR)) {
if (!(efx->net_dev->features & NETIF_F_RXALL)) {
if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
efx->net_dev->features)) { if (!efx->loopback_selftest) channel->n_rx_eth_crc_err += n_packets; return EFX_RX_PKT_DISCARD;
diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c index 518268c..35f6dd0 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.c +++ b/drivers/net/ethernet/sfc/ef100_nic.c @@ -184,17 +184,26 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3)) { struct net_device *net_dev = efx->net_dev;
netdev_features_t tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
net_dev->features |= tso;
net_dev->hw_features |= tso;
net_dev->hw_enc_features |= tso;
netdev_features_t tso;
netdev_feature_zero(&tso);
netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_PARTIAL |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM,
&tso);
netdev_feature_or(&net_dev->features, net_dev->features, tso);
netdev_feature_or(&net_dev->hw_features, net_dev->hw_features,
tso);
netdev_feature_or(&net_dev->hw_enc_features,
/* EF100 HW can only offload outer checksums if they are UDP,net_dev->hw_enc_features, tso);
*/
- so for GRE_CSUM we have to use GSO_PARTIAL.
net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT,
} efx->num_mac_stats = MCDI_WORD(outbuf, GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS);&net_dev->gso_partial_features);
@@ -1111,11 +1120,15 @@ static int ef100_probe_main(struct efx_nic *efx) return -ENOMEM; efx->nic_data = nic_data; nic_data->efx = efx;
- net_dev->features |= efx->type->offload_features;
- net_dev->hw_features |= efx->type->offload_features;
- net_dev->hw_enc_features |= efx->type->offload_features;
- net_dev->vlan_features |= NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_ALL_TSO;
netdev_feature_set_bits(efx->type->offload_features,
&net_dev->features);
netdev_feature_set_bits(efx->type->offload_features,
&net_dev->hw_features);
netdev_feature_set_bits(efx->type->offload_features,
&net_dev->hw_enc_features);
netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_ALL_TSO,
&net_dev->vlan_features);
/* Populate design-parameter defaults */ nic_data->tso_max_hdr_len = ESE_EF100_DP_GZ_TSO_MAX_HDR_LEN_DEFAULT;
diff --git a/drivers/net/ethernet/sfc/ef100_rx.c b/drivers/net/ethernet/sfc/ef100_rx.c index 85207ac..ffd7d7c 100644 --- a/drivers/net/ethernet/sfc/ef100_rx.c +++ b/drivers/net/ethernet/sfc/ef100_rx.c @@ -64,7 +64,8 @@ void __ef100_rx_packet(struct efx_channel *channel) prefix = (u32 *)(eh - ESE_GZ_RX_PKT_PREFIX_LEN);
if (ef100_has_fcs_error(channel, prefix) &&
unlikely(!(efx->net_dev->features & NETIF_F_RXALL)))
unlikely(!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
efx->net_dev->features)))
goto out;
rx_buf->len = le16_to_cpu((__force __le16)PREFIX_FIELD(prefix, LENGTH));
@@ -76,7 +77,8 @@ void __ef100_rx_packet(struct efx_channel *channel) goto out; }
- if (likely(efx->net_dev->features & NETIF_F_RXCSUM)) {
- if (likely(netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
if (PREFIX_FIELD(prefix, NT_OR_INNER_L3_CLASS) == 1) { ++channel->n_rx_ip_hdr_chksum_err; } else {efx->net_dev->features))) {
diff --git a/drivers/net/ethernet/sfc/ef100_tx.c b/drivers/net/ethernet/sfc/ef100_tx.c index 26ef51d..087c18e 100644 --- a/drivers/net/ethernet/sfc/ef100_tx.c +++ b/drivers/net/ethernet/sfc/ef100_tx.c @@ -61,7 +61,7 @@ static bool ef100_tx_can_tso(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
if (!skb_is_gso_tcp(skb)) return false;
- if (!(efx->net_dev->features & NETIF_F_TSO))
if (!netdev_feature_test_bit(NETIF_F_TSO_BIT, efx->net_dev->features)) return false;
mss = skb_shinfo(skb)->gso_size;
@@ -175,9 +175,11 @@ static void ef100_make_send_desc(struct efx_nic *efx, ESF_GZ_TX_SEND_LEN, buffer->len, ESF_GZ_TX_SEND_ADDR, buffer->dma_addr);
- if (likely(efx->net_dev->features & NETIF_F_HW_CSUM))
- if (likely(netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT,
ef100_set_tx_csum_partial(skb, buffer, txd);efx->net_dev->features)))
- if (efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_TX &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
skb && skb_vlan_tag_present(skb)) ef100_set_tx_hw_vlan(skb, txd); }efx->net_dev->features) &&
@@ -202,7 +204,8 @@ static void ef100_make_tso_desc(struct efx_nic *efx,
if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID) mangleid = ESE_GZ_TX_DESC_IP4_ID_NO_OP;
- if (efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_TX)
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
efx->net_dev->features))
vlan_enable = skb_vlan_tag_present(skb);
len = skb->len - buffer->len;
diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c index 752d640..2e449b5 100644 --- a/drivers/net/ethernet/sfc/ef10_sriov.c +++ b/drivers/net/ethernet/sfc/ef10_sriov.c @@ -243,9 +243,11 @@ static int efx_ef10_vadaptor_alloc_set_features(struct efx_nic *efx)
if (port_flags & (1 << MC_CMD_VPORT_ALLOC_IN_FLAG_VLAN_RESTRICT_LBN))
efx->fixed_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
else&efx->fixed_features);
efx->fixed_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&efx->fixed_features);
return 0;
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index a295e26..ed142f3 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c @@ -1029,6 +1029,7 @@ static int efx_pci_probe_post_io(struct efx_nic *efx) { struct net_device *net_dev = efx->net_dev; int rc = efx_pci_probe_main(efx);
netdev_features_t tmp;
if (rc) return rc;
@@ -1041,29 +1042,34 @@ static int efx_pci_probe_post_io(struct efx_nic *efx) }
/* Determine netdevice features */
- net_dev->features |= (efx->type->offload_features | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL);
- netdev_feature_set_bits(efx->type->offload_features | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL,
&net_dev->features);
- if (efx->type->offload_features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM))
net_dev->features |= NETIF_F_TSO6;
/* Check whether device supports TSO */ if (!efx->type->tso_versions || !efx->type->tso_versions(efx))netdev_feature_set_bit(NETIF_F_TSO6_BIT, &net_dev->features);
net_dev->features &= ~NETIF_F_ALL_TSO;
/* Mask for features that also apply to VLAN devices */netdev_feature_clear_bits(NETIF_F_ALL_TSO, &net_dev->features);
- net_dev->vlan_features |= (NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_ALL_TSO |
NETIF_F_RXCSUM);
- netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_ALL_TSO |
NETIF_F_RXCSUM, &net_dev->vlan_features);
- net_dev->hw_features |= net_dev->features & ~efx->fixed_features;
netdev_feature_andnot(&tmp, net_dev->features, efx->fixed_features);
netdev_feature_or(&net_dev->hw_features, net_dev->hw_features, tmp);
/* Disable receiving frames with bad FCS, by default. */
- net_dev->features &= ~NETIF_F_RXALL;
netdev_feature_clear_bit(NETIF_F_RXALL_BIT, &net_dev->features);
/* Disable VLAN filtering by default. It may be enforced if
- the feature is fixed (i.e. VLAN filters are required to
- receive VLAN tagged packets due to vPort restrictions).
*/
- net_dev->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
- net_dev->features |= efx->fixed_features;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&net_dev->features);
netdev_feature_or(&net_dev->features, net_dev->features,
efx->fixed_features);
rc = efx_register_netdev(efx); if (!rc)
@@ -1096,7 +1102,7 @@ static int efx_pci_probe(struct pci_dev *pci_dev, return -ENOMEM; efx = netdev_priv(net_dev); efx->type = (const struct efx_nic_type *) entry->driver_data;
- efx->fixed_features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &efx->fixed_features);
pci_set_drvdata(pci_dev, efx); SET_NETDEV_DEV(net_dev, &pci_dev->dev);
diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/efx_common.c index a101fa5..0135373 100644 --- a/drivers/net/ethernet/sfc/efx_common.c +++ b/drivers/net/ethernet/sfc/efx_common.c @@ -211,10 +211,12 @@ void efx_set_rx_mode(struct net_device *net_dev) int efx_set_features(struct net_device *net_dev, netdev_features_t data) { struct efx_nic *efx = netdev_priv(net_dev);
netdev_features_t changed; int rc;
/* If disabling RX n-tuple filtering, clear existing filters */
- if (net_dev->features & ~data & NETIF_F_NTUPLE) {
- if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, net_dev->features) &&
rc = efx->type->filter_clear_rx(efx, EFX_FILTER_PRI_MANUAL); if (rc) return rc;!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, data)) {
@@ -223,8 +225,9 @@ int efx_set_features(struct net_device *net_dev, netdev_features_t data) /* If Rx VLAN filter is changed, update filters via mac_reconfigure. * If rx-fcs is changed, mac_reconfigure updates that too. */
- if ((net_dev->features ^ data) & (NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_RXFCS)) {
- netdev_feature_xor(&changed, net_dev->features, data);
- if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
/* efx_set_rx_mode() will schedule MAC work to update filtersNETIF_F_RXFCS, changed)) {
*/
- when a new features are finally set in net_dev.
@@ -363,8 +366,8 @@ void efx_start_monitor(struct efx_nic *efx) */ static void efx_start_datapath(struct efx_nic *efx) {
- netdev_features_t old_features = efx->net_dev->features; bool old_rx_scatter = efx->rx_scatter;
netdev_features_t old_features; size_t rx_buf_len;
/* Calculate the rx buffer allocation parameters required to
@@ -409,10 +412,14 @@ static void efx_start_datapath(struct efx_nic *efx) /* Restore previously fixed features in hw_features and remove * features which are fixed now */
- efx->net_dev->hw_features |= efx->net_dev->features;
- efx->net_dev->hw_features &= ~efx->fixed_features;
- efx->net_dev->features |= efx->fixed_features;
- if (efx->net_dev->features != old_features)
netdev_feature_copy(&old_features, efx->net_dev->features);
netdev_feature_or(&efx->net_dev->hw_features,
efx->net_dev->hw_features, efx->net_dev->features);
netdev_feature_andnot(&efx->net_dev->hw_features,
efx->net_dev->hw_features, efx->fixed_features);
netdev_feature_or(&efx->net_dev->features, efx->net_dev->features,
efx->fixed_features);
if (!netdev_feature_equal(efx->net_dev->features, old_features)) netdev_features_change(efx->net_dev);
/* RX filters may also have scatter-enabled flags */
@@ -1359,17 +1366,20 @@ void efx_features_check(struct sk_buff *skb, struct net_device *dev, struct efx_nic *efx = netdev_priv(dev);
if (skb->encapsulation) {
if (*features & NETIF_F_GSO_MASK)
if (netdev_feature_test_bits(NETIF_F_GSO_MASK, *features)) /* Hardware can only do TSO with at most 208 bytes * of headers. */ if (skb_inner_transport_offset(skb) > EFX_TSO2_MAX_HDRLEN)
*features &= ~(NETIF_F_GSO_MASK);
if (*features & (NETIF_F_GSO_MASK | NETIF_F_CSUM_MASK))
netdev_feature_clear_bits(NETIF_F_GSO_MASK,
features);
if (netdev_feature_test_bits(NETIF_F_GSO_MASK |
NETIF_F_CSUM_MASK, *features)) if (!efx_can_encap_offloads(efx, skb))
*features &= ~(NETIF_F_GSO_MASK |
NETIF_F_CSUM_MASK);
netdev_feature_clear_bits(NETIF_F_GSO_MASK |
NETIF_F_CSUM_MASK,
} }features);
diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c index c177ea0..af4aeb0 100644 --- a/drivers/net/ethernet/sfc/falcon/efx.c +++ b/drivers/net/ethernet/sfc/falcon/efx.c @@ -592,8 +592,8 @@ static int ef4_probe_channels(struct ef4_nic *efx) */ static void ef4_start_datapath(struct ef4_nic *efx) {
- netdev_features_t old_features = efx->net_dev->features; bool old_rx_scatter = efx->rx_scatter;
- netdev_features_t old_features; struct ef4_tx_queue *tx_queue; struct ef4_rx_queue *rx_queue; struct ef4_channel *channel;
@@ -640,10 +640,14 @@ static void ef4_start_datapath(struct ef4_nic *efx) /* Restore previously fixed features in hw_features and remove * features which are fixed now */
- efx->net_dev->hw_features |= efx->net_dev->features;
- efx->net_dev->hw_features &= ~efx->fixed_features;
- efx->net_dev->features |= efx->fixed_features;
- if (efx->net_dev->features != old_features)
netdev_feature_copy(&old_features, efx->net_dev->features);
netdev_feature_or(&efx->net_dev->hw_features,
efx->net_dev->hw_features, efx->net_dev->features);
netdev_feature_andnot(&efx->net_dev->hw_features,
efx->net_dev->hw_features, efx->fixed_features);
netdev_feature_or(&efx->net_dev->features, efx->net_dev->features,
efx->net_dev->features);
if (!netdev_feature_equal(efx->net_dev->features, old_features)) netdev_features_change(efx->net_dev);
/* RX filters may also have scatter-enabled flags */
@@ -2192,17 +2196,21 @@ static void ef4_set_rx_mode(struct net_device *net_dev) static int ef4_set_features(struct net_device *net_dev, netdev_features_t data) { struct ef4_nic *efx = netdev_priv(net_dev);
netdev_features_t changed; int rc;
/* If disabling RX n-tuple filtering, clear existing filters */
- if (net_dev->features & ~data & NETIF_F_NTUPLE) {
if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, net_dev->features) &&
!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, data)) {
rc = efx->type->filter_clear_rx(efx, EF4_FILTER_PRI_MANUAL); if (rc) return rc; }
/* If Rx VLAN filter is changed, update filters via mac_reconfigure */
- if ((net_dev->features ^ data) & NETIF_F_HW_VLAN_CTAG_FILTER) {
- netdev_feature_xor(&changed, net_dev->features, data);
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
/* ef4_set_rx_mode() will schedule MAC work to update filterschanged)) {
*/
- when a new features are finally set in net_dev.
@@ -2925,7 +2933,7 @@ static int ef4_pci_probe(struct pci_dev *pci_dev, return -ENOMEM; efx = netdev_priv(net_dev); efx->type = (const struct ef4_nic_type *) entry->driver_data;
- efx->fixed_features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &efx->fixed_features);
pci_set_drvdata(pci_dev, efx); SET_NETDEV_DEV(net_dev, &pci_dev->dev);
@@ -2947,20 +2955,27 @@ static int ef4_pci_probe(struct pci_dev *pci_dev, if (rc) goto fail3;
- net_dev->features |= (efx->type->offload_features | NETIF_F_SG |
NETIF_F_RXCSUM);
- netdev_feature_set_bits(efx->type->offload_features,
&net_dev->features);
- netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM,
/* Mask for features that also apply to VLAN devices */&net_dev->features);
- net_dev->vlan_features |= (NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_RXCSUM);
- netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_RXCSUM,
&net_dev->vlan_features);
- net_dev->hw_features = net_dev->features & ~efx->fixed_features;
- netdev_feature_copy(&net_dev->hw_features, net_dev->features);
- netdev_feature_clear_bits(efx->type->offload_features,
&net_dev->hw_features);
it's "efx->fixed_features", not "efx->type->offload_features", so it should be “netdev_feature_andnot(net_dev->hw_features, net_dev->features, efx->fixed_features)” will fix it in next version
/* Disable VLAN filtering by default. It may be enforced if * the feature is fixed (i.e. VLAN filters are required to * receive VLAN tagged packets due to vPort restrictions). */
- net_dev->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
- net_dev->features |= efx->fixed_features;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&net_dev->features);
netdev_feature_or(&net_dev->features, net_dev->features,
efx->fixed_features);
rc = ef4_register_netdev(efx); if (rc)
diff --git a/drivers/net/ethernet/sfc/falcon/net_driver.h b/drivers/net/ethernet/sfc/falcon/net_driver.h index 6fabfe7..10d7db7 100644 --- a/drivers/net/ethernet/sfc/falcon/net_driver.h +++ b/drivers/net/ethernet/sfc/falcon/net_driver.h @@ -1153,7 +1153,7 @@ struct ef4_nic_type { bool always_rx_scatter; unsigned int max_interrupt_mode; unsigned int timer_period_max;
- netdev_features_t offload_features;
- u64 offload_features; unsigned int max_rx_ip_filters; };
@@ -1303,7 +1303,7 @@ static inline void ef4_supported_features(const struct ef4_nic *efx, { const struct net_device *net_dev = efx->net_dev;
- *supported = net_dev->features | net_dev->hw_features;
netdev_feature_or(supported, net_dev->features, net_dev->hw_features); }
/* Get the current TX queue insert index. */
diff --git a/drivers/net/ethernet/sfc/falcon/rx.c b/drivers/net/ethernet/sfc/falcon/rx.c index 966f13e..0fc41f8 100644 --- a/drivers/net/ethernet/sfc/falcon/rx.c +++ b/drivers/net/ethernet/sfc/falcon/rx.c @@ -438,7 +438,8 @@ ef4_rx_packet_gro(struct ef4_channel *channel, struct ef4_rx_buffer *rx_buf, return; }
- if (efx->net_dev->features & NETIF_F_RXHASH)
- if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
skb_set_hash(skb, ef4_rx_buf_hash(efx, eh), PKT_HASH_TYPE_L3); skb->ip_summed = ((rx_buf->flags & EF4_RX_PKT_CSUMMED) ?efx->net_dev->features))
@@ -667,7 +668,8 @@ void __ef4_rx_packet(struct ef4_channel *channel) goto out; }
- if (unlikely(!(efx->net_dev->features & NETIF_F_RXCSUM)))
if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
efx->net_dev->features)))
rx_buf->flags &= ~EF4_RX_PKT_CSUMMED;
if ((rx_buf->flags & EF4_RX_PKT_TCP) && !channel->type->receive_skb)
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c index 148dcd4..8e95075 100644 --- a/drivers/net/ethernet/sfc/farch.c +++ b/drivers/net/ethernet/sfc/farch.c @@ -921,7 +921,7 @@ static u16 efx_farch_handle_rx_not_ok(struct efx_rx_queue *rx_queue, (void) rx_ev_other_err; #endif
- if (efx->net_dev->features & NETIF_F_RXALL)
- if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, efx->net_dev->features)) /* don't discard frame for CRC error */ rx_ev_eth_crc_err = false;
diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c index 8e788c3..2a9a692 100644 --- a/drivers/net/ethernet/sfc/mcdi_filters.c +++ b/drivers/net/ethernet/sfc/mcdi_filters.c @@ -1322,16 +1322,20 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining) goto fail;
efx_supported_features(efx, &supported);
- if ((supported & NETIF_F_HW_VLAN_CTAG_FILTER) &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
!(efx_mcdi_filter_match_supported(table, false, (EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_LOC_MAC)) && efx_mcdi_filter_match_supported(table, false, (EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_LOC_MAC_IG)))) { netif_info(efx, probe, net_dev, "VLAN filters are not supported in this firmware variant\n");supported) &&
net_dev->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
efx->fixed_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
net_dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&net_dev->features);
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&efx->fixed_features);
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&net_dev->hw_features);
}
table->entry = vzalloc(array_size(EFX_MCDI_FILTER_TBL_ROWS,
@@ -1343,7 +1347,8 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining)
table->mc_promisc_last = false; table->vlan_filter =
!!(efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_FILTER);
netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
INIT_LIST_HEAD(&table->vlan_list); init_rwsem(&table->lock);efx->net_dev->features);
@@ -1760,7 +1765,8 @@ void efx_mcdi_filter_sync_rx_mode(struct efx_nic *efx) * Do it in advance to avoid conflicts for unicast untagged and * VLAN 0 tagged filters. */
- vlan_filter = !!(net_dev->features & NETIF_F_HW_VLAN_CTAG_FILTER);
- vlan_filter = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
if (table->vlan_filter != vlan_filter) { table->vlan_filter = vlan_filter; efx_mcdi_filter_remove_old(efx);net_dev->features);
diff --git a/drivers/net/ethernet/sfc/mcdi_port_common.c b/drivers/net/ethernet/sfc/mcdi_port_common.c index 4bd3ef8..81c4a8d 100644 --- a/drivers/net/ethernet/sfc/mcdi_port_common.c +++ b/drivers/net/ethernet/sfc/mcdi_port_common.c @@ -1097,7 +1097,8 @@ int efx_mcdi_set_mac(struct efx_nic *efx)
MCDI_POPULATE_DWORD_1(cmdbytes, SET_MAC_IN_FLAGS, SET_MAC_IN_FLAG_INCLUDE_FCS,
!!(efx->net_dev->features & NETIF_F_RXFCS));
netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
efx->net_dev->features));
switch (efx->wanted_fc) { case EFX_FC_RX | EFX_FC_TX:
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index cfeb37f..a4e0ff7 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h @@ -1469,7 +1469,7 @@ struct efx_nic_type { bool option_descriptors; unsigned int min_interrupt_mode; unsigned int timer_period_max;
- netdev_features_t offload_features;
- u64 offload_features; int mcdi_max_ver; unsigned int max_rx_ip_filters; u32 hwtstamp_filters;
@@ -1678,7 +1678,7 @@ static inline void efx_supported_features(const struct efx_nic *efx, { const struct net_device *net_dev = efx->net_dev;
- *supported = net_dev->features | net_dev->hw_features;
netdev_feature_or(supported, net_dev->features, net_dev->hw_features); }
/* Get the current TX queue insert index. */
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index 6067509..1a9cb9a 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c @@ -387,7 +387,8 @@ void __efx_rx_packet(struct efx_channel *channel) if (!efx_do_xdp(efx, channel, rx_buf, &eh)) goto out;
- if (unlikely(!(efx->net_dev->features & NETIF_F_RXCSUM)))
if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
efx->net_dev->features)))
rx_buf->flags &= ~EFX_RX_PKT_CSUMMED;
if ((rx_buf->flags & EFX_RX_PKT_TCP) && !channel->type->receive_skb)
diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c index 68fc7d3..d10a28e 100644 --- a/drivers/net/ethernet/sfc/rx_common.c +++ b/drivers/net/ethernet/sfc/rx_common.c @@ -525,7 +525,8 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf, return; }
- if (efx->net_dev->features & NETIF_F_RXHASH &&
- if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
efx_rx_buf_hash_valid(efx, eh)) skb_set_hash(skb, efx_rx_buf_hash(efx, eh), PKT_HASH_TYPE_L3);efx->net_dev->features) &&