usbnet: add a callback for set_rx_mode
To delegate promiscuous mode and multicast filtering to the subdriver. Signed-off-by: Olivier Blin <olivier.blin@softathome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
					parent
					
						
							
								9ffa1fcaef
							
						
					
				
			
			
				commit
				
					
						1efed2d06c
					
				
			
		
					 2 changed files with 24 additions and 0 deletions
				
			
		| 
						 | 
					@ -1052,6 +1052,21 @@ static void __handle_link_change(struct usbnet *dev)
 | 
				
			||||||
	clear_bit(EVENT_LINK_CHANGE, &dev->flags);
 | 
						clear_bit(EVENT_LINK_CHANGE, &dev->flags);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void usbnet_set_rx_mode(struct net_device *net)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct usbnet		*dev = netdev_priv(net);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						usbnet_defer_kevent(dev, EVENT_SET_RX_MODE);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void __handle_set_rx_mode(struct usbnet *dev)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (dev->driver_info->set_rx_mode)
 | 
				
			||||||
 | 
							(dev->driver_info->set_rx_mode)(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						clear_bit(EVENT_SET_RX_MODE, &dev->flags);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* work that cannot be done in interrupt context uses keventd.
 | 
					/* work that cannot be done in interrupt context uses keventd.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * NOTE:  with 2.5 we could do more of this using completion callbacks,
 | 
					 * NOTE:  with 2.5 we could do more of this using completion callbacks,
 | 
				
			||||||
| 
						 | 
					@ -1157,6 +1172,10 @@ skip_reset:
 | 
				
			||||||
	if (test_bit (EVENT_LINK_CHANGE, &dev->flags))
 | 
						if (test_bit (EVENT_LINK_CHANGE, &dev->flags))
 | 
				
			||||||
		__handle_link_change(dev);
 | 
							__handle_link_change(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (test_bit (EVENT_SET_RX_MODE, &dev->flags))
 | 
				
			||||||
 | 
							__handle_set_rx_mode(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (dev->flags)
 | 
						if (dev->flags)
 | 
				
			||||||
		netdev_dbg(dev->net, "kevent done, flags = 0x%lx\n", dev->flags);
 | 
							netdev_dbg(dev->net, "kevent done, flags = 0x%lx\n", dev->flags);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1525,6 +1544,7 @@ static const struct net_device_ops usbnet_netdev_ops = {
 | 
				
			||||||
	.ndo_stop		= usbnet_stop,
 | 
						.ndo_stop		= usbnet_stop,
 | 
				
			||||||
	.ndo_start_xmit		= usbnet_start_xmit,
 | 
						.ndo_start_xmit		= usbnet_start_xmit,
 | 
				
			||||||
	.ndo_tx_timeout		= usbnet_tx_timeout,
 | 
						.ndo_tx_timeout		= usbnet_tx_timeout,
 | 
				
			||||||
 | 
						.ndo_set_rx_mode	= usbnet_set_rx_mode,
 | 
				
			||||||
	.ndo_change_mtu		= usbnet_change_mtu,
 | 
						.ndo_change_mtu		= usbnet_change_mtu,
 | 
				
			||||||
	.ndo_set_mac_address 	= eth_mac_addr,
 | 
						.ndo_set_mac_address 	= eth_mac_addr,
 | 
				
			||||||
	.ndo_validate_addr	= eth_validate_addr,
 | 
						.ndo_validate_addr	= eth_validate_addr,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,6 +78,7 @@ struct usbnet {
 | 
				
			||||||
#		define EVENT_NO_RUNTIME_PM	9
 | 
					#		define EVENT_NO_RUNTIME_PM	9
 | 
				
			||||||
#		define EVENT_RX_KILL	10
 | 
					#		define EVENT_RX_KILL	10
 | 
				
			||||||
#		define EVENT_LINK_CHANGE	11
 | 
					#		define EVENT_LINK_CHANGE	11
 | 
				
			||||||
 | 
					#		define EVENT_SET_RX_MODE	12
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline struct usb_driver *driver_of(struct usb_interface *intf)
 | 
					static inline struct usb_driver *driver_of(struct usb_interface *intf)
 | 
				
			||||||
| 
						 | 
					@ -159,6 +160,9 @@ struct driver_info {
 | 
				
			||||||
	/* called by minidriver when receiving indication */
 | 
						/* called by minidriver when receiving indication */
 | 
				
			||||||
	void	(*indication)(struct usbnet *dev, void *ind, int indlen);
 | 
						void	(*indication)(struct usbnet *dev, void *ind, int indlen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* rx mode change (device changes address list filtering) */
 | 
				
			||||||
 | 
						void	(*set_rx_mode)(struct usbnet *dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* for new devices, use the descriptor-reading code instead */
 | 
						/* for new devices, use the descriptor-reading code instead */
 | 
				
			||||||
	int		in;		/* rx endpoint */
 | 
						int		in;		/* rx endpoint */
 | 
				
			||||||
	int		out;		/* tx endpoint */
 | 
						int		out;		/* tx endpoint */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue