netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Marcin Szycik <marcin.szycik@linux.intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	wojciech.drewek@intel.com, michal.swiatkowski@linux.intel.com,
	alexandr.lobakin@intel.com, davem@davemloft.net, kuba@kernel.org,
	jiri@resnulli.us, pabeni@redhat.com, jesse.brandeburg@intel.com,
	idosch@nvidia.com
Subject: Re: [RFC PATCH iwl-next 4/6] pfcp: always set pfcp metadata
Date: Mon, 5 Jun 2023 11:34:27 +0200	[thread overview]
Message-ID: <ZH2sI7IK+ZjDR6bu@corigine.com> (raw)
In-Reply-To: <20230601131929.294667-5-marcin.szycik@linux.intel.com>

On Thu, Jun 01, 2023 at 03:19:27PM +0200, Marcin Szycik wrote:
> From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> 
> In PFCP receive path set metadata needed by flower code to do correct
> classification based on this metadata.
> 
> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>

A few minor nits below.
Otherwise, looks good to me.

Reviewed-by: Simon Horman <simon.horman@corigine.com>

...

> @@ -30,6 +33,82 @@ struct pfcp_net {
>  	struct list_head	pfcp_dev_list;
>  };
>  
> +static int
> +pfcp_session_recv(struct pfcp_dev *pfcp, struct sk_buff *skb,
> +		  struct pfcp_metadata *md)
> +{
> +	struct pfcphdr_session *unparsed = pfcp_hdr_session(skb);
> +
> +	md->seid = unparsed->seid;
> +	md->type = PFCP_TYPE_SESSION;
> +
> +	return 0;
> +}

nit: This the return type of this function could be void.

> +
> +static int
> +pfcp_node_recv(struct pfcp_dev *pfcp, struct sk_buff *skb,
> +	       struct pfcp_metadata *md)
> +{
> +	md->type = PFCP_TYPE_NODE;
> +
> +	return 0;
> +}

Ditto.

> +
> +static int pfcp_encap_recv(struct sock *sk, struct sk_buff *skb)
> +{
> +	IP_TUNNEL_DECLARE_FLAGS(flags) = { };
> +	struct metadata_dst *tun_dst;
> +	struct pfcp_metadata *md;
> +	struct pfcphdr *unparsed;
> +	struct pfcp_dev *pfcp;
> +
> +	if (unlikely(!pskb_may_pull(skb, PFCP_HLEN)))
> +		goto drop;
> +
> +	pfcp = rcu_dereference_sk_user_data(sk);
> +	if (unlikely(!pfcp))
> +		goto drop;
> +
> +	unparsed = pfcp_hdr(skb);
> +
> +	bitmap_zero(flags, __IP_TUNNEL_FLAG_NUM);
> +	tun_dst = udp_tun_rx_dst(skb, sk->sk_family, flags, 0,
> +				 sizeof(*md));
> +	if (unlikely(!tun_dst))
> +		goto drop;
> +
> +	md = ip_tunnel_info_opts(&tun_dst->u.tun_info);
> +	if (unlikely(!md))
> +		goto drop;
> +
> +	if (unparsed->flags & PFCP_SEID_FLAG)
> +		pfcp_session_recv(pfcp, skb, md);
> +	else
> +		pfcp_node_recv(pfcp, skb, md);
> +
> +	__set_bit(IP_TUNNEL_PFCP_OPT_BIT, flags);
> +	ip_tunnel_info_opts_set(&tun_dst->u.tun_info, md, sizeof(*md),
> +				flags);
> +
> +	if (unlikely(iptunnel_pull_header(skb, PFCP_HLEN, skb->protocol,
> +					  !net_eq(sock_net(sk),
> +					  dev_net(pfcp->dev)))))
> +		goto drop;
> +
> +	skb_dst_set(skb, (struct dst_entry *)tun_dst);
> +
> +	skb_reset_network_header(skb);
> +	skb_reset_mac_header(skb);
> +	skb->dev = pfcp->dev;
> +
> +	gro_cells_receive(&pfcp->gro_cells, skb);
> +
> +	return 0;
> +drop:
> +	kfree_skb(skb);
> +	return 0;
> +}

...

  reply	other threads:[~2023-06-05  9:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01 13:19 [RFC PATCH iwl-next 0/6] ice: Add PFCP filter support Marcin Szycik
2023-06-01 13:19 ` [RFC PATCH iwl-next 1/6] ip_tunnel: use a separate struct to store tunnel params in the kernel Marcin Szycik
2023-06-05  9:23   ` Simon Horman
2023-06-01 13:19 ` [RFC PATCH iwl-next 2/6] ip_tunnel: convert __be16 tunnel flags to bitmaps Marcin Szycik
2023-06-02 13:19   ` Alexander Lobakin
2023-06-05  9:23   ` Simon Horman
2023-06-05 14:21     ` Marcin Szycik
2023-06-06 13:17     ` Alexander Lobakin
2023-06-06 15:25       ` Simon Horman
2023-06-01 13:19 ` [RFC PATCH iwl-next 3/6] pfcp: add PFCP module Marcin Szycik
2023-06-05  9:26   ` Simon Horman
2023-06-01 13:19 ` [RFC PATCH iwl-next 4/6] pfcp: always set pfcp metadata Marcin Szycik
2023-06-05  9:34   ` Simon Horman [this message]
2023-06-01 13:19 ` [RFC PATCH iwl-next 5/6] ice: refactor ICE_TC_FLWR_FIELD_ENC_OPTS Marcin Szycik
2023-06-05  9:36   ` Simon Horman
2023-06-01 13:19 ` [RFC PATCH iwl-next 6/6] ice: Add support for PFCP hardware offload in switchdev Marcin Szycik
2023-06-05  9:38   ` Simon Horman

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=ZH2sI7IK+ZjDR6bu@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=alexandr.lobakin@intel.com \
    --cc=davem@davemloft.net \
    --cc=idosch@nvidia.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=marcin.szycik@linux.intel.com \
    --cc=michal.swiatkowski@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wojciech.drewek@intel.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).