Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp340828rwr; Tue, 25 Apr 2023 23:27:51 -0700 (PDT) X-Google-Smtp-Source: AKy350bTCI5yIHIN6hoSodlqyg7wdWTSzkwgPtQF1lHrMBoANP2YLKvVqNSJrDzap/LtKs1b1t0f X-Received: by 2002:a05:6a00:2281:b0:63b:6d60:9a02 with SMTP id f1-20020a056a00228100b0063b6d609a02mr28143440pfe.34.1682490471356; Tue, 25 Apr 2023 23:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682490471; cv=none; d=google.com; s=arc-20160816; b=Ce5u+QYwoqcwmviB/XVkJicXDKymEcruvy0iBjwbV4wyEdgWsgvmFd0rIxfV0mimST DCUJN5Cpe6+mZ2tu5+fOLFgIaRnRmO3lbBH70sbC1wTmPi/0ncmP9VVkOLDhWjKcfHBp 8sAevydRqGp4F4+t+XQM+NbbaXII6+LRh0W6RkDypdfh5valnrk/cFiy3dOGxIaylp8V 6ohv7psj+RZj/uU2yYkTKarGYQ/f7lg+bTdkcj6tK32EIN8qm+kLZaSBL9+lZuKjhN7a NM3InWaEypxBZABbZVahbEkDQ6X49KUJE/bYNWYtydQLbqoWXUkXSQHXGP+iT2XUCeSl huqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=DC4FEntqP+h36HU4/wOBP+tPLaCqz4WbTV4ovTQ3hW4=; b=aljLk+0by3HZ/X34HQagERfgRqA1EZAyPlZuDdtZj+RNejocRz8I3Uy26Sh6Hb4U6f eEdtZcR3GreiuT+wwbJQPEQF2tp4yO+6LJsG/kSufZIRHqcDUczTk4Ugn/XtiIwpvu9i qh4HX2WWK7HaB9Z6RNXaqybb7rYI3yGstWD/65puKVuaNtIUUx230bfCALegB9zE9uqv 27QaoHPGnuMM/m8Llonqlo0PRmOsrbgLVFgdMjILpPEaa6FVvZ6PrnjyQRqbde/wcKPH lmUA2cZciEWdAXJ5bPXiwLUBM97vCaoh90PUu6JEuY/xVyCT7O6pMHm6RrcJToD8p0bL y6NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=MuIuLzUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 15-20020a62170f000000b0063d35a949d2si15368594pfx.76.2023.04.25.23.27.35; Tue, 25 Apr 2023 23:27:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=MuIuLzUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239589AbjDZG0p (ORCPT + 99 others); Wed, 26 Apr 2023 02:26:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239572AbjDZG0b (ORCPT ); Wed, 26 Apr 2023 02:26:31 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1373270E; Tue, 25 Apr 2023 23:26:04 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33Q64BYU000622; Tue, 25 Apr 2023 23:25:56 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=DC4FEntqP+h36HU4/wOBP+tPLaCqz4WbTV4ovTQ3hW4=; b=MuIuLzUH3ZM8XrpnxR2rubwU/vwNqg2bGPgYLagYy/+zxlNSjBzpM1e0RuHK2Je2iGzX 5r6+7t4HIpND8rbaGf7yWEb1R0DSf78Lsrs8aDOUj+myWebTCKA4b4ErEhGTw5LdP9GI DYpovopzY5pPJoXs43Wlqa7LKkCi0sEuRc1Qkk1sanKzITWVPtnI020n2l5+rbttcrUD tj3CM+QpCUDjoV9n+M9pqA34Z2+ptVpIvpiZCXtLXqOHKYnRDLgZzRu5yRSBL41i3yPl AhrquRQ9aPtw/YQbMWR1uBGWaxSIbnn7BF7r1BxxIBXJumPDiCrp0n+qhTwnKygmjrjB TQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q4f3pdcwv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 25 Apr 2023 23:25:56 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 25 Apr 2023 23:25:54 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 25 Apr 2023 23:25:54 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 6E9163F7072; Tue, 25 Apr 2023 23:25:51 -0700 (PDT) From: Geetha sowjanya To: , CC: , , , , , , , , Subject: [net PATCH v2 6/9] octeontx2-pf: mcs: Match macsec ethertype along with DMAC Date: Wed, 26 Apr 2023 11:55:25 +0530 Message-ID: <20230426062528.20575-7-gakula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230426062528.20575-1-gakula@marvell.com> References: <20230426062528.20575-1-gakula@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: SpvBK4hDbPWZeoSU6fPKSrJ9clLbzaET X-Proofpoint-GUID: SpvBK4hDbPWZeoSU6fPKSrJ9clLbzaET X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-25_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Subbaraya Sundeep On CN10KB silicon a single hardware macsec block is present and offloads macsec operations for all the ethernet LMACs. TCAM match with macsec ethertype 0x88e5 alone at RX side is not sufficient to distinguish all the macsec interfaces created on top of netdevs. Hence append the DMAC of the macsec interface too. Otherwise the first created macsec interface only receives all the macsec traffic. Fixes: c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading") Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Goutham Signed-off-by: Geetha sowjanya Reviewed-by: Leon Romanovsky --- .../net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 10 +++++++++- 1 file changed, 9 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 5f4402f7b03e..f3140f466b37 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c @@ -9,6 +9,7 @@ #include #include "otx2_common.h" +#define MCS_TCAM0_MAC_DA_MASK GENMASK_ULL(47, 0) #define MCS_TCAM0_MAC_SA_MASK GENMASK_ULL(63, 48) #define MCS_TCAM1_MAC_SA_MASK GENMASK_ULL(31, 0) #define MCS_TCAM1_ETYPE_MASK GENMASK_ULL(47, 32) @@ -237,8 +238,10 @@ static int cn10k_mcs_write_rx_flowid(struct otx2_nic *pfvf, struct cn10k_mcs_rxsc *rxsc, u8 hw_secy_id) { struct macsec_rx_sc *sw_rx_sc = rxsc->sw_rxsc; + struct macsec_secy *secy = rxsc->sw_secy; struct mcs_flowid_entry_write_req *req; struct mbox *mbox = &pfvf->mbox; + u64 mac_da; int ret; mutex_lock(&mbox->lock); @@ -249,11 +252,16 @@ static int cn10k_mcs_write_rx_flowid(struct otx2_nic *pfvf, goto fail; } + mac_da = ether_addr_to_u64(secy->netdev->dev_addr); + + req->data[0] = FIELD_PREP(MCS_TCAM0_MAC_DA_MASK, mac_da); + req->mask[0] = ~0ULL; + req->mask[0] = ~MCS_TCAM0_MAC_DA_MASK; + req->data[1] = FIELD_PREP(MCS_TCAM1_ETYPE_MASK, ETH_P_MACSEC); req->mask[1] = ~0ULL; req->mask[1] &= ~MCS_TCAM1_ETYPE_MASK; - req->mask[0] = ~0ULL; req->mask[2] = ~0ULL; req->mask[3] = ~0ULL; -- 2.25.1