| From foo@baz Tue Sep 11 11:55:25 CEST 2018 |
| From: Manish Chopra <manish.chopra@cavium.com> |
| Date: Thu, 23 Aug 2018 13:20:52 -0700 |
| Subject: qlge: Fix netdev features configuration. |
| |
| From: Manish Chopra <manish.chopra@cavium.com> |
| |
| [ Upstream commit 6750c87074c5b534d82fdaabb1deb45b8f1f57de ] |
| |
| qlge_fix_features() is not supposed to modify hardware or |
| driver state, rather it is supposed to only fix requested |
| fetures bits. Currently qlge_fix_features() also goes for |
| interface down and up unnecessarily if there is not even |
| any change in features set. |
| |
| This patch changes/fixes following - |
| |
| 1) Move reload of interface or device re-config from |
| qlge_fix_features() to qlge_set_features(). |
| 2) Reload of interface in qlge_set_features() only if |
| relevant feature bit (NETIF_F_HW_VLAN_CTAG_RX) is changed. |
| 3) Get rid of qlge_fix_features() since driver is not really |
| required to fix any features bit. |
| |
| Signed-off-by: Manish <manish.chopra@cavium.com> |
| Reviewed-by: Benjamin Poirier <bpoirier@suse.com> |
| Signed-off-by: David S. Miller <davem@davemloft.net> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| --- |
| drivers/net/ethernet/qlogic/qlge/qlge_main.c | 23 ++++++++--------------- |
| 1 file changed, 8 insertions(+), 15 deletions(-) |
| |
| --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c |
| +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c |
| @@ -2388,26 +2388,20 @@ static int qlge_update_hw_vlan_features( |
| return status; |
| } |
| |
| -static netdev_features_t qlge_fix_features(struct net_device *ndev, |
| - netdev_features_t features) |
| -{ |
| - int err; |
| - |
| - /* Update the behavior of vlan accel in the adapter */ |
| - err = qlge_update_hw_vlan_features(ndev, features); |
| - if (err) |
| - return err; |
| - |
| - return features; |
| -} |
| - |
| static int qlge_set_features(struct net_device *ndev, |
| netdev_features_t features) |
| { |
| netdev_features_t changed = ndev->features ^ features; |
| + int err; |
| + |
| + if (changed & NETIF_F_HW_VLAN_CTAG_RX) { |
| + /* Update the behavior of vlan accel in the adapter */ |
| + err = qlge_update_hw_vlan_features(ndev, features); |
| + if (err) |
| + return err; |
| |
| - if (changed & NETIF_F_HW_VLAN_CTAG_RX) |
| qlge_vlan_mode(ndev, features); |
| + } |
| |
| return 0; |
| } |
| @@ -4720,7 +4714,6 @@ static const struct net_device_ops qlge_ |
| .ndo_set_mac_address = qlge_set_mac_address, |
| .ndo_validate_addr = eth_validate_addr, |
| .ndo_tx_timeout = qlge_tx_timeout, |
| - .ndo_fix_features = qlge_fix_features, |
| .ndo_set_features = qlge_set_features, |
| .ndo_vlan_rx_add_vid = qlge_vlan_rx_add_vid, |
| .ndo_vlan_rx_kill_vid = qlge_vlan_rx_kill_vid, |