* PATCH 1/1: [SKBUFF] move common code to hdlc_type_trans
@ 2004-10-08 2:04 Arnaldo Carvalho de Melo
2004-10-08 22:36 ` Francois Romieu
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2004-10-08 2:04 UTC (permalink / raw)
To: David S. Miller; +Cc: Francois Romieu, netdev
[-- Attachment #1: Type: text/plain, Size: 569 bytes --]
Hi David,
Please consider pulling from:
bk://kernel.bkbits.net/acme/sk_buff-2.6
It should be equivalent to the code it was before, the only
thing that seems fishy is the drivers/net/wan/dssc4.c, where
the skb->mac.raw is being set after the call to hdlc_type_trans,
where, in some codepaths there are calls to skb_pull and all the
other hdlc layer drivers set the mac.raw _before_ the skb_pull,
like eth_type_trans (that may well be called thru the hdlc layer
type_trans pointer).
Francois, is this really what is intended? I left it as
is for now...
- Arnaldo
[-- Attachment #2: hdlc_type_trans.patch --]
[-- Type: text/plain, Size: 6279 bytes --]
===================================================================
ChangeSet@1.2058, 2004-10-07 22:35:15-03:00, acme@conectiva.com.br
[SKBUFF] move common code to hdlc_type_trans
Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
Signed-off-by: David S. Miller <davem@redhat.com>
drivers/char/pcmcia/synclink_cs.c | 4 ---
drivers/char/synclink.c | 4 ---
drivers/char/synclinkmp.c | 4 ---
drivers/net/wan/dscc4.c | 1
drivers/net/wan/farsync.c | 42 ++++++++++++++++++--------------------
drivers/net/wan/hd6457x.c | 2 -
drivers/net/wan/pc300_drv.c | 1
drivers/net/wan/wanxl.c | 2 -
include/linux/hdlc.h | 8 +++++--
9 files changed, 29 insertions(+), 39 deletions(-)
diff -Nru a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
--- a/drivers/char/pcmcia/synclink_cs.c 2004-10-07 23:02:25 -03:00
+++ b/drivers/char/pcmcia/synclink_cs.c 2004-10-07 23:02:25 -03:00
@@ -4570,9 +4570,7 @@
memcpy(skb_put(skb, size),buf,size);
- skb->dev = info->netdev;
- skb->mac.raw = skb->data;
- skb->protocol = hdlc_type_trans(skb, skb->dev);
+ skb->protocol = hdlc_type_trans(skb, info->netdev);
stats->rx_packets++;
stats->rx_bytes += size;
diff -Nru a/drivers/char/synclink.c b/drivers/char/synclink.c
--- a/drivers/char/synclink.c 2004-10-07 23:02:25 -03:00
+++ b/drivers/char/synclink.c 2004-10-07 23:02:25 -03:00
@@ -8150,9 +8150,7 @@
memcpy(skb_put(skb, size),buf,size);
- skb->dev = info->netdev;
- skb->mac.raw = skb->data;
- skb->protocol = hdlc_type_trans(skb, skb->dev);
+ skb->protocol = hdlc_type_trans(skb, info->netdev);
stats->rx_packets++;
stats->rx_bytes += size;
diff -Nru a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
--- a/drivers/char/synclinkmp.c 2004-10-07 23:02:25 -03:00
+++ b/drivers/char/synclinkmp.c 2004-10-07 23:02:25 -03:00
@@ -1968,9 +1968,7 @@
memcpy(skb_put(skb, size),buf,size);
- skb->dev = info->netdev;
- skb->mac.raw = skb->data;
- skb->protocol = hdlc_type_trans(skb, skb->dev);
+ skb->protocol = hdlc_type_trans(skb, info->netdev);
stats->rx_packets++;
stats->rx_bytes += size;
diff -Nru a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
--- a/drivers/net/wan/dscc4.c 2004-10-07 23:02:25 -03:00
+++ b/drivers/net/wan/dscc4.c 2004-10-07 23:02:25 -03:00
@@ -517,7 +517,6 @@
skb = dev_alloc_skb(len);
dpriv->rx_skbuff[dirty] = skb;
if (skb) {
- skb->dev = dev;
skb->protocol = hdlc_type_trans(skb, dev);
skb->mac.raw = skb->data;
rx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data,
diff -Nru a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
--- a/drivers/net/wan/farsync.c 2004-10-07 23:02:25 -03:00
+++ b/drivers/net/wan/farsync.c 2004-10-07 23:02:25 -03:00
@@ -857,6 +857,18 @@
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
*/
static void
@@ -881,17 +893,10 @@
/* Push upstream */
dbg(DBG_RX, "Pushing the frame up the stack\n");
- skb->mac.raw = skb->data;
- skb->dev = dev;
- if (port->mode == FST_RAW) {
- /*
- * 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);
- }
+ if (port->mode == FST_RAW)
+ skb->protocol = farsync_type_trans(skb, dev);
+ else
+ skb->protocol = hdlc_type_trans(skb, dev);
rx_status = netif_rx(skb);
fst_process_rx_status(rx_status, port_to_dev(port)->name);
if (rx_status == NET_RX_DROP)
@@ -1316,17 +1321,10 @@
/* Push upstream */
dbg(DBG_RX, "Pushing frame up the stack\n");
- skb->mac.raw = skb->data;
- skb->dev = dev;
- if (port->mode == FST_RAW) {
- /*
- * 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);
- }
+ if (port->mode == FST_RAW)
+ skb->protocol = farsync_type_trans(skb, dev);
+ else
+ skb->protocol = hdlc_type_trans(skb, dev);
rx_status = netif_rx(skb);
fst_process_rx_status(rx_status, port_to_dev(port)->name);
if (rx_status == NET_RX_DROP) {
diff -Nru a/drivers/net/wan/hd6457x.c b/drivers/net/wan/hd6457x.c
--- a/drivers/net/wan/hd6457x.c 2004-10-07 23:02:25 -03:00
+++ b/drivers/net/wan/hd6457x.c 2004-10-07 23:02:25 -03:00
@@ -315,8 +315,6 @@
#endif
stats->rx_packets++;
stats->rx_bytes += skb->len;
- skb->mac.raw = skb->data;
- skb->dev = dev;
skb->dev->last_rx = jiffies;
skb->protocol = hdlc_type_trans(skb, dev);
netif_rx(skb);
diff -Nru a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c
--- a/drivers/net/wan/pc300_drv.c 2004-10-07 23:02:25 -03:00
+++ b/drivers/net/wan/pc300_drv.c 2004-10-07 23:02:25 -03:00
@@ -1959,7 +1959,6 @@
cpc_trace(dev, skb, 'R');
}
stats->rx_packets++;
- skb->mac.raw = skb->data;
skb->protocol = hdlc_type_trans(skb, dev);
netif_rx(skb);
}
diff -Nru a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
--- a/drivers/net/wan/wanxl.c 2004-10-07 23:02:25 -03:00
+++ b/drivers/net/wan/wanxl.c 2004-10-07 23:02:25 -03:00
@@ -224,8 +224,6 @@
#endif
stats->rx_packets++;
stats->rx_bytes += skb->len;
- skb->mac.raw = skb->data;
- skb->dev = dev;
dev->last_rx = jiffies;
skb->protocol = hdlc_type_trans(skb, dev);
netif_rx(skb);
diff -Nru a/include/linux/hdlc.h b/include/linux/hdlc.h
--- a/include/linux/hdlc.h 2004-10-07 23:02:25 -03:00
+++ b/include/linux/hdlc.h 2004-10-07 23:02:25 -03:00
@@ -243,11 +243,15 @@
static __inline__ unsigned short hdlc_type_trans(struct sk_buff *skb,
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)
return hdlc->proto.type_trans(skb, dev);
else
- return __constant_htons(ETH_P_HDLC);
+ return htons(ETH_P_HDLC);
}
#endif /* __KERNEL */
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: PATCH 1/1: [SKBUFF] move common code to hdlc_type_trans
2004-10-08 2:04 PATCH 1/1: [SKBUFF] move common code to hdlc_type_trans Arnaldo Carvalho de Melo
@ 2004-10-08 22:36 ` Francois Romieu
2004-10-08 23:07 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Francois Romieu @ 2004-10-08 22:36 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: David S. Miller, netdev
Arnaldo Carvalho de Melo <acme@conectiva.com.br> :
[dscc4.c sets skb->mac.raw after hdlc_type_trans]
> Francois, is this really what is intended? I left it as
In the pre-eth_type_trans area, yes :o/ I did not test dscc4 in
a bridged setup. Please fix the driver in your patch.
--
Ueimor
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH 1/1: [SKBUFF] move common code to hdlc_type_trans
2004-10-08 22:36 ` Francois Romieu
@ 2004-10-08 23:07 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2004-10-08 23:07 UTC (permalink / raw)
To: Francois Romieu; +Cc: David S. Miller, netdev
Francois Romieu wrote:
> Arnaldo Carvalho de Melo <acme@conectiva.com.br> :
> [dscc4.c sets skb->mac.raw after hdlc_type_trans]
>
>> Francois, is this really what is intended? I left it as
>
>
> In the pre-eth_type_trans area, yes :o/ I did not test dscc4 in
> a bridged setup. Please fix the driver in your patch.
OK, I'll do that later today, i.e. just remove
the skb->mac.raw = skb->data after the call to hdlc_type_trans as
it already, like eth_type_trans, sets skb->mac.raw to skb->data
prior to calling any hdlc layer type_trans pointer.
For those paying attention to this lowly stuff, what do you
think of renaming all those foo_type_trans to
foo_setup_rx_skb (suggestions for a better name than foo_type_trans
are welcome) and make it set skb->protocol, making it return just
void? I think it makes the whole thing clearer...
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-10-08 23:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-08 2:04 PATCH 1/1: [SKBUFF] move common code to hdlc_type_trans Arnaldo Carvalho de Melo
2004-10-08 22:36 ` Francois Romieu
2004-10-08 23:07 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).