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

wan: dlci/sdla transmit return dehacking

This is a brute force removal of the wierd slave interface done for
DLCI -> SDLA transmit. Before it was using non-standard return values
and freeing skb in caller.  This changes it to using normal return
values, and freeing in the callee.  Luckly only one driver pair was
doing this. Not tested on real hardware, in fact I wonder if this
driver pair is even being used by any users.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5877e55f
...@@ -186,46 +186,13 @@ static void dlci_receive(struct sk_buff *skb, struct net_device *dev) ...@@ -186,46 +186,13 @@ static void dlci_receive(struct sk_buff *skb, struct net_device *dev)
dev_kfree_skb(skb); dev_kfree_skb(skb);
} }
static netdev_tx_t dlci_transmit(struct sk_buff *skb, static netdev_tx_t dlci_transmit(struct sk_buff *skb, struct net_device *dev)
struct net_device *dev)
{ {
struct dlci_local *dlp; struct dlci_local *dlp = netdev_priv(dev);
netdev_tx_t ret;
if (!skb || !dev)
return NETDEV_TX_OK;
dlp = netdev_priv(dev);
netif_stop_queue(dev);
/* This is hackish, overloads driver specific return values
on top of normal transmit return! */
ret = dlp->slave->netdev_ops->ndo_start_xmit(skb, dlp->slave);
switch (ret)
{
case DLCI_RET_OK:
dev->stats.tx_packets++;
ret = NETDEV_TX_OK;
break;
case DLCI_RET_ERR:
dev->stats.tx_errors++;
ret = NETDEV_TX_OK;
break;
case DLCI_RET_DROP:
dev->stats.tx_dropped++;
ret = NETDEV_TX_BUSY;
break;
}
/* Alan Cox recommends always returning 0, and always freeing the packet */
/* experience suggest a slightly more conservative approach */
if (ret == NETDEV_TX_OK) if (skb)
{ dlp->slave->netdev_ops->ndo_start_xmit(skb, dlp->slave);
dev_kfree_skb(skb); return NETDEV_TX_OK;
netif_wake_queue(dev);
}
return(ret);
} }
static int dlci_config(struct net_device *dev, struct dlci_conf __user *conf, int get) static int dlci_config(struct net_device *dev, struct dlci_conf __user *conf, int get)
......
...@@ -652,7 +652,7 @@ static int sdla_dlci_conf(struct net_device *slave, struct net_device *master, i ...@@ -652,7 +652,7 @@ static int sdla_dlci_conf(struct net_device *slave, struct net_device *master, i
/* NOTE: the DLCI driver deals with freeing the SKB!! */ /* NOTE: the DLCI driver deals with freeing the SKB!! */
static netdev_tx_t sdla_transmit(struct sk_buff *skb, static netdev_tx_t sdla_transmit(struct sk_buff *skb,
struct net_device *dev) struct net_device *dev)
{ {
struct frad_local *flp; struct frad_local *flp;
int ret, addr, accept, i; int ret, addr, accept, i;
...@@ -712,23 +712,21 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb, ...@@ -712,23 +712,21 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb,
} }
break; break;
} }
switch (ret) switch (ret)
{ {
case SDLA_RET_OK: case SDLA_RET_OK:
dev->stats.tx_packets++; dev->stats.tx_packets++;
ret = DLCI_RET_OK;
break; break;
case SDLA_RET_CIR_OVERFLOW: case SDLA_RET_CIR_OVERFLOW:
case SDLA_RET_BUF_OVERSIZE: case SDLA_RET_BUF_OVERSIZE:
case SDLA_RET_NO_BUFS: case SDLA_RET_NO_BUFS:
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
ret = DLCI_RET_DROP;
break; break;
default: default:
dev->stats.tx_errors++; dev->stats.tx_errors++;
ret = DLCI_RET_ERR;
break; break;
} }
} }
...@@ -738,6 +736,8 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb, ...@@ -738,6 +736,8 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb,
if(flp->master[i]!=NULL) if(flp->master[i]!=NULL)
netif_wake_queue(flp->master[i]); netif_wake_queue(flp->master[i]);
} }
dev_kfree_skb(skb);
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
......
...@@ -69,11 +69,6 @@ struct dlci_conf { ...@@ -69,11 +69,6 @@ struct dlci_conf {
#define DLCI_VALID_FLAGS 0x000B #define DLCI_VALID_FLAGS 0x000B
/* FRAD driver uses these to indicate what it did with packet */
#define DLCI_RET_OK 0x00
#define DLCI_RET_ERR 0x01
#define DLCI_RET_DROP 0x02
/* defines for the actual Frame Relay hardware */ /* defines for the actual Frame Relay hardware */
#define FRAD_GET_CONF (SIOCDEVPRIVATE) #define FRAD_GET_CONF (SIOCDEVPRIVATE)
#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1) #define FRAD_SET_CONF (SIOCDEVPRIVATE + 1)
......
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