netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Jiri Pirko <jiri@resnulli.us>, netdev@vger.kernel.org
Cc: davem@davemloft.net, yotamg@mellanox.com, idosch@mellanox.com,
	mlxsw@mellanox.com, nikolay@cumulusnetworks.com, andrew@lunn.ch,
	dsa@cumulusnetworks.com, edumazet@google.com, willemb@google.com,
	johannes.berg@intel.com, dcaratti@redhat.com, pabeni@redhat.com,
	daniel@iogearbox.net, fw@strlen.de, gfree.wind@vip.163.com
Subject: Re: [patch net-next 3/7] ipv4: ipmr: Don't forward packets already forwarded by hardware
Date: Thu, 28 Sep 2017 10:56:38 -0700	[thread overview]
Message-ID: <bb37f353-8f15-f570-a35e-ed76c56f1180@gmail.com> (raw)
In-Reply-To: <20170928173415.15551-4-jiri@resnulli.us>

On 09/28/2017 10:34 AM, Jiri Pirko wrote:
> From: Yotam Gigi <yotamg@mellanox.com>
> 
> Change the ipmr module to not forward packets if:
>  - The packet is marked with the offload_mr_fwd_mark, and
>  - Both input interface and output interface share the same parent ID.
> 
> This way, a packet can go through partial multicast forwarding in the
> hardware, where it will be forwarded only to the devices that share the
> same parent ID (AKA, reside inside the same hardware). The kernel will
> forward the packet to all other interfaces.
> 
> To do this, add the ipmr_offload_forward helper, which per skb, ingress VIF
> and egress VIF, returns whether the forwarding was offloaded to hardware.
> The ipmr_queue_xmit frees the skb and does not forward it if the result is
> a true value.
> 
> All the forwarding path code compiles out when the CONFIG_NET_SWITCHDEV is
> not set.
> 
> Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
> Reviewed-by: Ido Schimmel <idosch@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  net/ipv4/ipmr.c | 37 ++++++++++++++++++++++++++++++++-----
>  1 file changed, 32 insertions(+), 5 deletions(-)
> 
> diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
> index 4566c54..deba569 100644
> --- a/net/ipv4/ipmr.c
> +++ b/net/ipv4/ipmr.c
> @@ -1857,10 +1857,33 @@ static inline int ipmr_forward_finish(struct net *net, struct sock *sk,
>  	return dst_output(net, sk, skb);
>  }
>  
> +#ifdef CONFIG_NET_SWITCHDEV
> +static bool ipmr_forward_offloaded(struct sk_buff *skb, struct mr_table *mrt,
> +				   int in_vifi, int out_vifi)
> +{
> +	struct vif_device *out_vif = &mrt->vif_table[out_vifi];
> +	struct vif_device *in_vif = &mrt->vif_table[in_vifi];

Nit: in_vifi and out_vifi may be better named as in_vif_idx and
out_vif_idx, oh well you are just replicating the existing naming
conventions used down below, never mind then.
-- 
Florian

  reply	other threads:[~2017-09-28 17:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 17:34 [patch net-next 0/7] mlxsw: Add support for partial multicast route offload Jiri Pirko
2017-09-28 17:34 ` [patch net-next 1/7] skbuff: Add the offload_mr_fwd_mark field Jiri Pirko
2017-09-28 17:49   ` Andrew Lunn
2017-09-29  6:05     ` Jiri Pirko
2017-09-29 11:14   ` Davide Caratti
2017-09-29 11:36     ` Yuval Mintz
2017-09-28 17:34 ` [patch net-next 2/7] ipv4: ipmr: Add the parent ID field to VIF struct Jiri Pirko
2017-09-29  9:29   ` Nikolay Aleksandrov
2017-09-29  9:45     ` Nikolay Aleksandrov
2017-10-01  6:22       ` Yotam Gigi
2017-09-29  9:50   ` Nikolay Aleksandrov
2017-10-01  6:33     ` Yotam Gigi
2017-09-28 17:34 ` [patch net-next 3/7] ipv4: ipmr: Don't forward packets already forwarded by hardware Jiri Pirko
2017-09-28 17:56   ` Florian Fainelli [this message]
2017-10-01  8:51     ` Yotam Gigi
2017-09-28 17:34 ` [patch net-next 4/7] mlxsw: acl: Introduce ACL trap and forward action Jiri Pirko
2017-09-28 17:34 ` [patch net-next 5/7] mlxsw: spectrum: Add trap for multicast trap-and-forward routes Jiri Pirko
2017-09-28 17:34 ` [patch net-next 6/7] mlxsw: spectrum: mr_tcam: Add trap-and-forward multicast route Jiri Pirko
2017-09-28 17:34 ` [patch net-next 7/7] mlxsw: spectrum: mr: Support trap-and-forward routes Jiri Pirko

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=bb37f353-8f15-f570-a35e-ed76c56f1180@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dcaratti@redhat.com \
    --cc=dsa@cumulusnetworks.com \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=gfree.wind@vip.163.com \
    --cc=idosch@mellanox.com \
    --cc=jiri@resnulli.us \
    --cc=johannes.berg@intel.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    --cc=yotamg@mellanox.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).