From: "Radu Pirea (OSS)" <radu-nicolae.pirea@oss.nxp.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Sabrina Dubroca <sd@queasysnail.net>,
hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
richardcochran@gmail.com, sebastian.tobuschat@nxp.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC net-next v2 3/5] net: phy: nxp-c45-tja11xx add MACsec support
Date: Fri, 25 Aug 2023 17:12:14 +0300 [thread overview]
Message-ID: <d770a31a-dafe-e833-3a18-36e32e63a62e@oss.nxp.com> (raw)
In-Reply-To: <e2e26d30-86fb-4005-9a0e-ac9b793df86a@lunn.ch>
On 25.08.2023 16:50, Andrew Lunn wrote:
>>>>> +static bool nxp_c45_rx_sc_valid(struct nxp_c45_secy *phy_secy,
>>>>> + struct macsec_rx_sc *rx_sc)
>>>>> +{
>>>>> + u16 port = (__force u64)rx_sc->sci >> (ETH_ALEN * 8);
>>>>
>>>> u64 sci = be64_to_cpu((__force __be64)rx_sc->sci);
>>>
>>> why is the __force needed? What happens with a normal cast?
>>>
>>
>> Sparse will print warnings if __force is missing.
>
> What is the warning? I just want to make sure __force is the correct
> solution, not that something has the wrong type and we should be
> fixing a design issue.
Let's consider the following example:
Function declaration:
static int nxp_c45_macsec_write(struct phy_device *phydev, u16 reg,
u32 val)
Call without __force:
nxp_c45_macsec_write(ctx->phydev, sa_regs->txsa_ssci,
(u32)cpu_to_be32(ssci));
Warning:
drivers/net/phy/nxp-c45-tja11xx-macsec.c:803:39: warning: cast from
restricted __be32
Even if I will write another function that takes an __be32 as parameter,
I will need to silent sparse for phy_write_mmd calls.
And in the following example will cry because of sci_t to __be64 conversion:
u64 sci = be64_to_cpu((__force __be64)rx_sc->sci);
> Andrew
>
--
Radu P.
next prev parent reply other threads:[~2023-08-25 14:14 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 9:16 [RFC net-next v2 0/5] Add MACsec support for TJA11XX C45 PHYs Radu Pirea (NXP OSS)
2023-08-24 9:16 ` [RFC net-next v2 1/5] net: macsec: documentation for macsec_context and macsec_ops Radu Pirea (NXP OSS)
2023-08-24 13:26 ` Antoine Tenart
2023-08-24 9:16 ` [RFC net-next v2 2/5] net: macsec: introduce mdo_insert_tx_tag Radu Pirea (NXP OSS)
2023-08-24 14:54 ` Sabrina Dubroca
2023-08-25 10:01 ` Radu Pirea (OSS)
2023-08-24 9:16 ` [RFC net-next v2 3/5] net: phy: nxp-c45-tja11xx add MACsec support Radu Pirea (NXP OSS)
2023-08-25 12:52 ` Sabrina Dubroca
2023-08-25 13:29 ` Andrew Lunn
2023-08-25 13:44 ` Radu Pirea (OSS)
2023-08-25 13:50 ` Andrew Lunn
2023-08-25 14:12 ` Radu Pirea (OSS) [this message]
2023-08-30 12:06 ` Russell King (Oracle)
2023-08-28 10:43 ` Sabrina Dubroca
2023-08-27 8:03 ` Simon Horman
2023-08-24 9:16 ` [RFC net-next v2 4/5] net: phy: nxp-c45-tja11xx: add MACsec statistics Radu Pirea (NXP OSS)
2023-08-25 13:41 ` Sabrina Dubroca
2023-08-25 14:22 ` Radu Pirea (OSS)
2023-08-24 9:16 ` [RFC net-next v2 5/5] net: phy: nxp-c45-tja11xx: implement mdo_insert_tx_tag Radu Pirea (NXP OSS)
2023-08-27 8:05 ` Simon Horman
2023-08-28 10:17 ` Sabrina Dubroca
2023-08-28 13:46 ` Radu Pirea (OSS)
2023-08-30 11:35 ` Sabrina Dubroca
2023-09-01 9:09 ` Radu Pirea
2023-09-01 9:27 ` Russell King (Oracle)
2023-09-01 11:31 ` Radu Pirea (OSS)
2023-09-01 12:45 ` Russell King (Oracle)
2023-09-01 10:07 ` Sabrina Dubroca
2023-09-01 10:32 ` Russell King (Oracle)
2023-09-01 13:56 ` Sabrina Dubroca
2023-09-01 11:58 ` Radu Pirea (OSS)
2023-09-01 13:57 ` Sabrina Dubroca
2023-09-01 14:22 ` Radu Pirea (OSS)
2023-09-01 15:37 ` Sabrina Dubroca
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=d770a31a-dafe-e833-3a18-36e32e63a62e@oss.nxp.com \
--to=radu-nicolae.pirea@oss.nxp.com \
--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=richardcochran@gmail.com \
--cc=sd@queasysnail.net \
--cc=sebastian.tobuschat@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
all inboxes | Powered by JetHome®