Re: [mpls-linux-devel] mpls-linux on 64 bit kernel
Status: Beta
Brought to you by:
jleu
From: <jl...@mi...> - 2010-05-18 15:18:25
|
Good stuff. I will apply to the main tree. You can see the latest code at: git://repo.or.cz/mpls-linux.git That tree contains a kernel patch for core changes (shim and exports) and then a src dir for compiling mpls modules outside the kernel. I've found this to be a much quicker development/testing cycle. On Tue, May 18, 2010 at 12:00:50PM +0200, Jorge Boncompte [DTI2] wrote: > El 18/05/2010 11:09, Jorge Boncompte [DTI2] escribió: > > El 18/05/2010 0:15, Chris Robson escribió: > >> > >> Ashan > >> > >> I'm currently trying to test this but having lock up problems. However, > >> I have cornered the problem to the following code snip. Note the > >> conditional compile statement. This maybe the cause of the x86_64 > >> system locking up, but (and a big but) it also locks up with my x86_32 > >> systems as well. Will be collecting more data tomorrow but if anyone > >> has any ideas I'm all ears. FYI, the lock up occurs when > >> mpls_opcode_peek is called from mpls_skb_recv(). > >> > >> int mpls_opcode_peek(struct sk_buff *skb) > >> { > >> u32 shim; > >> > >> #define CAN_WE_ASSUME_32BIT_ALIGNED 0 > >> #if CAN_WE_ASSUME_32BIT_ALIGNED > >> shim = ntohl(*((u32*)&skb->network_header)); > >> #else > >> memcpy(&shim,skb->network_header,sizeof(u32)); > >> shim = ntohl(shim); > >> #endif > >> > >> if (!(MPLSCB(skb)->flag)) { > >> MPLSCB(skb)->ttl = shim & 0xFF; > >> MPLSCB(skb)->flag = 1; > >> } > >> MPLSCB(skb)->bos = (shim >> 8 ) & 0x1; > >> MPLSCB(skb)->exp = (shim >> 9 ) & 0x7; > >> MPLSCB(skb)->label = (shim >> 12) & 0xFFFFF; > >> > >> return MPLS_RESULT_RECURSE; > >> } > > > > Ok, that rang a bell. The problem is that in arches with BITS_PER_LONG > 32, > > some of the members of the skbuff are not pointers (network_header, > > transport_header, ...) but offsets. > > > > I'll cook a patch and send it to you to test. > > > > Try this. Maybe it does not apply to your tree because it is against the > codebase i am cleaning off but it should be simple to resolve. > > > -- > ============================================================== > Jorge Boncompte - Ingenieria y Gestion de RED > DTI2 - Desarrollo de la Tecnologia de las Comunicaciones > -------------------------------------------------------------- > C/ Abogado Enriquez Barrios, 5 14004 CORDOBA (SPAIN) > Tlf: +34 957 761395 / FAX: +34 957 450380 > ============================================================== > - Sin pistachos no hay Rock & Roll... > - Without wicker a basket cannot be made. > ============================================================== > diff --git a/net/bridge/netfilter/ebt_mpls.c b/net/bridge/netfilter/ebt_mpls.c > index 109cf16..541c4be 100644 > --- a/net/bridge/netfilter/ebt_mpls.c > +++ b/net/bridge/netfilter/ebt_mpls.c > @@ -30,8 +30,8 @@ static int target(struct sk_buff *skb, unsigned int hooknr, > * set skb->network_header = skb->data, skb->network_header > * is where we put the MPLS shim > */ > - skb_push(skb, skb->data - skb->mac_header); > - skb->network_header = skb->data; > + skb_push(skb, skb->data - skb_mac_header(skb)); > + skb_reset_network_header(skb); > mpls_output_shim(skb, nhlfe); > > /* don't let anyone else use this frame */ > diff --git a/net/ipv4/mpls4.c b/net/ipv4/mpls4.c > index bff2c70..5e9c6a8 100644 > --- a/net/ipv4/mpls4.c > +++ b/net/ipv4/mpls4.c > @@ -104,7 +104,7 @@ static struct sk_buff *mpls4_build_icmp(struct sk_buff *skb, int type, > /* now where at the payload, for now we're > * assuming this is IPv4 > */ > - skb->network_header = skb->data; > + skb_reset_network_header(skb); > > /* buid a new skb, that will be big enough to hold > * a maximum of 576 bytes (RFC792) > diff --git a/net/mpls/mpls_opcode.c b/net/mpls/mpls_opcode.c > index a5e663f..369e458 100644 > --- a/net/mpls/mpls_opcode.c > +++ b/net/mpls/mpls_opcode.c > @@ -78,9 +78,9 @@ int mpls_opcode_peek(struct sk_buff *skb) > > #define CAN_WE_ASSUME_32BIT_ALIGNED 0 > #if CAN_WE_ASSUME_32BIT_ALIGNED > - shim = ntohl(*((u32 *)&skb->network_header)); > + shim = ntohl(*((u32 *)&skb_network_header(skb))); > #else > - memcpy(&shim, skb->network_header, sizeof(u32)); > + memcpy(&shim, skb_network_header(skb), sizeof(u32)); > shim = ntohl(shim); > #endif > > diff --git a/net/mpls/mpls_utils.c b/net/mpls/mpls_utils.c > index 9204d1d..f5d58be 100644 > --- a/net/mpls/mpls_utils.c > +++ b/net/mpls/mpls_utils.c > @@ -142,7 +142,7 @@ EXPORT_SYMBOL(mpls_label2key); > * @skb - the packet to work on > * > * assumes valid data in MPLSCB(skb)->popped_bos and that > - * that skb->network_header is pointing to a label in the MPLS shim > + * that skb_network_header(skb) is pointing to a label in the MPLS shim > * returns a unsigned char* which point to the first byte after the MPLS > * shim. > * > @@ -194,7 +194,7 @@ EXPORT_SYMBOL(mpls_find_payload); > > void mpls_skb_dump(struct sk_buff *sk) > { > - unsigned int i; > + unsigned long i; > > printk(KERN_DEBUG "MPLS mpls_skb_dump: from %s with len %d (%d)" > "headroom=%d tailroom=%d\n", > @@ -204,17 +204,17 @@ void mpls_skb_dump(struct sk_buff *sk) > skb_headroom(sk), > skb_tailroom(sk)); > > - for (i = (unsigned int)sk->head; i <= (unsigned int)sk->tail; i++) { > - if (i == (unsigned int)sk->data) > + for (i = (unsigned long)sk->head; i <= (unsigned long)sk->tail; i++) { > + if (i == (unsigned long)sk->data) > printk("{"); > - if (i == (unsigned int)sk->transport_header) > + if (i == (unsigned long)skb_transport_header(sk)) > printk("#"); > - if (i == (unsigned int)sk->network_header) > + if (i == (unsigned long)skb_network_header(sk)) > printk("|"); > - if (i == (unsigned int)sk->mac_header) > + if (i == (unsigned long)skb_mac_header(sk)) > printk("*"); > printk("%02x", *((unsigned char *)i)); > - if (i == (unsigned int)sk->tail) > + if (i == (unsigned long)sk->tail) > printk("}"); > } > printk("\n"); > ------------------------------------------------------------------------------ > > _______________________________________________ > mpls-linux-devel mailing list > mpl...@li... > https://lists.sourceforge.net/lists/listinfo/mpls-linux-devel -- James R. Leu jl...@mi... |