netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net v2] octeontx2-pf: macsec: Fix incorrect max transmit size in TX secy
@ 2025-05-12 12:42 Subbaraya Sundeep
  2025-05-13 13:19 ` Simon Horman
  2025-05-15  2:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Subbaraya Sundeep @ 2025-05-12 12:42 UTC (permalink / raw)
  To: andrew+netdev, davem, edumazet, kuba, pabeni, horms, gakula,
	hkelam, sgoutham, lcherian, bbhushan2, jerinj, sd
  Cc: netdev, Subbaraya Sundeep

MASCEC hardware block has a field called maximum transmit size for
TX secy. Max packet size going out of MCS block has be programmed
taking into account full packet size which has L2 header,SecTag
and ICV. MACSEC offload driver is configuring max transmit size as
macsec interface MTU which is incorrect. Say with 1500 MTU of real
device, macsec interface created on top of real device will have MTU of
1468(1500 - (SecTag + ICV)). This is causing packets from macsec
interface of size greater than or equal to 1468 are not getting
transmitted out because driver programmed max transmit size as 1468
instead of 1514(1500 + ETH_HDR_LEN).

Fixes: c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading")
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
---
v2 changes:
 Modified commit description and added subject prefix as net.

 drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c
index f3b9daf..4c7e0f3 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c
@@ -531,7 +531,8 @@ static int cn10k_mcs_write_tx_secy(struct otx2_nic *pfvf,
 	if (sw_tx_sc->encrypt)
 		sectag_tci |= (MCS_TCI_E | MCS_TCI_C);
 
-	policy = FIELD_PREP(MCS_TX_SECY_PLCY_MTU, secy->netdev->mtu);
+	policy = FIELD_PREP(MCS_TX_SECY_PLCY_MTU,
+			    pfvf->netdev->mtu + OTX2_ETH_HLEN);
 	/* Write SecTag excluding AN bits(1..0) */
 	policy |= FIELD_PREP(MCS_TX_SECY_PLCY_ST_TCI, sectag_tci >> 2);
 	policy |= FIELD_PREP(MCS_TX_SECY_PLCY_ST_OFFSET, tag_offset);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [net v2] octeontx2-pf: macsec: Fix incorrect max transmit size in TX secy
  2025-05-12 12:42 [net v2] octeontx2-pf: macsec: Fix incorrect max transmit size in TX secy Subbaraya Sundeep
@ 2025-05-13 13:19 ` Simon Horman
  2025-05-15  2:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-05-13 13:19 UTC (permalink / raw)
  To: Subbaraya Sundeep
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, gakula, hkelam,
	sgoutham, lcherian, bbhushan2, jerinj, sd, netdev

On Mon, May 12, 2025 at 06:12:36PM +0530, Subbaraya Sundeep wrote:
> MASCEC hardware block has a field called maximum transmit size for
> TX secy. Max packet size going out of MCS block has be programmed
> taking into account full packet size which has L2 header,SecTag
> and ICV. MACSEC offload driver is configuring max transmit size as
> macsec interface MTU which is incorrect. Say with 1500 MTU of real
> device, macsec interface created on top of real device will have MTU of
> 1468(1500 - (SecTag + ICV)). This is causing packets from macsec
> interface of size greater than or equal to 1468 are not getting
> transmitted out because driver programmed max transmit size as 1468
> instead of 1514(1500 + ETH_HDR_LEN).
> 
> Fixes: c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading")
> Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>

Thanks, I see that OTX2_ETH_HLEN is already taken into account in several
places including otx2_hw_set_mtu() and otx2_get_max_mtu(). So I agree with
this change.

Reviewed-by: Simon Horman <horms@kernel.org>

...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net v2] octeontx2-pf: macsec: Fix incorrect max transmit size in TX secy
  2025-05-12 12:42 [net v2] octeontx2-pf: macsec: Fix incorrect max transmit size in TX secy Subbaraya Sundeep
  2025-05-13 13:19 ` Simon Horman
@ 2025-05-15  2:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-15  2:40 UTC (permalink / raw)
  To: Subbaraya Sundeep
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, horms, gakula,
	hkelam, sgoutham, lcherian, bbhushan2, jerinj, sd, netdev

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 12 May 2025 18:12:36 +0530 you wrote:
> MASCEC hardware block has a field called maximum transmit size for
> TX secy. Max packet size going out of MCS block has be programmed
> taking into account full packet size which has L2 header,SecTag
> and ICV. MACSEC offload driver is configuring max transmit size as
> macsec interface MTU which is incorrect. Say with 1500 MTU of real
> device, macsec interface created on top of real device will have MTU of
> 1468(1500 - (SecTag + ICV)). This is causing packets from macsec
> interface of size greater than or equal to 1468 are not getting
> transmitted out because driver programmed max transmit size as 1468
> instead of 1514(1500 + ETH_HDR_LEN).
> 
> [...]

Here is the summary with links:
  - [net,v2] octeontx2-pf: macsec: Fix incorrect max transmit size in TX secy
    https://git.kernel.org/netdev/net/c/865ab2461375

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-15  2:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-12 12:42 [net v2] octeontx2-pf: macsec: Fix incorrect max transmit size in TX secy Subbaraya Sundeep
2025-05-13 13:19 ` Simon Horman
2025-05-15  2:40 ` patchwork-bot+netdevbpf

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).