From: Jakub Kicinski <kuba@kernel.org>
To: <edward.cree@amd.com>
Cc: <netdev@vger.kernel.org>, <linux-net-drivers@amd.com>,
<davem@davemloft.net>, <pabeni@redhat.com>, <edumazet@google.com>,
<habetsm.xilinx@gmail.com>, Edward Cree <ecree.xilinx@gmail.com>
Subject: Re: [PATCH net-next 1/5] sfc: check recirc_id match caps before MAE offload
Date: Tue, 25 Oct 2022 19:40:35 -0700 [thread overview]
Message-ID: <20221025194035.7eb96c0a@kernel.org> (raw)
In-Reply-To: <d3da32136ba31c553fa267381eb6a01903525814.1666603600.git.ecree.xilinx@gmail.com>
On Mon, 24 Oct 2022 10:29:21 +0100 edward.cree@amd.com wrote:
> From: Edward Cree <ecree.xilinx@gmail.com>
>
> Offloaded TC rules always match on recirc_id in the MAE, so we should
> check that the MAE reported support for this match before attempting
> to insert the rule.
>
> Fixes: d902e1a737d4 ("sfc: bare bones TC offload on EF100")
This commit made it to net, needs to go separately there.
> +/* Validate field mask against hardware capabilities. May return from caller */
> +#define CHECK(_mcdi, _field) do { \
> + enum mask_type typ = classify_mask((const u8 *)&mask->_field, \
> + sizeof(mask->_field)); \
> + \
> + rc = efx_mae_match_check_cap_typ(supported_fields[MAE_FIELD_ ## _mcdi],\
> + typ); \
> + if (rc) { \
> + NL_SET_ERR_MSG_FMT_MOD(extack, \
> + "No support for %s mask in field %s", \
> + mask_type_name(typ), #_field); \
> + return rc; \
We still don't allow flow control to hide inside macros.
You add the checks next to each other (looking at the next patch)
so you can return rc from the macro and easily combine the checks
into one large if statement. Result - close to ~1 line per check.
> + } \
> +} while (0)
> +
> int efx_mae_match_check_caps(struct efx_nic *efx,
> const struct efx_tc_match_fields *mask,
> struct netlink_ext_ack *extack)
> @@ -269,6 +284,7 @@ int efx_mae_match_check_caps(struct efx_nic *efx,
> mask_type_name(ingress_port_mask_type));
> return rc;
> }
> + CHECK(RECIRC_ID, recirc_id);
> return 0;
I think the #undef leaked into the next patch.
next prev parent reply other threads:[~2022-10-26 2:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 9:29 [PATCH net-next 0/5] sfc: add basic flower matches to offload edward.cree
2022-10-24 9:29 ` [PATCH net-next 1/5] sfc: check recirc_id match caps before MAE offload edward.cree
2022-10-26 2:40 ` Jakub Kicinski [this message]
2022-11-01 13:30 ` Edward Cree
2022-11-01 15:21 ` Jakub Kicinski
2022-11-01 15:41 ` Edward Cree
2022-11-01 15:50 ` Jakub Kicinski
2022-10-24 9:29 ` [PATCH net-next 2/5] sfc: add Layer 2 matches to ef100 TC offload edward.cree
2022-10-24 9:29 ` [PATCH net-next 3/5] sfc: add Layer 3 " edward.cree
2022-10-24 9:29 ` [PATCH net-next 4/5] sfc: add Layer 3 flag " edward.cree
2022-10-24 9:29 ` [PATCH net-next 5/5] sfc: add Layer 4 " edward.cree
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=20221025194035.7eb96c0a@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=edward.cree@amd.com \
--cc=habetsm.xilinx@gmail.com \
--cc=linux-net-drivers@amd.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).