diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-09-04 01:33:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-07 04:56:33 -0400 |
commit | 384824281caa9ac4b76664033416f1eac4a652fe (patch) | |
tree | 335ce38565014ba7cea4a7f096794a2d23e26c1f | |
parent | 5877e55f32bb50956c9a1df8e7db3fbc67dc47b6 (diff) |
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: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/wan/dlci.c | 43 | ||||
-rw-r--r-- | drivers/net/wan/sdla.c | 8 | ||||
-rw-r--r-- | include/linux/if_frad.h | 5 |
3 files changed, 9 insertions, 47 deletions
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c index 69d269d32b5b..15d353f268b5 100644 --- a/drivers/net/wan/dlci.c +++ b/drivers/net/wan/dlci.c | |||
@@ -186,46 +186,13 @@ static void dlci_receive(struct sk_buff *skb, struct net_device *dev) | |||
186 | dev_kfree_skb(skb); | 186 | dev_kfree_skb(skb); |
187 | } | 187 | } |
188 | 188 | ||
189 | static netdev_tx_t dlci_transmit(struct sk_buff *skb, | 189 | static netdev_tx_t dlci_transmit(struct sk_buff *skb, struct net_device *dev) |
190 | struct net_device *dev) | ||
191 | { | 190 | { |
192 | struct dlci_local *dlp; | 191 | struct dlci_local *dlp = netdev_priv(dev); |
193 | netdev_tx_t ret; | ||
194 | |||
195 | if (!skb || !dev) | ||
196 | return NETDEV_TX_OK; | ||
197 | |||
198 | dlp = netdev_priv(dev); | ||
199 | |||
200 | netif_stop_queue(dev); | ||
201 | |||
202 | /* This is hackish, overloads driver specific return values | ||
203 | on top of normal transmit return! */ | ||
204 | ret = dlp->slave->netdev_ops->ndo_start_xmit(skb, dlp->slave); | ||
205 | switch (ret) | ||
206 | { | ||
207 | case DLCI_RET_OK: | ||
208 | dev->stats.tx_packets++; | ||
209 | ret = NETDEV_TX_OK; | ||
210 | break; | ||
211 | case DLCI_RET_ERR: | ||
212 | dev->stats.tx_errors++; | ||
213 | ret = NETDEV_TX_OK; | ||
214 | break; | ||
215 | case DLCI_RET_DROP: | ||
216 | dev->stats.tx_dropped++; | ||
217 | ret = NETDEV_TX_BUSY; | ||
218 | break; | ||
219 | } | ||
220 | /* Alan Cox recommends always returning 0, and always freeing the packet */ | ||
221 | /* experience suggest a slightly more conservative approach */ | ||
222 | 192 | ||
223 | if (ret == NETDEV_TX_OK) | 193 | if (skb) |
224 | { | 194 | dlp->slave->netdev_ops->ndo_start_xmit(skb, dlp->slave); |
225 | dev_kfree_skb(skb); | 195 | return NETDEV_TX_OK; |
226 | netif_wake_queue(dev); | ||
227 | } | ||
228 | return(ret); | ||
229 | } | 196 | } |
230 | 197 | ||
231 | static int dlci_config(struct net_device *dev, struct dlci_conf __user *conf, int get) | 198 | static int dlci_config(struct net_device *dev, struct dlci_conf __user *conf, int get) |
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 63c76458431c..2b15a7e40d5b 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c | |||
@@ -652,7 +652,7 @@ static int sdla_dlci_conf(struct net_device *slave, struct net_device *master, i | |||
652 | 652 | ||
653 | /* NOTE: the DLCI driver deals with freeing the SKB!! */ | 653 | /* NOTE: the DLCI driver deals with freeing the SKB!! */ |
654 | static netdev_tx_t sdla_transmit(struct sk_buff *skb, | 654 | static netdev_tx_t sdla_transmit(struct sk_buff *skb, |
655 | struct net_device *dev) | 655 | struct net_device *dev) |
656 | { | 656 | { |
657 | struct frad_local *flp; | 657 | struct frad_local *flp; |
658 | int ret, addr, accept, i; | 658 | int ret, addr, accept, i; |
@@ -712,23 +712,21 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb, | |||
712 | } | 712 | } |
713 | break; | 713 | break; |
714 | } | 714 | } |
715 | |||
715 | switch (ret) | 716 | switch (ret) |
716 | { | 717 | { |
717 | case SDLA_RET_OK: | 718 | case SDLA_RET_OK: |
718 | dev->stats.tx_packets++; | 719 | dev->stats.tx_packets++; |
719 | ret = DLCI_RET_OK; | ||
720 | break; | 720 | break; |
721 | 721 | ||
722 | case SDLA_RET_CIR_OVERFLOW: | 722 | case SDLA_RET_CIR_OVERFLOW: |
723 | case SDLA_RET_BUF_OVERSIZE: | 723 | case SDLA_RET_BUF_OVERSIZE: |
724 | case SDLA_RET_NO_BUFS: | 724 | case SDLA_RET_NO_BUFS: |
725 | dev->stats.tx_dropped++; | 725 | dev->stats.tx_dropped++; |
726 | ret = DLCI_RET_DROP; | ||
727 | break; | 726 | break; |
728 | 727 | ||
729 | default: | 728 | default: |
730 | dev->stats.tx_errors++; | 729 | dev->stats.tx_errors++; |
731 | ret = DLCI_RET_ERR; | ||
732 | break; | 730 | break; |
733 | } | 731 | } |
734 | } | 732 | } |
@@ -738,6 +736,8 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb, | |||
738 | if(flp->master[i]!=NULL) | 736 | if(flp->master[i]!=NULL) |
739 | netif_wake_queue(flp->master[i]); | 737 | netif_wake_queue(flp->master[i]); |
740 | } | 738 | } |
739 | |||
740 | dev_kfree_skb(skb); | ||
741 | return NETDEV_TX_OK; | 741 | return NETDEV_TX_OK; |
742 | } | 742 | } |
743 | 743 | ||
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h index 673f2209453d..80b3a1056a5f 100644 --- a/include/linux/if_frad.h +++ b/include/linux/if_frad.h | |||
@@ -69,11 +69,6 @@ struct dlci_conf { | |||
69 | 69 | ||
70 | #define DLCI_VALID_FLAGS 0x000B | 70 | #define DLCI_VALID_FLAGS 0x000B |
71 | 71 | ||
72 | /* FRAD driver uses these to indicate what it did with packet */ | ||
73 | #define DLCI_RET_OK 0x00 | ||
74 | #define DLCI_RET_ERR 0x01 | ||
75 | #define DLCI_RET_DROP 0x02 | ||
76 | |||
77 | /* defines for the actual Frame Relay hardware */ | 72 | /* defines for the actual Frame Relay hardware */ |
78 | #define FRAD_GET_CONF (SIOCDEVPRIVATE) | 73 | #define FRAD_GET_CONF (SIOCDEVPRIVATE) |
79 | #define FRAD_SET_CONF (SIOCDEVPRIVATE + 1) | 74 | #define FRAD_SET_CONF (SIOCDEVPRIVATE + 1) |