@@ -1102,7 +1102,7 @@ static netdev_features_t alx_fix_features(struct net_device *netdev,
netdev_features_t features)
{
if (netdev->mtu > ALX_MAX_TSO_PKT_SIZE)
- features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
+ features &= ~netdev_general_tso_features;
return features;
}
@@ -521,7 +521,7 @@ static netdev_features_t atl1c_fix_features(struct net_device *netdev,
if (hw->nic_type != athr_mt) {
if (netdev->mtu > MAX_TSO_FRAME_SIZE)
- features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
+ features &= ~netdev_general_tso_features;
}
return features;
@@ -7877,7 +7877,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi,
}
segs = skb_gso_segment(skb, tp->dev->features &
- ~(NETIF_F_TSO | NETIF_F_TSO6));
+ ~netdev_general_tso_features);
if (IS_ERR(segs) || !segs)
goto tg3_tso_bug_end;
@@ -2903,9 +2903,10 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
if (ENIC_SETTING(enic, TXCSUM))
netdev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM;
- if (ENIC_SETTING(enic, TSO))
- netdev->hw_features |= NETIF_F_TSO |
- NETIF_F_TSO6 | NETIF_F_TSO_ECN;
+ if (ENIC_SETTING(enic, TSO)) {
+ netdev->hw_features |= netdev_general_tso_features;
+ netdev->hw_features |= NETIF_F_TSO_ECN;
+ }
if (ENIC_SETTING(enic, RSS))
netdev->hw_features |= NETIF_F_RXHASH;
if (ENIC_SETTING(enic, RXCSUM))
@@ -1773,11 +1773,11 @@ static int hns_nic_set_features(struct net_device *netdev,
switch (priv->enet_ver) {
case AE_VERSION_1:
- if (features & (NETIF_F_TSO | NETIF_F_TSO6))
+ if (features & netdev_general_tso_features)
netdev_info(netdev, "enet v1 do not support tso!\n");
break;
default:
- if (features & (NETIF_F_TSO | NETIF_F_TSO6)) {
+ if (features & netdev_general_tso_features) {
priv->ops.fill_desc = fill_tso_desc;
priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tso;
/* The chip only support 7*4096 */
@@ -2166,8 +2166,7 @@ static void hns_nic_set_priv_ops(struct net_device *netdev)
priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tx;
} else {
priv->ops.get_rxd_bnum = get_v2rx_desc_bnum;
- if ((netdev->features & NETIF_F_TSO) ||
- (netdev->features & NETIF_F_TSO6)) {
+ if (netdev->features & netdev_general_tso_features) {
priv->ops.fill_desc = fill_tso_desc;
priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tso;
/* This chip only support 7*4096 */
@@ -2365,7 +2364,7 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
case AE_VERSION_2:
netdev_active_features_set_array(ndev, &hns_v2_feature_set);
netdev_hw_features_set_array(ndev, &hns_hw_feature_set);
- ndev->vlan_features |= NETIF_F_TSO | NETIF_F_TSO6;
+ ndev->vlan_features |= netdev_general_tso_features;
ndev->max_mtu = MAC_MAX_MTU_V2 -
(ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN);
break;
@@ -872,7 +872,7 @@ static int ibmveth_set_tso(struct net_device *dev, u32 data)
set_attr, clr_attr, &ret_attr);
if (data == 1)
- dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
+ dev->features &= ~netdev_general_tso_features;
rc1 = -EIO;
} else {
@@ -901,7 +901,7 @@ static int ibmveth_set_features(struct net_device *dev,
{
struct ibmveth_adapter *adapter = netdev_priv(dev);
int rx_csum = !!(features & NETIF_F_RXCSUM);
- int large_send = !!(features & (NETIF_F_TSO | NETIF_F_TSO6));
+ int large_send = !!(features & netdev_general_tso_features);
int rc1 = 0, rc2 = 0;
if (rx_csum != adapter->rx_csum) {
@@ -915,8 +915,7 @@ static int ibmveth_set_features(struct net_device *dev,
if (large_send != adapter->large_send) {
rc2 = ibmveth_set_tso(dev, large_send);
if (rc2 && !adapter->large_send)
- dev->features =
- features & ~(NETIF_F_TSO | NETIF_F_TSO6);
+ dev->features = features & ~netdev_general_tso_features;
}
return rc1 ? rc1 : rc2;
@@ -1696,7 +1695,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
/* If running older firmware, TSO should not be enabled by default */
if (ret == H_SUCCESS && (ret_attr & IBMVETH_ILLAN_LRG_SND_SUPPORT) &&
!old_large_send) {
- netdev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
+ netdev->hw_features |= netdev_general_tso_features;
netdev->features |= netdev->hw_features;
} else {
netdev->hw_features |= NETIF_F_TSO;
@@ -5302,20 +5302,17 @@ static void e1000_watchdog_task(struct work_struct *work)
case SPEED_10:
case SPEED_100:
e_info("10/100 speed: disabling TSO\n");
- netdev->features &= ~NETIF_F_TSO;
- netdev->features &= ~NETIF_F_TSO6;
+ netdev->features &= ~netdev_general_tso_features;
break;
case SPEED_1000:
- netdev->features |= NETIF_F_TSO;
- netdev->features |= NETIF_F_TSO6;
+ netdev->features |= netdev_general_tso_features;
break;
default:
/* oops */
break;
}
if (hw->mac.type == e1000_pch_spt) {
- netdev->features &= ~NETIF_F_TSO;
- netdev->features &= ~NETIF_F_TSO6;
+ netdev->features &= ~netdev_general_tso_features;
}
}
@@ -7327,7 +7324,7 @@ static int e1000_set_features(struct net_device *netdev,
netdev_features_t changed = features ^ netdev->features;
netdev_features_t changeable;
- if (changed & (NETIF_F_TSO | NETIF_F_TSO6))
+ if (changed & netdev_general_tso_features)
adapter->flags |= FLAG_TSO_FORCE;
netdev_features_zero(&changeable);
@@ -3361,7 +3361,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
netdev_hw_features_zero(dev);
netdev_hw_features_set_array(dev, &mlx4_hw_feature_set1);
if (mdev->LSO_support)
- dev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
+ dev->hw_features |= netdev_general_tso_features;
if (mdev->dev->caps.tunnel_offload_mode ==
MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
@@ -1685,8 +1685,8 @@ static int nfp_net_set_features(struct net_device *netdev,
new_ctrl &= ~NFP_NET_CFG_CTRL_TXCSUM;
}
- if (changed & (NETIF_F_TSO | NETIF_F_TSO6)) {
- if (features & (NETIF_F_TSO | NETIF_F_TSO6))
+ if (changed & netdev_general_tso_features) {
+ if (features & netdev_general_tso_features)
new_ctrl |= nn->cap & NFP_NET_CFG_CTRL_LSO2 ?:
NFP_NET_CFG_CTRL_LSO;
else
@@ -2366,7 +2366,7 @@ static void nfp_net_netdev_init(struct nfp_net *nn)
}
if ((nn->cap & NFP_NET_CFG_CTRL_LSO && nn->fw_ver.major > 2) ||
nn->cap & NFP_NET_CFG_CTRL_LSO2) {
- netdev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
+ netdev->hw_features |= netdev_general_tso_features;
nn->dp.ctrl |= nn->cap & NFP_NET_CFG_CTRL_LSO2 ?:
NFP_NET_CFG_CTRL_LSO;
}
@@ -350,7 +350,7 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev,
netdev->hw_features |= NETIF_F_SG;
if ((repr_cap & NFP_NET_CFG_CTRL_LSO && nn->fw_ver.major > 2) ||
repr_cap & NFP_NET_CFG_CTRL_LSO2)
- netdev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
+ netdev->hw_features |= netdev_general_tso_features;
if (repr_cap & NFP_NET_CFG_CTRL_RSS_ANY)
netdev->hw_features |= NETIF_F_RXHASH;
if (repr_cap & NFP_NET_CFG_CTRL_VXLAN) {
@@ -1881,8 +1881,8 @@ netxen_tso_check(struct net_device *netdev,
vlan_oob = 1;
}
- if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) &&
- skb_shinfo(skb)->gso_size > 0) {
+ if ((netdev->features & netdev_general_tso_features) &&
+ skb_shinfo(skb)->gso_size > 0) {
hdr_len = skb_tcp_all_headers(skb);
@@ -1055,7 +1055,7 @@ static netdev_features_t qlcnic_process_flags(struct qlcnic_adapter *adapter,
netdev_features_clear_array(&qlcnic_csum_feature_set, &features);
if (QLCNIC_IS_TSO_CAPABLE(adapter))
- features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
+ features &= ~netdev_general_tso_features;
adapter->rx_csum = 0;
}
@@ -2300,8 +2300,8 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev)
netdev_vlan_features_set_array(netdev, &qlcnic_vlan_feature_set);
if (QLCNIC_IS_TSO_CAPABLE(adapter)) {
- netdev->features |= (NETIF_F_TSO | NETIF_F_TSO6);
- netdev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO6);
+ netdev->features |= netdev_general_tso_features;
+ netdev->vlan_features |= netdev_general_tso_features;
}
if (qlcnic_vlan_tx_check(adapter))
@@ -5451,7 +5451,8 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
* enable them. Use at own risk!
*/
if (rtl_chip_supports_csum_v2(tp)) {
- dev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6;
+ dev->hw_features |= NETIF_F_SG;
+ dev->hw_features |= netdev_general_tso_features;
netif_set_tso_max_size(dev, RTL_GSO_MAX_SIZE_V2);
netif_set_tso_max_segs(dev, RTL_GSO_MAX_SEGS_V2);
} else {
@@ -7148,7 +7148,7 @@ int stmmac_dvr_probe(struct device *device,
}
if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) {
- ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
+ ndev->hw_features |= netdev_general_tso_features;
if (priv->plat->has_gmac4)
ndev->hw_features |= NETIF_F_GSO_UDP_L4;
priv->tso = true;
@@ -179,8 +179,7 @@ static int xlgmac_init(struct xlgmac_pdata *pdata)
/* Set device features */
if (pdata->hw_feat.tso) {
- netdev->hw_features = NETIF_F_TSO;
- netdev->hw_features |= NETIF_F_TSO6;
+ netdev->hw_features = netdev_general_tso_features;
netdev->hw_features |= NETIF_F_SG;
netdev->hw_features |= netdev_ip_csum_features;
} else if (pdata->hw_feat.tx_coe) {
@@ -973,7 +973,7 @@ static int set_offload(struct tap_queue *q, unsigned long arg)
* When user space turns off TSO, we turn off GSO/LRO so that
* user-space will not receive TSO frames.
*/
- if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6))
+ if (feature_mask & netdev_general_tso_features)
netdev_features_set_array(&tap_rx_offload_feature_set, &features);
else
netdev_features_clear_array(&tap_rx_offload_feature_set, &features);
@@ -3515,8 +3515,8 @@ static int virtnet_probe(struct virtio_device *vdev)
dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {
- dev->hw_features |= NETIF_F_TSO
- | NETIF_F_TSO_ECN | NETIF_F_TSO6;
+ dev->hw_features |= netdev_general_tso_features;
+ dev->hw_features |= NETIF_F_TSO_ECN;
}
/* Individual feature bits: what can host handle? */
if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4))
@@ -1126,7 +1126,7 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
card->dev->vlan_features |= NETIF_F_TSO6;
}
- if (card->dev->hw_features & (NETIF_F_TSO | NETIF_F_TSO6)) {
+ if (card->dev->hw_features & netdev_general_tso_features) {
card->dev->needed_headroom = sizeof(struct qeth_hdr_tso);
netif_keep_dst(card->dev);
netif_set_tso_max_size(card->dev,
@@ -1911,7 +1911,7 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
NETIF_F_HW_VLAN_CTAG_RX;
netif_keep_dst(card->dev);
- if (card->dev->hw_features & (NETIF_F_TSO | NETIF_F_TSO6))
+ if (card->dev->hw_features & netdev_general_tso_features)
netif_set_tso_max_size(card->dev,
PAGE_SIZE * (QETH_MAX_BUFFER_ELEMENTS(card) - 1));
Replace the expression "NETIF_F_TSO | NETIF_F_TSO6" by netdev_general_tso_features, make it simple to use netdev features helpers later. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- drivers/net/ethernet/atheros/alx/main.c | 2 +- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 2 +- drivers/net/ethernet/broadcom/tg3.c | 2 +- drivers/net/ethernet/cisco/enic/enic_main.c | 7 ++++--- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 9 ++++----- drivers/net/ethernet/ibm/ibmveth.c | 9 ++++----- drivers/net/ethernet/intel/e1000e/netdev.c | 11 ++++------- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +- drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 6 +++--- drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 2 +- drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 4 ++-- drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 4 ++-- drivers/net/ethernet/realtek/r8169_main.c | 3 ++- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- drivers/net/ethernet/synopsys/dwc-xlgmac-common.c | 3 +-- drivers/net/tap.c | 2 +- drivers/net/virtio_net.c | 4 ++-- drivers/s390/net/qeth_l2_main.c | 2 +- drivers/s390/net/qeth_l3_main.c | 2 +- 20 files changed, 38 insertions(+), 42 deletions(-)