From: Simon Horman <horms@kernel.org>
To: "Radu Pirea (NXP OSS)" <radu-nicolae.pirea@oss.nxp.com>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, richardcochran@gmail.com, sd@queasysnail.net,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC net-next v1 3/5] net: phy: nxp-c45-tja11xx add MACsec support
Date: Sat, 12 Aug 2023 20:01:54 +0200 [thread overview]
Message-ID: <ZNfJEj0jiTR0ZAbK@vergenet.net> (raw)
In-Reply-To: <20230811153249.283984-4-radu-nicolae.pirea@oss.nxp.com>
On Fri, Aug 11, 2023 at 06:32:47PM +0300, Radu Pirea (NXP OSS) wrote:
> Add MACsec support.
>
> Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>
Hi Radu,
thanks for your patch-set.
Some minor feedback from my side.
...
> diff --git a/drivers/net/phy/nxp-c45-tja11xx-macsec.c b/drivers/net/phy/nxp-c45-tja11xx-macsec.c
...
> +static int nxp_c45_tx_sc_set_flt(struct macsec_context *ctx, int secy_id)
> +{
> + u32 tx_flt_base = TX_FLT_BASE(secy_id);
> + const u8 *dev_addr = ctx->secy->netdev->dev_addr;
> + u32 mac_sa;
nit: Please use reverse xmas tree - longest line to shortest
ordering for local variable declarations in Networking code.
https://github.com/ecree-solarflare/xmastree is your friend here.
> +
> + mac_sa = dev_addr[0] << 8 | dev_addr[1];
> + nxp_c45_macsec_write(ctx->phydev,
> + TX_SC_FLT_MAC_DA_SA(tx_flt_base),
> + mac_sa);
> + mac_sa = dev_addr[5] | dev_addr[4] << 8 |
> + dev_addr[3] << 16 | dev_addr[2] << 24;
> +
> + nxp_c45_macsec_write(ctx->phydev,
> + TX_SC_FLT_MAC_SA(tx_flt_base),
> + mac_sa);
> + nxp_c45_macsec_write(ctx->phydev,
> + TX_SC_FLT_MAC_CFG(tx_flt_base),
> + TX_SC_FLT_BY_SA | TX_SC_FLT_EN |
> + secy_id);
> +
> + return 0;
> +}
> +
> +static bool nxp_c45_port_valid(struct nxp_c45_secy *phy_secy, u16 port)
> +{
> + if (phy_secy->secy->tx_sc.end_station && __be16_to_cpu(port) != 1)
The type of port is host byte order, but it is assumed to be big endian
by passing it to __be16_to_cpu(). Also, it's probably more efficient
to convert the constant (1).
There are a number of other Sparse warnings introduced by this patch.
Please take a look over them (and ideally fix them).
> + return false;
> +
> + return true;
> +}
...
> +static int nxp_c45_mdo_upd_secy(struct macsec_context *ctx)
> +{
> + struct phy_device *phydev = ctx->phydev;
> + struct nxp_c45_phy *priv = phydev->priv;
> + struct nxp_c45_tx_sa *new_tx_sa, *old_tx_sa;
nit: reverse xmas tree
...
next prev parent reply other threads:[~2023-08-12 18:02 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 15:32 [RFC net-next v1 0/5] Add MACsec support for TJA11XX C45 PHYs Radu Pirea (NXP OSS)
2023-08-11 15:32 ` [RFC net-next v1 1/5] net: macsec: declare macsec_pn_wrapped shim Radu Pirea (NXP OSS)
2023-08-11 15:32 ` [RFC net-next v1 2/5] net: phy: remove MACSEC guard Radu Pirea (NXP OSS)
2023-08-11 16:59 ` Andrew Lunn
2023-08-14 15:35 ` Sabrina Dubroca
2023-08-14 15:50 ` Andrew Lunn
2023-08-11 15:32 ` [RFC net-next v1 3/5] net: phy: nxp-c45-tja11xx add MACsec support Radu Pirea (NXP OSS)
2023-08-11 17:10 ` Andrew Lunn
2023-08-16 8:18 ` Radu Pirea (OSS)
2023-08-12 18:01 ` Simon Horman [this message]
2023-08-11 15:32 ` [RFC net-next v1 4/5] net: macsec: introduce mdo_insert_tx_tag Radu Pirea (NXP OSS)
2023-08-11 17:42 ` Andrew Lunn
2023-08-16 10:12 ` Radu Pirea (OSS)
2023-08-12 18:07 ` Simon Horman
2023-08-16 10:19 ` Radu Pirea (OSS)
2023-08-16 20:40 ` Sabrina Dubroca
2023-08-17 8:25 ` Radu Pirea (OSS)
2023-08-17 10:31 ` Sabrina Dubroca
2023-08-17 11:19 ` Radu Pirea (OSS)
2023-08-11 15:32 ` [RFC net-next v1 5/5] net: phy: nxp-c45-tja11xx: implement mdo_insert_tx_tag Radu Pirea (NXP OSS)
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=ZNfJEj0jiTR0ZAbK@vergenet.net \
--to=horms@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=radu-nicolae.pirea@oss.nxp.com \
--cc=richardcochran@gmail.com \
--cc=sd@queasysnail.net \
/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
all inboxes | Powered by JetHome®