[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5423FFD2.103@cogentembedded.com>
Date: Thu, 25 Sep 2014 15:43:14 +0400
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Ahmed Amamou <ahmed@...di.net>, netdev@...r.kernel.org
CC: william@...di.net, f.cachereul@...halink.fr,
Kamel Haddadou <kamel@...di.net>
Subject: Re: [RFC PATCH 22/24] net: rbridge: Add rbr_fwd
On 9/24/2014 7:52 PM, Ahmed Amamou wrote:
> add rbridge forward function
> packets arriving to rbr_fwd should be already encapsulated and correct egress
> and ingress nickname should be already assigned
> rbr_fwd function will assign correct source and destination outer MAC addresses
> according to which port will send the frame and next hop to reach
> the engress nickname
> Nexthope to reach the egress will be found in node database
> Signed-off-by: Ahmed Amamou <ahmed@...di.net>
> Signed-off-by: Kamel Haddadou <kamel@...di.net>
> Signed-off-by: William Dauchy <william@...di.net>
> Signed-off-by: François Cachereul <f.cachereul@...halink.fr>
> ---
> net/bridge/rbridge/rbr.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 47 insertions(+), 2 deletions(-)
> diff --git a/net/bridge/rbridge/rbr.c b/net/bridge/rbridge/rbr.c
> index 8aa5182..39aa816c 100644
> --- a/net/bridge/rbridge/rbr.c
> +++ b/net/bridge/rbridge/rbr.c
> @@ -177,6 +177,51 @@ static bool add_header(struct sk_buff *skb, uint16_t ingressnick,
> return 0;
> }
>
> +static void rbr_fwd(struct net_bridge_port *p, struct sk_buff *skb,
> + uint16_t adj_nick, u16 vid)
> +{
> + struct rbr_node *adj;
> + struct trill_hdr *trh;
> + struct ethhdr *outerethhdr;
> + struct net *net = dev_net(p->br->dev);
> + struct net_device *outdev;
> +
> + adj = rbr_find_node(p->br->rbr, adj_nick);
> + outdev = __dev_get_by_index(net, adj->rbr_ni->linkid);
Indent with a tab please.
> + if (!outdev) {
> + pr_warn_ratelimited("rbr_fwd: cannot find source port device for forwrding\n");
> + goto dest_fwd_fail;
> + }
> + if (unlikely(adj == NULL)) {
> + pr_warn_ratelimited
> + ("rbr_fwd: unable to find adjacent RBridge\n");
> + goto dest_fwd_fail;
> + }
> +
> + trh = (struct trill_hdr *)skb->data;
> + trillhdr_dec_hopcount(trh);
> + outerethhdr = eth_hdr(skb);
> +
> + /* change outer ether header */
> + /* bridge become the source_port address in outeretherhdr */
Becomes?
> + memcpy(outerethhdr->h_source, p->br->dev->dev_addr, ETH_ALEN);
> + /* dist port become dest address in outeretherhdr */
> + memcpy(outerethhdr->h_dest, adj->rbr_ni->adjsnpa, ETH_ALEN);
> + rbr_node_put(adj);
> + /* set Bridge as source device */
> + skb->dev = p->br->dev;
> + br_forward(br_port_get_rcu(outdev), skb, NULL);
> +
> + return;
> +
> + dest_fwd_fail:
> + if (likely(p && p->br))
> + p->br->dev->stats.tx_dropped++;
> + kfree_skb(skb);
> + return;
> +}
> +
> +
One empty line is enough.
> static void rbr_encaps(struct sk_buff *skb, uint16_t egressnick, u16 vid)
> {
> uint16_t local_nick;
[...]
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists