From patchwork Fri May 31 16:14:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Russkikh X-Patchwork-Id: 53966 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8BD821B9B9; Fri, 31 May 2019 18:14:58 +0200 (CEST) Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-eopbgr780078.outbound.protection.outlook.com [40.107.78.78]) by dpdk.org (Postfix) with ESMTP id EBE6F1B9B6 for ; Fri, 31 May 2019 18:14:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=AQUANTIA1COM.onmicrosoft.com; s=selector1-AQUANTIA1COM-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PAmnaL6Vss8fGGBku9dfpcC8QD6hIQJe27w2vzc7a3M=; b=FGVEvB5zKSctbzbVrUpNPPamXcJs/kj3R/RxUe0WUouPhXLNsEE8i4o9dnuuCk+tnZWhSoZL3PXlNvyhJ2Me0H711SokVCnHY5akyv89yxZShPuaPpDyTylUrs8bqibj5b5OgHuHsLo2W7NV7EwiWFsJnYxuBvWHIcIIMOHZJ68= Received: from MWHPR11MB1968.namprd11.prod.outlook.com (10.175.54.143) by MWHPR11MB1262.namprd11.prod.outlook.com (10.169.236.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.23; Fri, 31 May 2019 16:14:56 +0000 Received: from MWHPR11MB1968.namprd11.prod.outlook.com ([fe80::fd20:d79e:4027:a437]) by MWHPR11MB1968.namprd11.prod.outlook.com ([fe80::fd20:d79e:4027:a437%3]) with mapi id 15.20.1943.016; Fri, 31 May 2019 16:14:56 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Pavel Belous , John McNamara , Konstantin Ananyev , Thomas Monjalon , Akhil Goyal , Declan Doherty , Igor Russkikh Thread-Topic: [RFC 4/5] app/testpmd: macsec: update set sc command with new interface Thread-Index: AQHVF8v8tsAAKK4XVE2geRTQTNJjQQ== Date: Fri, 31 May 2019 16:14:56 +0000 Message-ID: <9ce5237e4ad0bf1e163d47323027277afb31457d.1559319237.git.igor.russkikh@aquantia.com> References: <4595add642bf8ca1114488657d12a973b966e8f5.1559319237.git.igor.russkikh@aquantia.com> In-Reply-To: <4595add642bf8ca1114488657d12a973b966e8f5.1559319237.git.igor.russkikh@aquantia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0401CA0056.eurprd04.prod.outlook.com (2603:10a6:3:19::24) To MWHPR11MB1968.namprd11.prod.outlook.com (2603:10b6:300:111::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [95.79.108.179] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1886dc6b-51f1-4fe9-8ad7-08d6e5e31ec3 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:MWHPR11MB1262; x-ms-traffictypediagnostic: MWHPR11MB1262: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:267; x-forefront-prvs: 00540983E2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39850400004)(366004)(346002)(376002)(189003)(199004)(256004)(14444005)(50226002)(66946007)(81166006)(8676002)(11346002)(44832011)(81156014)(14454004)(7736002)(478600001)(72206003)(5660300002)(1730700003)(476003)(2351001)(76176011)(2616005)(26005)(66446008)(71200400001)(186003)(73956011)(71190400001)(68736007)(66556008)(66476007)(64756008)(118296001)(2501003)(25786009)(99286004)(6916009)(305945005)(6116002)(6436002)(4326008)(5640700003)(6512007)(3846002)(102836004)(52116002)(36756003)(2906002)(8936002)(446003)(86362001)(6506007)(54906003)(316002)(107886003)(66066001)(386003)(53936002)(6486002)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR11MB1262; H:MWHPR11MB1968.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 2AuKKVj289ETDJS3KXetaKAxbkO8YbhPV605Qvmzv+EB4Nqm0Zb+1N4lFAMwa+hZ7PYX7wvv070i3S6bn7CHMYwLDMrjdGZZTr0Y9HDCXCLRbGFnwXnaKHv6TjVBNEXTGMrmRZL/DdNGTEPIA8MC9+NyrTRuRmdItBqcre+rseZoyr2t+eRQiLwK71AsttLarlYVEKle8MD7aeEGtBY7AbhNKkQlvNJ+pcQATk6oAO6b12hG+6jVIkwJCGH4uB8Kr8GR5sPcLb9v4dkcMrrxe68YZJ+YPC2AoS2iJBAeF5iCBn4F0U3hiRtilabNGOmeeY0mN4UVpF48LziAC2W25jFWK5irCrLt78Jd+jm1oBsAlwyqgRCPmYl6aFKfMoVQ7PqB4yFNTodvnEpWAPXEgyDED9PhhiqpoXS7VXpXmfQ= MIME-Version: 1.0 X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1886dc6b-51f1-4fe9-8ad7-08d6e5e31ec3 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 May 2019 16:14:56.2958 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: irusski@aquantia.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1262 Subject: [dpdk-dev] [RFC 4/5] app/testpmd: macsec: update set sc command with new interface X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" --- app/test-pmd/cmdline.c | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index af7c2853fd2c..1bcf63e31ee3 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -14083,6 +14083,7 @@ cmd_set_macsec_offload_on_parsed( macsec_conf.action_type = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL; macsec_conf.protocol = RTE_SECURITY_PROTOCOL_MACSEC; + macsec_conf.macsec. /** should be moved to SC properties */ macsec_encrypt = en; macsec_replay_protection = rp; @@ -14280,15 +14281,38 @@ cmd_set_macsec_sc_parsed( struct cmd_macsec_sc_result *res = parsed_result; int ret = -ENOTSUP; int is_tx = (strcmp(res->tx_rx, "tx") == 0) ? 1 : 0; + struct rte_security_ctx *ctx; + struct rte_eth_dev_info dev_info; + struct rte_security_session_conf conf = {}; -#ifdef RTE_LIBRTE_IXGBE_PMD - ret = is_tx ? - rte_pmd_ixgbe_macsec_config_txsc(res->port_id, - res->mac.addr_bytes) : - rte_pmd_ixgbe_macsec_config_rxsc(res->port_id, - res->mac.addr_bytes, res->pi); -#endif - RTE_SET_USED(is_tx); + ctx = rte_eth_dev_get_sec_ctx(port_id); + if (!ctx) { + ret = ENOTSUP; + goto done; + } + + if (is_tx) { + conf.macsec.op = RTE_SECURITY_MACSEC_OP_ADD_TXSC; + + rte_memcpy(&conf.macsec.txsc_options.s_mac, res->mac.addr_bytes, + sizeof(struct ether_addr)); + conf.macsec.txsc_options.encrypt = macsec_encrypt; + conf.macsec.txsc_options.protect = 1; + + ret = rte_security_session_update(ctx, macsec_session, &conf); + } else { + conf.macsec.op = RTE_SECURITY_MACSEC_OP_ADD_RXSC; + + rte_memcpy(&conf.macsec.rxsc_options.s_mac, res->mac.addr_bytes, + sizeof(struct ether_addr)); + /* Default */ + conf.macsec.rxsc_options.anti_replay_window = 0; + conf.macsec.rxsc_options.replay_protection = macsec_replay_protection; + conf.macsec.rxsc_options.auto_rollover_enabled = true; + + ret = rte_security_session_update(ctx, macsec_session, &conf); + + } switch (ret) { case 0: