From: Leon Romanovsky <leon@kernel.org>
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
Subject: Re: [PATCH net-next] sfc: support offloading TC VLAN push/pop actions to the MAE
Date: Sun, 19 Feb 2023 11:21:31 +0200 [thread overview]
Message-ID: <Y/HqGyFiIMFZRT7r@unreal> (raw)
In-Reply-To: <20230216160442.48394-1-edward.cree@amd.com>
On Thu, Feb 16, 2023 at 04:04:42PM +0000, edward.cree@amd.com wrote:
> From: Edward Cree <ecree.xilinx@gmail.com>
>
> EF100 can pop and/or push up to two VLAN tags.
>
> Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
> ---
> drivers/net/ethernet/sfc/mae.c | 43 ++++++++++++++++++++++++++
> drivers/net/ethernet/sfc/mcdi.h | 5 ++++
> drivers/net/ethernet/sfc/tc.c | 53 +++++++++++++++++++++++++++++++++
> drivers/net/ethernet/sfc/tc.h | 4 +++
> 4 files changed, 105 insertions(+)
>
> diff --git a/drivers/net/ethernet/sfc/mae.c b/drivers/net/ethernet/sfc/mae.c
> index 6321fd393fc3..7ae5b22af624 100644
> --- a/drivers/net/ethernet/sfc/mae.c
> +++ b/drivers/net/ethernet/sfc/mae.c
> @@ -679,9 +679,40 @@ int efx_mae_alloc_action_set(struct efx_nic *efx, struct efx_tc_action_set *act)
> {
> MCDI_DECLARE_BUF(outbuf, MC_CMD_MAE_ACTION_SET_ALLOC_OUT_LEN);
> MCDI_DECLARE_BUF(inbuf, MC_CMD_MAE_ACTION_SET_ALLOC_IN_LEN);
> + unsigned char vlan_push, vlan_pop;
> size_t outlen;
> int rc;
>
> + /* Translate vlan actions from bitmask to count */
> + switch (act->vlan_push) {
> + case 0:
> + case 1:
> + vlan_push = act->vlan_push;
> + break;
> + case 2: /* can't happen */
There is no need in case here as "default" will catch.
> + default:
> + return -EINVAL;
> + case 3:
> + vlan_push = 2;
> + break;
> + }
> + switch (act->vlan_pop) {
> + case 0:
> + case 1:
> + vlan_pop = act->vlan_pop;
> + break;
> + case 2: /* can't happen */
> + default:
> + return -EINVAL;
Please rely switch-case semantics and don't put default in the middle.
> + case 3:
> + vlan_pop = 2;
> + break;
> + }
Thanks
next prev parent reply other threads:[~2023-02-19 9:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-16 16:04 [PATCH net-next] sfc: support offloading TC VLAN push/pop actions to the MAE edward.cree
2023-02-17 9:00 ` Martin Habets
2023-02-19 9:21 ` Leon Romanovsky [this message]
2023-02-21 20:32 ` Edward Cree
2023-02-22 8:56 ` Martin Habets
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=Y/HqGyFiIMFZRT7r@unreal \
--to=leon@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=kuba@kernel.org \
--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).