netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: "David S. Miller" <davem@redhat.com>
Cc: netdev@oss.sgi.com
Subject: [PATCH 2/2] [SKBUFF] introduce tr_hdr(skb)
Date: Wed, 06 Oct 2004 15:41:04 -0300	[thread overview]
Message-ID: <41643C40.8070605@conectiva.com.br> (raw)

[-- Attachment #1: Type: text/plain, Size: 106 bytes --]

Hi David,
	

	Please consider pulling from:

bk://kernel.bkbits.net/acme/sk_buff-2.6

Regards,

- Arnaldo

[-- Attachment #2: tr_hdr.patch --]
[-- Type: text/plain, Size: 2541 bytes --]

===================================================================


ChangeSet@1.2056, 2004-10-06 15:33:22-03:00, acme@conectiva.com.br
  [SKBUFF] introduce tr_hdr(skb)
  
  The token ring code in the kernel is bitrotting (no surprise :) ),
  it uses skb->data all around... I have an assortment of token ring
  cards but no MAU, can anybody send me one, please? I promise to
  make ssh work over LLC over Token Ring networks! Duh... :o)
  
  Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  Signed-off-by: David S. Miller <davem@redhat.com>


 include/linux/if_tr.h |    9 +++++++++
 include/net/llc_pdu.h |    4 ++--
 net/llc/llc_output.c  |    4 ++--
 3 files changed, 13 insertions(+), 4 deletions(-)


diff -Nru a/include/linux/if_tr.h b/include/linux/if_tr.h
--- a/include/linux/if_tr.h	2004-10-06 15:34:53 -03:00
+++ b/include/linux/if_tr.h	2004-10-06 15:34:53 -03:00
@@ -48,6 +48,15 @@
 	__u16 rseg[8];			/* routing registers */
 };
 
+#ifdef __KERNEL__
+#include <linux/skbuff.h>
+
+static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
+{
+	return (struct trh_hdr *)skb->mac.raw;
+}
+#endif
+
 /* This is an Token-Ring LLC structure */
 struct trllc {
 	__u8  dsap;			/* destination SAP */
diff -Nru a/include/net/llc_pdu.h b/include/net/llc_pdu.h
--- a/include/net/llc_pdu.h	2004-10-06 15:34:53 -03:00
+++ b/include/net/llc_pdu.h	2004-10-06 15:34:53 -03:00
@@ -255,7 +255,7 @@
 	if (skb->protocol == ntohs(ETH_P_802_2))
 		memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN);
 	else if (skb->protocol == ntohs(ETH_P_TR_802_2))
-		memcpy(sa, ((struct trh_hdr *)skb->mac.raw)->saddr, ETH_ALEN);
+		memcpy(sa, tr_hdr(skb)->saddr, ETH_ALEN);
 }
 
 /**
@@ -270,7 +270,7 @@
 	if (skb->protocol == ntohs(ETH_P_802_2))
 		memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN);
 	else if (skb->protocol == ntohs(ETH_P_TR_802_2))
-		memcpy(da, ((struct trh_hdr *)skb->mac.raw)->daddr, ETH_ALEN);
+		memcpy(da, tr_hdr(skb)->daddr, ETH_ALEN);
 }
 
 /**
diff -Nru a/net/llc/llc_output.c b/net/llc/llc_output.c
--- a/net/llc/llc_output.c	2004-10-06 15:34:53 -03:00
+++ b/net/llc/llc_output.c	2004-10-06 15:34:53 -03:00
@@ -40,7 +40,8 @@
 		struct net_device *dev = skb->dev;
 		struct trh_hdr *trh;
 		
-		trh = (struct trh_hdr *)skb_push(skb, sizeof(*trh));
+		skb->mac.raw = skb_push(skb, sizeof(*trh));
+		trh = tr_hdr(skb);
 		trh->ac = AC;
 		trh->fc = LLC_FRAME;
 		if (sa)
@@ -51,7 +52,6 @@
 			memcpy(trh->daddr, da, dev->addr_len);
 			tr_source_route(skb, trh, dev);
 		}
-		skb->mac.raw = skb->data;
 		break;
 	}
 #endif


             reply	other threads:[~2004-10-06 18:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-06 18:41 Arnaldo Carvalho de Melo [this message]
2004-10-06 18:58 ` [PATCH 2/2] [SKBUFF] introduce tr_hdr(skb) Thomas Graf
2004-10-06 19:06   ` Arnaldo Carvalho de Melo
2004-10-06 19:18     ` Arnaldo Carvalho de Melo
2004-10-06 19:16       ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41643C40.8070605@conectiva.com.br \
    --to=acme@conectiva.com.br \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).