* [PATCH -next] vmxnet3: fail when try to setup unsupported features
@ 2010-06-28 9:29 Stanislaw Gruszka
2010-06-28 17:45 ` Shreyas Bhatewara
2010-06-29 7:55 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Stanislaw Gruszka @ 2010-06-28 9:29 UTC (permalink / raw)
To: netdev; +Cc: Amerigo Wang, Shreyas Bhatewara
Return EOPNOTSUPP in ethtool_ops->set_flags.
Fix coding style while at it.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
drivers/net/vmxnet3/vmxnet3_ethtool.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 3935c44..8a71a21 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -276,16 +276,21 @@ vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
}
static u32
-vmxnet3_get_flags(struct net_device *netdev) {
+vmxnet3_get_flags(struct net_device *netdev)
+{
return netdev->features;
}
static int
-vmxnet3_set_flags(struct net_device *netdev, u32 data) {
+vmxnet3_set_flags(struct net_device *netdev, u32 data)
+{
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1;
u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1;
+ if (data & ~ETH_FLAG_LRO)
+ return -EOPNOTSUPP;
+
if (lro_requested ^ lro_present) {
/* toggle the LRO feature*/
netdev->features ^= NETIF_F_LRO;
--
1.5.5.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH -next] vmxnet3: fail when try to setup unsupported features
2010-06-28 9:29 [PATCH -next] vmxnet3: fail when try to setup unsupported features Stanislaw Gruszka
@ 2010-06-28 17:45 ` Shreyas Bhatewara
2010-06-29 9:15 ` Stanislaw Gruszka
2010-06-29 7:55 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Shreyas Bhatewara @ 2010-06-28 17:45 UTC (permalink / raw)
To: Stanislaw Gruszka, netdev; +Cc: Amerigo Wang
> -----Original Message-----
> From: Stanislaw Gruszka [mailto:sgruszka@redhat.com]
> Sent: Monday, June 28, 2010 2:30 AM
> To: netdev@vger.kernel.org
> Cc: Amerigo Wang; Shreyas Bhatewara
> Subject: [PATCH -next] vmxnet3: fail when try to setup unsupported
> features
>
> Return EOPNOTSUPP in ethtool_ops->set_flags.
>
> Fix coding style while at it.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
> drivers/net/vmxnet3/vmxnet3_ethtool.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c
> b/drivers/net/vmxnet3/vmxnet3_ethtool.c
> index 3935c44..8a71a21 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
> +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
> @@ -276,16 +276,21 @@ vmxnet3_get_strings(struct net_device *netdev,
> u32 stringset, u8 *buf)
> }
>
> static u32
> -vmxnet3_get_flags(struct net_device *netdev) {
> +vmxnet3_get_flags(struct net_device *netdev)
> +{
> return netdev->features;
> }
>
> static int
> -vmxnet3_set_flags(struct net_device *netdev, u32 data) {
> +vmxnet3_set_flags(struct net_device *netdev, u32 data)
> +{
> struct vmxnet3_adapter *adapter = netdev_priv(netdev);
> u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1;
> u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1;
>
> + if (data & ~ETH_FLAG_LRO)
> + return -EOPNOTSUPP;
> +
> if (lro_requested ^ lro_present) {
> /* toggle the LRO feature*/
> netdev->features ^= NETIF_F_LRO;
> --
> 1.5.5.6
Does not make sense to me. Switching LRO on/off is supported from the driver, why should the function return -EOPNOTSUPP ?
->Shreyas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] vmxnet3: fail when try to setup unsupported features
2010-06-28 9:29 [PATCH -next] vmxnet3: fail when try to setup unsupported features Stanislaw Gruszka
2010-06-28 17:45 ` Shreyas Bhatewara
@ 2010-06-29 7:55 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-06-29 7:55 UTC (permalink / raw)
To: sgruszka; +Cc: netdev, amwang, sbhatewara
From: Stanislaw Gruszka <sgruszka@redhat.com>
Date: Mon, 28 Jun 2010 11:29:42 +0200
> Return EOPNOTSUPP in ethtool_ops->set_flags.
>
> Fix coding style while at it.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] vmxnet3: fail when try to setup unsupported features
2010-06-28 17:45 ` Shreyas Bhatewara
@ 2010-06-29 9:15 ` Stanislaw Gruszka
0 siblings, 0 replies; 4+ messages in thread
From: Stanislaw Gruszka @ 2010-06-29 9:15 UTC (permalink / raw)
To: Shreyas Bhatewara; +Cc: netdev, Amerigo Wang
On Mon, Jun 28, 2010 at 10:45:57AM -0700, Shreyas Bhatewara wrote:
> > +vmxnet3_set_flags(struct net_device *netdev, u32 data)
> > +{
> > struct vmxnet3_adapter *adapter = netdev_priv(netdev);
> > u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1;
> > u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1;
> >
> > + if (data & ~ETH_FLAG_LRO)
> > + return -EOPNOTSUPP;
> > +
> > if (lro_requested ^ lro_present) {
> > /* toggle the LRO feature*/
> > netdev->features ^= NETIF_F_LRO;
> > --
> > 1.5.5.6
>
>
> Does not make sense to me. Switching LRO on/off is supported from the driver, why should the function return -EOPNOTSUPP ?
We return EOPNOTSUPP only if someone will try to setup other features
than LRO, if data == ETH_FLAG_LRO we will turn LRO on, and turn it off
when data == 0.
Stanislaw
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-29 9:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-28 9:29 [PATCH -next] vmxnet3: fail when try to setup unsupported features Stanislaw Gruszka
2010-06-28 17:45 ` Shreyas Bhatewara
2010-06-29 9:15 ` Stanislaw Gruszka
2010-06-29 7:55 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.