lkml.org 
[lkml]   [2011]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH net-next v1 1/4] net-e1000e: fix ethtool set_features taking new features into account too late
2011/11/22 David Decotigny <david.decotigny@google.com>:
[...]
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index a5bd7a3..b63f316 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -5901,24 +5901,28 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter)
>  }
>
>  static int e1000_set_features(struct net_device *netdev,
> -       netdev_features_t features)
> +                             netdev_features_t features)
>  {
>        struct e1000_adapter *adapter = netdev_priv(netdev);
>        netdev_features_t changed = features ^ netdev->features;
> +       int retval = 1;  /* telling netdev that we are updating
> +                         * netdev->features by ourselves */
> +
> +       netdev->features = features;
>
>        if (changed & (NETIF_F_TSO | NETIF_F_TSO6))
>                adapter->flags |= FLAG_TSO_FORCE;
>
>        if (!(changed & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX |
>                         NETIF_F_RXCSUM)))
> -               return 0;
> +               return retval;
>

Would be less code if you set netdev->features here...

>        if (netif_running(netdev))
>                e1000e_reinit_locked(adapter);
>        else
>                e1000e_reset(adapter);
>
> -       return 0;
> +       return retval;

... and return 1 here, noting in a comment that e1000e_reinit_locked()
might have changed netdev->features.

>  }

Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-11-22 01:03    [W:0.070 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site