Commit 777baa47 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

usbnet: support net_device_ops

Use net_device_ops for usbnet device, and export for use
by other derived drivers.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Acked-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 805aaa29
...@@ -223,7 +223,7 @@ EXPORT_SYMBOL_GPL(usbnet_skb_return); ...@@ -223,7 +223,7 @@ EXPORT_SYMBOL_GPL(usbnet_skb_return);
* *
*-------------------------------------------------------------------------*/ *-------------------------------------------------------------------------*/
static int usbnet_change_mtu (struct net_device *net, int new_mtu) int usbnet_change_mtu (struct net_device *net, int new_mtu)
{ {
struct usbnet *dev = netdev_priv(net); struct usbnet *dev = netdev_priv(net);
int ll_mtu = new_mtu + net->hard_header_len; int ll_mtu = new_mtu + net->hard_header_len;
...@@ -246,6 +246,7 @@ static int usbnet_change_mtu (struct net_device *net, int new_mtu) ...@@ -246,6 +246,7 @@ static int usbnet_change_mtu (struct net_device *net, int new_mtu)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(usbnet_change_mtu);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -540,7 +541,7 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs); ...@@ -540,7 +541,7 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
// precondition: never called in_interrupt // precondition: never called in_interrupt
static int usbnet_stop (struct net_device *net) int usbnet_stop (struct net_device *net)
{ {
struct usbnet *dev = netdev_priv(net); struct usbnet *dev = netdev_priv(net);
int temp; int temp;
...@@ -584,6 +585,7 @@ static int usbnet_stop (struct net_device *net) ...@@ -584,6 +585,7 @@ static int usbnet_stop (struct net_device *net)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(usbnet_stop);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -591,7 +593,7 @@ static int usbnet_stop (struct net_device *net) ...@@ -591,7 +593,7 @@ static int usbnet_stop (struct net_device *net)
// precondition: never called in_interrupt // precondition: never called in_interrupt
static int usbnet_open (struct net_device *net) int usbnet_open (struct net_device *net)
{ {
struct usbnet *dev = netdev_priv(net); struct usbnet *dev = netdev_priv(net);
int retval; int retval;
...@@ -666,6 +668,7 @@ done: ...@@ -666,6 +668,7 @@ done:
done_nopm: done_nopm:
return retval; return retval;
} }
EXPORT_SYMBOL_GPL(usbnet_open);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -900,7 +903,7 @@ static void tx_complete (struct urb *urb) ...@@ -900,7 +903,7 @@ static void tx_complete (struct urb *urb)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static void usbnet_tx_timeout (struct net_device *net) void usbnet_tx_timeout (struct net_device *net)
{ {
struct usbnet *dev = netdev_priv(net); struct usbnet *dev = netdev_priv(net);
...@@ -909,10 +912,11 @@ static void usbnet_tx_timeout (struct net_device *net) ...@@ -909,10 +912,11 @@ static void usbnet_tx_timeout (struct net_device *net)
// FIXME: device recovery -- reset? // FIXME: device recovery -- reset?
} }
EXPORT_SYMBOL_GPL(usbnet_tx_timeout);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net) int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
{ {
struct usbnet *dev = netdev_priv(net); struct usbnet *dev = netdev_priv(net);
int length; int length;
...@@ -995,7 +999,7 @@ drop: ...@@ -995,7 +999,7 @@ drop:
} }
return retval; return retval;
} }
EXPORT_SYMBOL_GPL(usbnet_start_xmit);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -1102,6 +1106,15 @@ void usbnet_disconnect (struct usb_interface *intf) ...@@ -1102,6 +1106,15 @@ void usbnet_disconnect (struct usb_interface *intf)
} }
EXPORT_SYMBOL_GPL(usbnet_disconnect); EXPORT_SYMBOL_GPL(usbnet_disconnect);
static const struct net_device_ops usbnet_netdev_ops = {
.ndo_open = usbnet_open,
.ndo_stop = usbnet_stop,
.ndo_start_xmit = usbnet_start_xmit,
.ndo_tx_timeout = usbnet_tx_timeout,
.ndo_change_mtu = usbnet_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -1171,12 +1184,14 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) ...@@ -1171,12 +1184,14 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
net->features |= NETIF_F_HIGHDMA; net->features |= NETIF_F_HIGHDMA;
#endif #endif
net->change_mtu = usbnet_change_mtu; net->netdev_ops = &usbnet_netdev_ops;
#ifdef CONFIG_COMPAT_NET_DEV_OPS
net->hard_start_xmit = usbnet_start_xmit; net->hard_start_xmit = usbnet_start_xmit;
net->open = usbnet_open; net->open = usbnet_open;
net->stop = usbnet_stop; net->stop = usbnet_stop;
net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
net->tx_timeout = usbnet_tx_timeout; net->tx_timeout = usbnet_tx_timeout;
#endif
net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
net->ethtool_ops = &usbnet_ethtool_ops; net->ethtool_ops = &usbnet_ethtool_ops;
// allow device-specific bind/init procedures // allow device-specific bind/init procedures
......
...@@ -176,6 +176,11 @@ struct skb_data { /* skb->cb is one of these */ ...@@ -176,6 +176,11 @@ struct skb_data { /* skb->cb is one of these */
size_t length; size_t length;
}; };
extern int usbnet_open (struct net_device *net);
extern int usbnet_stop (struct net_device *net);
extern int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net);
extern void usbnet_tx_timeout (struct net_device *net);
extern int usbnet_change_mtu (struct net_device *net, int new_mtu);
extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
extern void usbnet_defer_kevent (struct usbnet *, int); extern void usbnet_defer_kevent (struct usbnet *, int);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment