[SKBUFF] move common code to hdlc_type_trans

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@conectiva.com.br>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent eed14b47
...@@ -4570,9 +4570,7 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size) ...@@ -4570,9 +4570,7 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size)
memcpy(skb_put(skb, size),buf,size); memcpy(skb_put(skb, size),buf,size);
skb->dev = info->netdev; skb->protocol = hdlc_type_trans(skb, info->netdev);
skb->mac.raw = skb->data;
skb->protocol = hdlc_type_trans(skb, skb->dev);
stats->rx_packets++; stats->rx_packets++;
stats->rx_bytes += size; stats->rx_bytes += size;
......
...@@ -8150,9 +8150,7 @@ static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size) ...@@ -8150,9 +8150,7 @@ static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size)
memcpy(skb_put(skb, size),buf,size); memcpy(skb_put(skb, size),buf,size);
skb->dev = info->netdev; skb->protocol = hdlc_type_trans(skb, info->netdev);
skb->mac.raw = skb->data;
skb->protocol = hdlc_type_trans(skb, skb->dev);
stats->rx_packets++; stats->rx_packets++;
stats->rx_bytes += size; stats->rx_bytes += size;
......
...@@ -1968,9 +1968,7 @@ static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size) ...@@ -1968,9 +1968,7 @@ static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size)
memcpy(skb_put(skb, size),buf,size); memcpy(skb_put(skb, size),buf,size);
skb->dev = info->netdev; skb->protocol = hdlc_type_trans(skb, info->netdev);
skb->mac.raw = skb->data;
skb->protocol = hdlc_type_trans(skb, skb->dev);
stats->rx_packets++; stats->rx_packets++;
stats->rx_bytes += size; stats->rx_bytes += size;
......
...@@ -517,7 +517,6 @@ inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv, struct net_device *dev) ...@@ -517,7 +517,6 @@ inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv, struct net_device *dev)
skb = dev_alloc_skb(len); skb = dev_alloc_skb(len);
dpriv->rx_skbuff[dirty] = skb; dpriv->rx_skbuff[dirty] = skb;
if (skb) { if (skb) {
skb->dev = dev;
skb->protocol = hdlc_type_trans(skb, dev); skb->protocol = hdlc_type_trans(skb, dev);
skb->mac.raw = skb->data; skb->mac.raw = skb->data;
rx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, rx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data,
......
...@@ -857,6 +857,18 @@ fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, ...@@ -857,6 +857,18 @@ fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
dev->trans_start = jiffies; dev->trans_start = jiffies;
} }
/*
* Mark it for our own raw sockets interface
*/
static unsigned short farsync_type_trans(struct sk_buff *skb,
struct net_device *dev)
{
skb->dev = dev;
skb->mac.raw = skb->data;
skb->pkt_type = PACKET_HOST;
return htons(ETH_P_CUST);
}
/* Rx dma complete interrupt /* Rx dma complete interrupt
*/ */
static void static void
...@@ -881,17 +893,10 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, ...@@ -881,17 +893,10 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
/* Push upstream */ /* Push upstream */
dbg(DBG_RX, "Pushing the frame up the stack\n"); dbg(DBG_RX, "Pushing the frame up the stack\n");
skb->mac.raw = skb->data; if (port->mode == FST_RAW)
skb->dev = dev; skb->protocol = farsync_type_trans(skb, dev);
if (port->mode == FST_RAW) { else
/* skb->protocol = hdlc_type_trans(skb, dev);
* Mark it for our own raw sockets interface
*/
skb->protocol = htons(ETH_P_CUST);
skb->pkt_type = PACKET_HOST;
} else {
skb->protocol = hdlc_type_trans(skb, skb->dev);
}
rx_status = netif_rx(skb); rx_status = netif_rx(skb);
fst_process_rx_status(rx_status, port_to_dev(port)->name); fst_process_rx_status(rx_status, port_to_dev(port)->name);
if (rx_status == NET_RX_DROP) if (rx_status == NET_RX_DROP)
...@@ -1316,17 +1321,10 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port) ...@@ -1316,17 +1321,10 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port)
/* Push upstream */ /* Push upstream */
dbg(DBG_RX, "Pushing frame up the stack\n"); dbg(DBG_RX, "Pushing frame up the stack\n");
skb->mac.raw = skb->data; if (port->mode == FST_RAW)
skb->dev = dev; skb->protocol = farsync_type_trans(skb, dev);
if (port->mode == FST_RAW) { else
/* skb->protocol = hdlc_type_trans(skb, dev);
* Mark it for our own raw sockets interface
*/
skb->protocol = htons(ETH_P_CUST);
skb->pkt_type = PACKET_HOST;
} else {
skb->protocol = hdlc_type_trans(skb, skb->dev);
}
rx_status = netif_rx(skb); rx_status = netif_rx(skb);
fst_process_rx_status(rx_status, port_to_dev(port)->name); fst_process_rx_status(rx_status, port_to_dev(port)->name);
if (rx_status == NET_RX_DROP) { if (rx_status == NET_RX_DROP) {
......
...@@ -315,8 +315,6 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc *desc, u16 rxin) ...@@ -315,8 +315,6 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc *desc, u16 rxin)
#endif #endif
stats->rx_packets++; stats->rx_packets++;
stats->rx_bytes += skb->len; stats->rx_bytes += skb->len;
skb->mac.raw = skb->data;
skb->dev = dev;
skb->dev->last_rx = jiffies; skb->dev->last_rx = jiffies;
skb->protocol = hdlc_type_trans(skb, dev); skb->protocol = hdlc_type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
......
...@@ -1959,7 +1959,6 @@ void cpc_net_rx(struct net_device *dev) ...@@ -1959,7 +1959,6 @@ void cpc_net_rx(struct net_device *dev)
cpc_trace(dev, skb, 'R'); cpc_trace(dev, skb, 'R');
} }
stats->rx_packets++; stats->rx_packets++;
skb->mac.raw = skb->data;
skb->protocol = hdlc_type_trans(skb, dev); skb->protocol = hdlc_type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
} }
......
...@@ -224,8 +224,6 @@ static inline void wanxl_rx_intr(card_t *card) ...@@ -224,8 +224,6 @@ static inline void wanxl_rx_intr(card_t *card)
#endif #endif
stats->rx_packets++; stats->rx_packets++;
stats->rx_bytes += skb->len; stats->rx_bytes += skb->len;
skb->mac.raw = skb->data;
skb->dev = dev;
dev->last_rx = jiffies; dev->last_rx = jiffies;
skb->protocol = hdlc_type_trans(skb, dev); skb->protocol = hdlc_type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
......
...@@ -243,11 +243,15 @@ static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) ...@@ -243,11 +243,15 @@ static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev)
static __inline__ unsigned short hdlc_type_trans(struct sk_buff *skb, static __inline__ unsigned short hdlc_type_trans(struct sk_buff *skb,
struct net_device *dev) struct net_device *dev)
{ {
hdlc_device *hdlc = dev_to_hdlc(skb->dev); hdlc_device *hdlc = dev_to_hdlc(dev);
skb->mac.raw = skb->data;
skb->dev = dev;
if (hdlc->proto.type_trans) if (hdlc->proto.type_trans)
return hdlc->proto.type_trans(skb, dev); return hdlc->proto.type_trans(skb, dev);
else else
return __constant_htons(ETH_P_HDLC); return htons(ETH_P_HDLC);
} }
#endif /* __KERNEL */ #endif /* __KERNEL */
......
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