netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rndis_wlan netdev ops
@ 2009-03-23 20:43 David Miller
  2009-03-23 21:00 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2009-03-23 20:43 UTC (permalink / raw)
  To: shemminger; +Cc: netdev


This is the only driver that won't build for me with
the netdev ops compat option disabled.

It's trying to override the ->set_mutlicast_list op value
of it's parent device.

Did you hit this one and I just missed it or is it not handled
yet?

Probably what we'll have to do for this case is allocate a
netdev_ops copy so that the ->set_multicast_list can be set
to a new value.  But that defeats the whole purpose of netdev
ops so I assume you have other plans :-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rndis_wlan netdev ops
  2009-03-23 20:43 rndis_wlan netdev ops David Miller
@ 2009-03-23 21:00 ` Stephen Hemminger
  2009-03-23 21:31   ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2009-03-23 21:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Mon, 23 Mar 2009 13:43:18 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> 
> This is the only driver that won't build for me with
> the netdev ops compat option disabled.
> 
> It's trying to override the ->set_mutlicast_list op value
> of it's parent device.
> 
> Did you hit this one and I just missed it or is it not handled
> yet?

yes, that is when I stopped. Mainly because it was a non-trivial
fix.

> Probably what we'll have to do for this case is allocate a
> netdev_ops copy so that the ->set_multicast_list can be set
> to a new value.  But that defeats the whole purpose of netdev
> ops so I assume you have other plans :-)

Why not just turn off the multicast bit in the device, or maybe
the hardware developer can implement set_multicast_list

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rndis_wlan netdev ops
  2009-03-23 21:00 ` Stephen Hemminger
@ 2009-03-23 21:31   ` David Miller
  2009-03-25  7:04     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2009-03-23 21:31 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Mon, 23 Mar 2009 14:00:57 -0700

> On Mon, 23 Mar 2009 13:43:18 -0700 (PDT)
> David Miller <davem@davemloft.net> wrote:
> 
> > Probably what we'll have to do for this case is allocate a
> > netdev_ops copy so that the ->set_multicast_list can be set
> > to a new value.  But that defeats the whole purpose of netdev
> > ops so I assume you have other plans :-)
> 
> Why not just turn off the multicast bit in the device, or maybe
> the hardware developer can implement set_multicast_list

We could just import the parent OPS into a local const netdevice_ops
instance, that's how we handle this everywhere else.

To prevent changes in the parent being lost in the rndis driver we can
encapsulate the ops assignments into a macro used by both.  Taking the
set_multicast_list as an arg.

Alternatively the parent can provide a hook function pointer for this
multicast operation, which the parent runs when non-NULL.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rndis_wlan netdev ops
  2009-03-23 21:31   ` David Miller
@ 2009-03-25  7:04     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2009-03-25  7:04 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: David Miller <davem@davemloft.net>
Date: Mon, 23 Mar 2009 14:31:19 -0700 (PDT)

> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Mon, 23 Mar 2009 14:00:57 -0700
> 
> > On Mon, 23 Mar 2009 13:43:18 -0700 (PDT)
> > David Miller <davem@davemloft.net> wrote:
> > 
> > > Probably what we'll have to do for this case is allocate a
> > > netdev_ops copy so that the ->set_multicast_list can be set
> > > to a new value.  But that defeats the whole purpose of netdev
> > > ops so I assume you have other plans :-)
> > 
> > Why not just turn off the multicast bit in the device, or maybe
> > the hardware developer can implement set_multicast_list
> 
> We could just import the parent OPS into a local const netdevice_ops
> instance, that's how we handle this everywhere else.
> 
> To prevent changes in the parent being lost in the rndis driver we can
> encapsulate the ops assignments into a macro used by both.  Taking the
> set_multicast_list as an arg.
> 
> Alternatively the parent can provide a hook function pointer for this
> multicast operation, which the parent runs when non-NULL.

Here is how I ended up fixing this:

rndis_wlan: Fix build with netdev_ops compat disabled.

Instead of storing a private ->set_multicast_list, just
have a private netdev ops.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/wireless/rndis_wlan.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 82af21e..db91db7 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2524,6 +2524,17 @@ static int bcm4320_early_init(struct usbnet *usbdev)
 	return 0;
 }
 
+/* same as rndis_netdev_ops but with local multicast handler */
+static const struct net_device_ops rndis_wext_netdev_ops = {
+	.ndo_open		= usbnet_open,
+	.ndo_stop		= usbnet_stop,
+	.ndo_start_xmit		= usbnet_start_xmit,
+	.ndo_tx_timeout		= usbnet_tx_timeout,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+	.ndo_set_multicast_list	= rndis_wext_set_multicast_list,
+};
+
 
 static int rndis_wext_bind(struct usbnet *usbdev, struct usb_interface *intf)
 {
@@ -2559,7 +2570,8 @@ static int rndis_wext_bind(struct usbnet *usbdev, struct usb_interface *intf)
 	 * rndis_host wants to avoid all OID as much as possible
 	 * so do promisc/multicast handling in rndis_wext.
 	 */
-	usbdev->net->set_multicast_list = rndis_wext_set_multicast_list;
+	usbdev->net->netdev_ops = &rndis_wext_netdev_ops;
+
 	tmp = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST;
 	retval = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &tmp,
 								sizeof(tmp));
-- 
1.6.2.1.222.g570cc


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-25  7:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-23 20:43 rndis_wlan netdev ops David Miller
2009-03-23 21:00 ` Stephen Hemminger
2009-03-23 21:31   ` David Miller
2009-03-25  7:04     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).