All of lore.kernel.org
 help / color / mirror / Atom feed
From: roopa <roopa@cumulusnetworks.com>
To: nicolas.dichtel@6wind.com
Cc: davem@davemloft.net, netdev@vger.kernel.org, tgraf@suug.ch
Subject: Re: [PATCH net-next] route: allow to route in a peer netns via lwt framework
Date: Thu, 23 Jul 2015 08:50:40 -0700	[thread overview]
Message-ID: <55B10D50.9010704@cumulusnetworks.com> (raw)
In-Reply-To: <55B1077F.1090501@6wind.com>

On 7/23/15, 8:25 AM, Nicolas Dichtel wrote:
> Le 23/07/2015 17:01, roopa a écrit :
>> On 7/23/15, 7:22 AM, Nicolas Dichtel wrote:
> [snip]
>>> +static inline u32 *lwt_netns_info(struct lwtunnel_state *lwtstate)
>>> +{
>>> +    return (u32 *)lwtstate->data;
>>> +}
>>> +
>>> +static inline int skb_lwt_netns_info(struct sk_buff *skb)
>>> +{
>>> +    if (skb->protocol == htons(ETH_P_IP)) {
>>> +        struct rtable *rt = (struct rtable *)skb_dst(skb);
>>> +
>>> +        if (rt && rt->rt_lwtstate)
>>> +            return *lwt_netns_info(rt->rt_lwtstate);
>>> +    } else if (skb->protocol == htons(ETH_P_IPV6)) {
>>> +        struct rt6_info *rt6 = (struct rt6_info *)skb_dst(skb);
>>> +
>>> +        if (rt6 && rt6->rt6i_lwtstate)
>>> +            return *lwt_netns_info(rt6->rt6i_lwtstate);
>>> +    }
>>> +
>>> +    return NETNSA_NSID_NOT_ASSIGNED;
>>> +}
>>>   #endif /* __NET_LWTUNNEL_H */
>> since these apis' don't have to be netns specific,
>> Can they just be named lwtunnel_get_state_data and skb_lwtunnel_state ?
> They are specific to netns because lwtstate->data is interpreted as an 
> u32 *.
> But I agree that a test is missing against lwtstate->type to ensure 
> that data
> will be a nsid.
>
o ok..., the api's in lwtunnel.h today are not specific to an encap type.
they are generic, so skb_lwtunnel_state() which returns struct 
lwtunnel_state could go here.
the encap specific ones can go in the respective callers. Recently 
thomas added a similar
skb_tunnel_info() for ip tunnels. I did  like to have a generic version 
of your skb_lwt_netns_info in lwtunnel.h. I could use it in my mpls 
output func too.


>>
>> and seems like they should be declared for both CONFIG_LWTUNNEL 'y' 
>> and 'n'.
> It is outside the "#ifdef CONFIG_LWTUNNEL". I can successfully compile 
> with and
> without CONFIG_LWTUNNEL.
ok,

thanks,
Roopa

  reply	other threads:[~2015-07-23 15:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 14:22 [PATCH net-next] route: allow to route in a peer netns via lwt framework Nicolas Dichtel
2015-07-23 15:01 ` roopa
2015-07-23 15:25   ` Nicolas Dichtel
2015-07-23 15:50     ` roopa [this message]
2015-07-24 12:24       ` Nicolas Dichtel
2015-07-24 13:50         ` roopa
2015-07-24 14:11           ` Nicolas Dichtel
2015-07-24 14:16     ` [PATCH net-next v2] " Nicolas Dichtel
2015-07-24 15:39       ` Eric Dumazet
2015-07-24 16:27         ` Alexei Starovoitov
2015-07-27 19:56         ` Nicolas Dichtel
2015-07-29 13:16           ` [PATCH net-next v3] " Nicolas Dichtel
2015-07-29 15:20             ` Eric Dumazet
2015-07-29 21:17               ` Nicolas Dichtel
2015-07-24 14:28 ` [PATCH net-next] " David Ahern
2015-07-24 14:32   ` Nicolas Dichtel
2015-07-24 15:19     ` David Ahern
2015-07-27 20:07       ` Nicolas Dichtel

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=55B10D50.9010704@cumulusnetworks.com \
    --to=roopa@cumulusnetworks.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=tgraf@suug.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.