From: Simon Horman <horms@kernel.org>
To: "Radu Pirea (NXP OSS)" <radu-nicolae.pirea@oss.nxp.com>
Cc: sd@queasysnail.net, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, andrew@lunn.ch,
hkallweit1@gmail.com, linux@armlinux.org.uk,
richardcochran@gmail.com, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, sebastian.tobuschat@oss.nxp.com
Subject: Re: [PATCH net-next v8 5/7] net: phy: nxp-c45-tja11xx: add MACsec support
Date: Sat, 4 Nov 2023 11:35:06 +0000 [thread overview]
Message-ID: <20231104113506.GA891380@kernel.org> (raw)
In-Reply-To: <20231023094327.565297-6-radu-nicolae.pirea@oss.nxp.com>
On Mon, Oct 23, 2023 at 12:43:25PM +0300, Radu Pirea (NXP OSS) wrote:
> Add MACsec support.
> The MACsec block has four TX SCs and four RX SCs. The driver supports up
> to four SecY. Each SecY with one TX SC and one RX SC.
> The RX SCs can have two keys, key A and key B, written in hardware and
> enabled at the same time.
> The TX SCs can have two keys written in hardware, but only one can be
> active at a given time.
> On TX, the SC is selected using the MAC source address. Due of this
> selection mechanism, each offloaded netdev must have a unique MAC
> address.
> On RX, the SC is selected by SCI(found in SecTAG or calculated using MAC
> SA), or using RX SC 0 as implicit.
>
> Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>
...
> +void nxp_c45_handle_macsec_interrupt(struct phy_device *phydev,
> + irqreturn_t *ret)
> +{
> + struct nxp_c45_phy *priv = phydev->priv;
> + struct nxp_c45_secy *pos, *tmp;
> + struct nxp_c45_sa *sa;
> + u8 encoding_sa;
> + int secy_id;
> + u32 reg = 0;
> +
> + if (!priv->macsec)
> + return;
> +
> + do {
> + nxp_c45_macsec_read(phydev, MACSEC_EVR, ®);
> + if (!reg)
> + return;
> +
> + secy_id = MACSEC_REG_SIZE - ffs(reg);
> + list_for_each_entry_safe(pos, tmp, &priv->macsec->secy_list,
> + list)
> + if (pos->secy_id == secy_id)
> + break;
> +
> + encoding_sa = pos->secy->tx_sc.encoding_sa;
Hi Radu,
I'm unsure if this can happen, but my understanding is that if
priv->macsec->secy_list is empty then pos will be uninitialised here.
Flagged by Coccinelle.
> + phydev_dbg(phydev, "pn_wrapped: TX SC %d, encoding_sa %u\n",
> + pos->secy_id, encoding_sa);
> +
> + sa = nxp_c45_find_sa(&pos->sa_list, TX_SA, encoding_sa);
> + if (!IS_ERR(sa))
> + macsec_pn_wrapped(pos->secy, sa->sa);
> + else
> + WARN_ON(1);
> +
> + nxp_c45_macsec_write(phydev, MACSEC_EVR,
> + TX_SC_BIT(pos->secy_id));
> + *ret = IRQ_HANDLED;
> + } while (reg);
> +}
...
next prev parent reply other threads:[~2023-11-04 11:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 9:43 [PATCH net-next v8 0/7] Add MACsec support for TJA11XX C45 PHYs Radu Pirea (NXP OSS)
2023-10-23 9:43 ` [PATCH net-next v8 1/7] net: macsec: move sci_to_cpu to macsec header Radu Pirea (NXP OSS)
2023-10-23 9:43 ` [PATCH net-next v8 2/7] net: macsec: documentation for macsec_context and macsec_ops Radu Pirea (NXP OSS)
2023-10-23 9:43 ` [PATCH net-next v8 3/7] net: macsec: revert the MAC address if mdo_upd_secy fails Radu Pirea (NXP OSS)
2023-10-23 9:43 ` [PATCH net-next v8 4/7] net: macsec: introduce mdo_insert_tx_tag Radu Pirea (NXP OSS)
2023-10-25 22:40 ` Jakub Kicinski
2023-10-23 9:43 ` [PATCH net-next v8 5/7] net: phy: nxp-c45-tja11xx: add MACsec support Radu Pirea (NXP OSS)
2023-10-26 23:02 ` kernel test robot
2023-10-27 9:37 ` Sabrina Dubroca
2023-11-08 13:50 ` Radu Pirea (OSS)
2023-11-04 11:35 ` Simon Horman [this message]
2023-11-08 10:45 ` Radu Pirea (OSS)
2023-10-23 9:43 ` [PATCH net-next v8 6/7] net: phy: nxp-c45-tja11xx: add MACsec statistics Radu Pirea (NXP OSS)
2023-10-23 9:43 ` [PATCH net-next v8 7/7] net: phy: nxp-c45-tja11xx: implement mdo_insert_tx_tag Radu Pirea (NXP OSS)
2023-10-25 16:21 ` [PATCH net-next v8 0/7] Add MACsec support for TJA11XX C45 PHYs Radu Pirea (OSS)
2023-10-25 22:18 ` Jakub Kicinski
2023-10-25 22:40 ` Jakub Kicinski
2023-10-25 22:46 ` Jakub Kicinski
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=20231104113506.GA891380@kernel.org \
--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 \
--cc=sebastian.tobuschat@oss.nxp.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).