From 424efe9caf6047ffbcd6b383ff4d2347254aabf1 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 31 Aug 2009 19:50:51 +0000 Subject: netdev: convert pseudo drivers to netdev_tx_t These are all drivers that don't touch real hardware. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- drivers/net/bonding/bond_main.c | 2 +- drivers/net/can/vcan.c | 2 +- drivers/net/dummy.c | 22 ++++++++++------------ drivers/net/eql.c | 4 ++-- drivers/net/ifb.c | 9 ++++----- drivers/net/macvlan.c | 3 ++- drivers/net/ppp_generic.c | 2 +- drivers/net/slip.c | 2 +- drivers/net/tun.c | 2 +- drivers/net/veth.c | 2 +- drivers/net/virtio_net.c | 2 +- 11 files changed, 25 insertions(+), 27 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 7c0e0bded15..a7e731f8a0d 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -4450,7 +4450,7 @@ static void bond_set_xmit_hash_policy(struct bonding *bond) } } -static int bond_start_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev) { const struct bonding *bond = netdev_priv(dev); diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c index a10c1d7b3b0..6971f6cd37f 100644 --- a/drivers/net/can/vcan.c +++ b/drivers/net/can/vcan.c @@ -83,7 +83,7 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev) netif_rx(skb); } -static int vcan_tx(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev) { struct net_device_stats *stats = &dev->stats; int loop; diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index 713ce6c532c..37dcfdc6345 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -39,8 +39,6 @@ static int numdummies = 1; -static int dummy_xmit(struct sk_buff *skb, struct net_device *dev); - static int dummy_set_address(struct net_device *dev, void *p) { struct sockaddr *sa = p; @@ -57,6 +55,16 @@ static void set_multicast_list(struct net_device *dev) { } + +static netdev_tx_t dummy_xmit(struct sk_buff *skb, struct net_device *dev) +{ + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; + + dev_kfree_skb(skb); + return NETDEV_TX_OK; +} + static const struct net_device_ops dummy_netdev_ops = { .ndo_start_xmit = dummy_xmit, .ndo_validate_addr = eth_validate_addr, @@ -78,16 +86,6 @@ static void dummy_setup(struct net_device *dev) dev->flags &= ~IFF_MULTICAST; random_ether_addr(dev->dev_addr); } - -static int dummy_xmit(struct sk_buff *skb, struct net_device *dev) -{ - dev->stats.tx_packets++; - dev->stats.tx_bytes += skb->len; - - dev_kfree_skb(skb); - return NETDEV_TX_OK; -} - static int dummy_validate(struct nlattr *tb[], struct nlattr *data[]) { if (tb[IFLA_ADDRESS]) { diff --git a/drivers/net/eql.c b/drivers/net/eql.c index c0e69c5cae8..d4d9a3eda69 100644 --- a/drivers/net/eql.c +++ b/drivers/net/eql.c @@ -127,7 +127,7 @@ static int eql_open(struct net_device *dev); static int eql_close(struct net_device *dev); static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); -static int eql_slave_xmit(struct sk_buff *skb, struct net_device *dev); +static netdev_tx_t eql_slave_xmit(struct sk_buff *skb, struct net_device *dev); #define eql_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE) #define eql_is_master(dev) ((dev->flags & IFF_MASTER) == IFF_MASTER) @@ -325,7 +325,7 @@ static slave_t *__eql_schedule_slaves(slave_queue_t *queue) return best_slave; } -static int eql_slave_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t eql_slave_xmit(struct sk_buff *skb, struct net_device *dev) { equalizer_t *eql = netdev_priv(dev); slave_t *slave; diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 0a79b451780..801f088c134 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -59,7 +59,7 @@ struct ifb_private { static int numifbs = 2; static void ri_tasklet(unsigned long dev); -static int ifb_xmit(struct sk_buff *skb, struct net_device *dev); +static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev); static int ifb_open(struct net_device *dev); static int ifb_close(struct net_device *dev); @@ -160,11 +160,10 @@ static void ifb_setup(struct net_device *dev) random_ether_addr(dev->dev_addr); } -static int ifb_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev) { struct ifb_private *dp = netdev_priv(dev); struct net_device_stats *stats = &dev->stats; - int ret = NETDEV_TX_OK; u32 from = G_TC_FROM(skb->tc_verd); stats->rx_packets++; @@ -173,7 +172,7 @@ static int ifb_xmit(struct sk_buff *skb, struct net_device *dev) if (!(from & (AT_INGRESS|AT_EGRESS)) || !skb->iif) { dev_kfree_skb(skb); stats->rx_dropped++; - return ret; + return NETDEV_TX_OK; } if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) { @@ -187,7 +186,7 @@ static int ifb_xmit(struct sk_buff *skb, struct net_device *dev) tasklet_schedule(&dp->ifb_tasklet); } - return ret; + return NETDEV_TX_OK; } static int ifb_close(struct net_device *dev) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 99eed9f37c8..f893cd41580 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -184,7 +184,8 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb) return NULL; } -static int macvlan_start_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, + struct net_device *dev) { const struct macvlan_dev *vlan = netdev_priv(dev); unsigned int len = skb->len; diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 35be2e8f0c9..9bf2a6be903 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c @@ -951,7 +951,7 @@ out: /* * Network interface unit routines. */ -static int +static netdev_tx_t ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct ppp *ppp = netdev_priv(dev); diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 899c4a2112c..26f6ee93a06 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -474,7 +474,7 @@ out: /* Encapsulate an IP datagram and kick it into a TTY queue. */ -static int +static netdev_tx_t sl_xmit(struct sk_buff *skb, struct net_device *dev) { struct slip *sl = netdev_priv(dev); diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 2533f5cf2e4..5f7842e4d4a 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -358,7 +358,7 @@ static int tun_net_close(struct net_device *dev) } /* Net device start xmit */ -static int tun_net_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) { struct tun_struct *tun = netdev_priv(dev); diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 190f784c9cf..d1941cdff62 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -148,7 +148,7 @@ static struct ethtool_ops veth_ethtool_ops = { * xmit */ -static int veth_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) { struct net_device *rcv = NULL; struct veth_priv *priv, *rcv_priv; diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a6f903f0092..31279c4c02c 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -519,7 +519,7 @@ static void xmit_tasklet(unsigned long data) netif_tx_unlock_bh(vi->dev); } -static int start_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) { struct virtnet_info *vi = netdev_priv(dev); -- cgit v1.2.3-70-g09d2