public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine•com>
To: edward.cree@amd•com
Cc: linux-net-drivers@amd•com, davem@davemloft•net, kuba@kernel•org,
	pabeni@redhat•com, edumazet@google•com,
	Edward Cree <ecree.xilinx@gmail•com>,
	netdev@vger•kernel.org, habetsm.xilinx@gmail•com,
	michal.swiatkowski@linux•intel.com
Subject: Re: [PATCH net-next v2 4/6] sfc: add functions to insert encap matches into the MAE
Date: Sat, 25 Mar 2023 13:04:57 +0100	[thread overview]
Message-ID: <ZB7jadqopcv250l2@corigine.com> (raw)
In-Reply-To: <b9798c4b1f176257cb9b690d350f3a3c66c1b401.1679603051.git.ecree.xilinx@gmail.com>

On Thu, Mar 23, 2023 at 08:45:12PM +0000, edward.cree@amd•com wrote:
> From: Edward Cree <ecree.xilinx@gmail•com>
> 
> An encap match corresponds to an entry in the exact-match Outer Rule
>  table; the lookup response includes the encap type (protocol) allowing
>  the hardware to continue parsing into the inner headers.
> 
> Signed-off-by: Edward Cree <ecree.xilinx@gmail•com>

Hi Edward,

this also looks good to me.

Minor nit below not withstanding.

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

...

> diff --git a/drivers/net/ethernet/sfc/mae.c b/drivers/net/ethernet/sfc/mae.c
> index 2290a63908c5..92f1383ee4b9 100644
> --- a/drivers/net/ethernet/sfc/mae.c
> +++ b/drivers/net/ethernet/sfc/mae.c
> @@ -558,6 +558,20 @@ int efx_mae_free_counter(struct efx_nic *efx, struct efx_tc_counter *cnt)
>  	return 0;
>  }
>  
> +static int efx_mae_encap_type_to_mae_type(enum efx_encap_type type)
> +{
> +	switch (type & EFX_ENCAP_TYPES_MASK) {
> +	case EFX_ENCAP_TYPE_NONE:
> +		return MAE_MCDI_ENCAP_TYPE_NONE;
> +	case EFX_ENCAP_TYPE_VXLAN:
> +		return MAE_MCDI_ENCAP_TYPE_VXLAN;
> +	case EFX_ENCAP_TYPE_GENEVE:
> +		return MAE_MCDI_ENCAP_TYPE_GENEVE;
> +	default:
> +		return -EOPNOTSUPP;
> +	}
> +}
> +
>  int efx_mae_lookup_mport(struct efx_nic *efx, u32 vf_idx, u32 *id)
>  {
>  	struct ef100_nic_data *nic_data = efx->nic_data;
> @@ -915,6 +929,97 @@ int efx_mae_free_action_set_list(struct efx_nic *efx,
>  	return 0;
>  }
>  
> +int efx_mae_register_encap_match(struct efx_nic *efx,
> +				 struct efx_tc_encap_match *encap)
> +{
> +	MCDI_DECLARE_BUF(inbuf, MC_CMD_MAE_OUTER_RULE_INSERT_IN_LEN(MAE_ENC_FIELD_PAIRS_LEN));
> +	MCDI_DECLARE_BUF(outbuf, MC_CMD_MAE_OUTER_RULE_INSERT_OUT_LEN);
> +	MCDI_DECLARE_STRUCT_PTR(match_crit);
> +	size_t outlen;
> +	int rc;
> +
> +	rc = efx_mae_encap_type_to_mae_type(encap->tun_type);
> +	if (rc < 0)
> +		return rc;

...

> diff --git a/drivers/net/ethernet/sfc/tc.h b/drivers/net/ethernet/sfc/tc.h
> index c1485679507c..19782c9a4354 100644
> --- a/drivers/net/ethernet/sfc/tc.h
> +++ b/drivers/net/ethernet/sfc/tc.h
> @@ -70,6 +70,7 @@ struct efx_tc_encap_match {
>  	__be32 src_ip, dst_ip;
>  	struct in6_addr src_ip6, dst_ip6;
>  	__be16 udp_dport;
> +	u16 tun_type; /* enum efx_encap_type */

nit: maybe the type of tyn_type can be enum efx_encap_type.

>  	u32 fw_id; /* index of this entry in firmware encap match table */
>  };
>  
> 

  reply	other threads:[~2023-03-25 12:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 20:45 [PATCH net-next v2 0/6] sfc: support TC decap rules edward.cree
2023-03-23 20:45 ` [PATCH net-next v2 1/6] sfc: document TC-to-EF100-MAE action translation concepts edward.cree
2023-03-25 12:05   ` Simon Horman
2023-03-23 20:45 ` [PATCH net-next v2 2/6] sfc: add notion of match on enc keys to MAE machinery edward.cree
2023-03-25 12:03   ` Simon Horman
2023-03-27  8:20     ` Edward Cree
2023-03-27  8:47       ` Simon Horman
2023-03-23 20:45 ` [PATCH net-next v2 3/6] sfc: handle enc keys in efx_tc_flower_parse_match() edward.cree
2023-03-25 12:07   ` Simon Horman
2023-03-23 20:45 ` [PATCH net-next v2 4/6] sfc: add functions to insert encap matches into the MAE edward.cree
2023-03-25 12:04   ` Simon Horman [this message]
2023-03-27  8:28     ` Edward Cree
2023-03-27  8:48       ` Simon Horman
2023-03-23 20:45 ` [PATCH net-next v2 5/6] sfc: add code to register and unregister encap matches edward.cree
2023-03-24  5:05   ` Jakub Kicinski
2023-03-24  9:10     ` Martin Habets
2023-03-24 18:37       ` Edward Cree
2023-03-24 17:16   ` kernel test robot
2023-03-26  9:18   ` Simon Horman
2023-03-23 20:45 ` [PATCH net-next v2 6/6] sfc: add offloading of 'foreign' TC (decap) rules edward.cree
2023-03-26  9:15   ` 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=ZB7jadqopcv250l2@corigine.com \
    --to=simon.horman@corigine$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=ecree.xilinx@gmail$(echo .)com \
    --cc=edumazet@google$(echo .)com \
    --cc=edward.cree@amd$(echo .)com \
    --cc=habetsm.xilinx@gmail$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=linux-net-drivers@amd$(echo .)com \
    --cc=michal.swiatkowski@linux$(echo .)intel.com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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