]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
octeontx2-pf: macsec: Fix incorrect max transmit size in TX secy
authorSubbaraya Sundeep <sbhatta@marvell.com>
Mon, 12 May 2025 12:42:36 +0000 (18:12 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 May 2025 12:12:17 +0000 (14:12 +0200)
[ Upstream commit 865ab2461375e3a5a2526f91f9a9f17b8931bc9e ]

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>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/1747053756-4529-1-git-send-email-sbhatta@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c

index 6cc7a78968fc1c063a283a848ae5f8b886a19cca..74953f67a2bf9c96dce344e509b57387f834b69b 100644 (file)
@@ -533,7 +533,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);