X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=net%2Fmpls%2Finternal.h;fp=net%2Fmpls%2Finternal.h;h=bde52ce88c949e76083ec704ed010493b60d6466;hb=cf4b24f0024fc2e3fbc653a659356d224b5b9172;hp=d7757be39877e84530ebecfc18fbb7dab502f979;hpb=b4e04fc7357b6cef0856cb14b42306af1af990e5;p=cascardo%2Flinux.git diff --git a/net/mpls/internal.h b/net/mpls/internal.h index d7757be39877..bde52ce88c94 100644 --- a/net/mpls/internal.h +++ b/net/mpls/internal.h @@ -25,7 +25,8 @@ struct sk_buff; #define MAX_NEW_LABELS 2 /* This maximum ha length copied from the definition of struct neighbour */ -#define MAX_VIA_ALEN (ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))) +#define VIA_ALEN_ALIGN sizeof(unsigned long) +#define MAX_VIA_ALEN (ALIGN(MAX_ADDR_LEN, VIA_ALEN_ALIGN)) enum mpls_payload_type { MPT_UNSPEC, /* IPv4 or IPv6 */ @@ -44,14 +45,35 @@ struct mpls_nh { /* next hop label forwarding entry */ u8 nh_labels; u8 nh_via_alen; u8 nh_via_table; - u8 nh_via[MAX_VIA_ALEN]; }; +/* The route, nexthops and vias are stored together in the same memory + * block: + * + * +----------------------+ + * | mpls_route | + * +----------------------+ + * | mpls_nh 0 | + * +----------------------+ + * | ... | + * +----------------------+ + * | mpls_nh n-1 | + * +----------------------+ + * | alignment padding | + * +----------------------+ + * | via[rt_max_alen] 0 | + * +----------------------+ + * | ... | + * +----------------------+ + * | via[rt_max_alen] n-1 | + * +----------------------+ + */ struct mpls_route { /* next hop label forwarding entry */ struct rcu_head rt_rcu; u8 rt_protocol; u8 rt_payload_type; - int rt_nhn; + u8 rt_max_alen; + unsigned int rt_nhn; struct mpls_nh rt_nh[0]; };