Skip to content

Commit 471a76d

Browse files
osctobeJeff Kirsher
authored andcommitted
ixgbevf: convert to ndo_fix_features
Private rx_csum flags are now duplicate of netdev->features & NETIF_F_RXCSUM. Removing this needs deeper surgery. Since ixgbevf doesn't change hardware state on RX csum enable/disable its reset is avoided. Things noticed: - HW VLAN acceleration probably can be toggled, but it's left as is - the resets on RX csum offload change can probably be avoided - there is A LOT of copy-and-pasted code here Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 4197aa7 commit 471a76d

File tree

2 files changed

+20
-51
lines changed

2 files changed

+20
-51
lines changed

drivers/net/ethernet/intel/ixgbevf/ethtool.c

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -117,44 +117,6 @@ static int ixgbevf_get_settings(struct net_device *netdev,
117117
return 0;
118118
}
119119

120-
static u32 ixgbevf_get_rx_csum(struct net_device *netdev)
121-
{
122-
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
123-
return adapter->flags & IXGBE_FLAG_RX_CSUM_ENABLED;
124-
}
125-
126-
static int ixgbevf_set_rx_csum(struct net_device *netdev, u32 data)
127-
{
128-
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
129-
if (data)
130-
adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED;
131-
else
132-
adapter->flags &= ~IXGBE_FLAG_RX_CSUM_ENABLED;
133-
134-
if (netif_running(netdev)) {
135-
if (!adapter->dev_closed)
136-
ixgbevf_reinit_locked(adapter);
137-
} else {
138-
ixgbevf_reset(adapter);
139-
}
140-
141-
return 0;
142-
}
143-
144-
static int ixgbevf_set_tso(struct net_device *netdev, u32 data)
145-
{
146-
if (data) {
147-
netdev->features |= NETIF_F_TSO;
148-
netdev->features |= NETIF_F_TSO6;
149-
} else {
150-
netif_tx_stop_all_queues(netdev);
151-
netdev->features &= ~NETIF_F_TSO;
152-
netdev->features &= ~NETIF_F_TSO6;
153-
netif_tx_start_all_queues(netdev);
154-
}
155-
return 0;
156-
}
157-
158120
static u32 ixgbevf_get_msglevel(struct net_device *netdev)
159121
{
160122
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
@@ -720,16 +682,8 @@ static struct ethtool_ops ixgbevf_ethtool_ops = {
720682
.get_link = ethtool_op_get_link,
721683
.get_ringparam = ixgbevf_get_ringparam,
722684
.set_ringparam = ixgbevf_set_ringparam,
723-
.get_rx_csum = ixgbevf_get_rx_csum,
724-
.set_rx_csum = ixgbevf_set_rx_csum,
725-
.get_tx_csum = ethtool_op_get_tx_csum,
726-
.set_tx_csum = ethtool_op_set_tx_ipv6_csum,
727-
.get_sg = ethtool_op_get_sg,
728-
.set_sg = ethtool_op_set_sg,
729685
.get_msglevel = ixgbevf_get_msglevel,
730686
.set_msglevel = ixgbevf_set_msglevel,
731-
.get_tso = ethtool_op_get_tso,
732-
.set_tso = ixgbevf_set_tso,
733687
.self_test = ixgbevf_diag_test,
734688
.get_sset_count = ixgbevf_get_sset_count,
735689
.get_strings = ixgbevf_get_strings,

drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3253,6 +3253,18 @@ static struct rtnl_link_stats64 *ixgbevf_get_stats(struct net_device *netdev,
32533253
return stats;
32543254
}
32553255

3256+
static int ixgbevf_set_features(struct net_device *netdev, u32 features)
3257+
{
3258+
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
3259+
3260+
if (features & NETIF_F_RXCSUM)
3261+
adapter->flags |= IXGBE_FLAG_RX_CSUM_ENABLED;
3262+
else
3263+
adapter->flags &= ~IXGBE_FLAG_RX_CSUM_ENABLED;
3264+
3265+
return 0;
3266+
}
3267+
32563268
static const struct net_device_ops ixgbe_netdev_ops = {
32573269
.ndo_open = ixgbevf_open,
32583270
.ndo_stop = ixgbevf_close,
@@ -3265,6 +3277,7 @@ static const struct net_device_ops ixgbe_netdev_ops = {
32653277
.ndo_tx_timeout = ixgbevf_tx_timeout,
32663278
.ndo_vlan_rx_add_vid = ixgbevf_vlan_rx_add_vid,
32673279
.ndo_vlan_rx_kill_vid = ixgbevf_vlan_rx_kill_vid,
3280+
.ndo_set_features = ixgbevf_set_features,
32683281
};
32693282

32703283
static void ixgbevf_assign_netdev_ops(struct net_device *dev)
@@ -3377,16 +3390,18 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev,
33773390
/* setup the private structure */
33783391
err = ixgbevf_sw_init(adapter);
33793392

3380-
netdev->features = NETIF_F_SG |
3393+
netdev->hw_features = NETIF_F_SG |
33813394
NETIF_F_IP_CSUM |
3395+
NETIF_F_IPV6_CSUM |
3396+
NETIF_F_TSO |
3397+
NETIF_F_TSO6 |
3398+
NETIF_F_RXCSUM;
3399+
3400+
netdev->features = netdev->hw_features |
33823401
NETIF_F_HW_VLAN_TX |
33833402
NETIF_F_HW_VLAN_RX |
33843403
NETIF_F_HW_VLAN_FILTER;
33853404

3386-
netdev->features |= NETIF_F_IPV6_CSUM;
3387-
netdev->features |= NETIF_F_TSO;
3388-
netdev->features |= NETIF_F_TSO6;
3389-
netdev->features |= NETIF_F_GRO;
33903405
netdev->vlan_features |= NETIF_F_TSO;
33913406
netdev->vlan_features |= NETIF_F_TSO6;
33923407
netdev->vlan_features |= NETIF_F_IP_CSUM;

0 commit comments

Comments
 (0)