From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C205BA0544; Mon, 10 Oct 2022 08:11:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 22B0642BBA; Mon, 10 Oct 2022 08:09:59 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id AE66B4021E for ; Mon, 10 Oct 2022 08:09:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ho9Ene7mPkr0DdNWCJ3WGRTjXGUHs140j+pXOOVmIdParECFo1N0nwwb6pBJuX5C9PylK9q/jUyDsqyn6bS5DMWfAPKbEZ5+25JBNLDgthZHRBy8eZOFCd8NgXYA4BvEfIGBR9WXIlKm/oheFwjZwF6a25swgigoo74pP+ByupDOYD5nQBC6nHELtDzIPFUlnk6qi7HFSCgW9QjEogttVSkACBU8d5kkSUAq/aoMQSnNesAAl1SphkUHub1Kyz1gKMs1KYFulJbuOduDrNN51w1kVLEljDHWSSXdvAC996MY+atUKaHVmvm1ouASZcA1i2pVJIMQrX7W3ebQBLjifA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LK0mfFjKNY62vGZvkMwwPdNmShEa43kdgeWTkadfSAY=; b=Ky4h4qfKF3MRCulRAboR1sMrm9gsxtOfP6eKDk7ZKcbSY0m45XnFYz8p/4QcYabjeNScGGVEIBt+wf94cFxMer81IEjCRI6QGh+HOO462Qz6qAeggForwrpBuNv8D0+22S/lloDSZfYQopa2BkOycDOn7aOXaVXy+ctX5o4Rbvu7jy5kytjwFFlo6fLl3osh76ySXaw8YBdoebBjbRTTBfqpeitt3lhRx6B60wZ41/ZrMAWzIoA1tqEg4As9IuMq7sJmgy8ne5c1CyqZH1ZG6N9yt0q9GgvtI2/qt1JB3XBKjzBP0sUVP6eKFDjhs3Bysq7v8lZ4wITb2vumeTHizQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LK0mfFjKNY62vGZvkMwwPdNmShEa43kdgeWTkadfSAY=; b=tOk1rlrEemmHVP3EUR/VDFmGk27PuP6/GAUFgo73yDZokBf6GWrbPFxh5ukcipkYkb5N9lgI0ht+3MmEY+80RmKdlsxmBJZsZ1ThDDA1xVqCrBroRFSZfq22A8U5bOZTxCBhJAt53om93ZiNa5QOckYBCAllRU2KU6gN5zzblnc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by CH2PR13MB3877.namprd13.prod.outlook.com (2603:10b6:610:91::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.14; Mon, 10 Oct 2022 06:09:55 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b%4]) with mapi id 15.20.5723.014; Mon, 10 Oct 2022 06:09:55 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v2 18/24] net/nfp: add the offload support of set SRC IPv6 action Date: Mon, 10 Oct 2022 14:08:56 +0800 Message-Id: <1665382142-21684-19-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1665382142-21684-1-git-send-email-chaoyong.he@corigine.com> References: <1665382142-21684-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0051.apcprd01.prod.exchangelabs.com (2603:1096:4:193::6) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH2PR13MB3877:EE_ X-MS-Office365-Filtering-Correlation-Id: c3e6392b-6a19-4332-806e-08daaa860d6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5kAmK05pPnmjx3vcF2/A1f8ueIQyTuW6p8pywPET3rO/Wr8SnSs3XNSSALCfBkmDJQaie0RrKDIc4e0DzIyVInt/5P/RFeyC9UXh3Dq8EOIbyO0AmiU6JwbJ+2962qL1/4OMOWIs8oATGBz1RypI9XUSw0+213qxQwdWegqdceBX0DzSFedUN6kOARsEBuaOtOPtBwhnczz5PphAwDdme7KdsO9kPpVt9SOsiaix+exdX/hxrsftBdUZ0OkQoKhL2072w6WlWvKzJTazEsE/EyC+gZ1wiw5Cl99HPesFHshql6IXnJhEOAuzn6de4acm2cfDwJ6fqCWVZ+884QMWZOzbhkB+akz/yWMQsdIyBfeHFOVvDTZwkUE4V+xuA9sDfAvc9etw58mNCmer9V5MK8eoihDmKkdBi4/aA4Fr8NM738R0flO+8H3LIScczcXN3XnHayKfOBCJRoTaF4iuJMGeCOwWMNc5raUPk1OzkcGJDw4QRVYovKSwZtostBXeTFyeSM0jlnyjulZPX+TsoQ0AaJQJA1enZ1A1LGPdhfr2HWvavgb4bgFSzLPJEtJ9Swz6VPA8lyH+HrpPk2ZB+WiNpjMKHI4+qZ1s9CV2Ky3xvdNYN6xQk7fXrsj4+y3ZZPwPRJ6Krw1Qvenlzasgwu9515AQnWXXcWFSvTP+9e0x7LIfRdQfJPit0yMwwJsG5gBv7VILrzet3n0eVJtzfA6ieeFyb32+QCURTEZFWUnam3KQXR7xM2w60MkomWwnreSWkqHJEQlusca/dvpn18F4zDKFXgTpq7eQmW90mATHyVv4+uhmNGJF2R9ySiZR X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(366004)(39830400003)(346002)(396003)(451199015)(36756003)(4326008)(2906002)(8936002)(44832011)(5660300002)(41300700001)(83380400001)(52116002)(2616005)(107886003)(26005)(6512007)(86362001)(8676002)(66476007)(66556008)(6486002)(478600001)(6916009)(66946007)(316002)(6506007)(38350700002)(186003)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N1hZc25DdWswWjYxUUVUdEs0VVpRTzFVeldJTnJySnZKOTQ3Q0NJdXVQK3R4?= =?utf-8?B?WkJZRHJQdWxCUTkvNW53QVNibnRCV203aG5hdC9MVXczTlVyMG9TaUVrMzFx?= =?utf-8?B?UGJsZXpUMnVNMkFSSjQ5WW5SbFNFblc1dXBQMDlMSkpxVDRWYjlITUtxZURS?= =?utf-8?B?OE51dTRsSEJsM1lLU1pCRGlnY1ltTG8rZk9SY2J1VHF4cEFuSUZSMjJvR2NI?= =?utf-8?B?RWFPT3k4TUFDVUpCZWFXRTlsRWpZS2RXdlNORUJIR0x0ak5iTzN3K0V2Yjlh?= =?utf-8?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YxcFJGTWt4Q0dkYnZSeVpG?= =?utf-8?B?ZGQxRlA4V01rUEJSaU8xL005MmVEczdvdzhzdWJtRkJtVEFxamkvOUtoWjUy?= =?utf-8?B?VkE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3e6392b-6a19-4332-806e-08daaa860d6a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2022 06:09:55.6597 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iAvv0bsxRwULx9/R5WXztrsKNSaFn/S3ZtyFBXbSIPqx+wvQ7gk076i3BEnYoKTLvtWwrW+iAvPM/NZoNw6LabTykJYXkAyRTuFC9hAmff4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR13MB3877 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add the corresponding data structure and logics, to support the offload of set source IPv6 address action. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/flower/nfp_flower_cmsg.h | 33 ++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_flow.c | 35 ++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index 14a9c18..0c04458 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -48,5 +48,6 @@ of_set_vlan_vid = Y port_id = Y set_ipv4_dst = Y set_ipv4_src = Y +set_ipv6_src = Y set_mac_dst = Y set_mac_src = Y diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index 77cb51d..45e50dd 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -399,6 +399,39 @@ struct nfp_fl_act_set_ip4_addrs { rte_be32_t ipv4_dst; }; +/* + * IPv6 addr + * 3 2 1 + * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | - |opcode | |jump_id| - | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_127_96_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_127_96 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_95_64_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_95_64 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_63_32_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_63_32 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_31_0_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_31_0 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +struct nfp_fl_act_set_ipv6_addr { + struct nfp_fl_act_head head; + rte_be16_t reserved; + struct { + rte_be32_t mask; + rte_be32_t exact; + } ipv6[4]; +}; + int nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower); int nfp_flower_cmsg_repr_reify(struct nfp_app_fw_flower *app_fw_flower, struct nfp_flower_representor *repr); diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index aeaf1f4..1adc3dd 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -649,6 +649,10 @@ struct nfp_mask_id_entry { ip_set_flag = true; } break; + case RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC detected"); + key_ls->act_size += sizeof(struct nfp_fl_act_set_ipv6_addr); + break; default: PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type); return -ENOTSUP; @@ -1340,6 +1344,32 @@ struct nfp_mask_id_entry { set_ip->ipv4_dst = set_ipv4->ipv4_addr; } +static void +nfp_flow_action_set_ipv6(char *act_data, + const struct rte_flow_action *action, + bool ip_src_flag) +{ + int i; + size_t act_size; + struct nfp_fl_act_set_ipv6_addr *set_ip; + const struct rte_flow_action_set_ipv6 *set_ipv6; + + set_ip = (struct nfp_fl_act_set_ipv6_addr *)act_data; + set_ipv6 = (const struct rte_flow_action_set_ipv6 *)action->conf; + + if (ip_src_flag) + set_ip->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV6_SRC; + else + set_ip->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV6_DST; + + act_size = sizeof(struct nfp_fl_act_set_ipv6_addr); + set_ip->head.len_lw = act_size >> NFP_FL_LW_SIZ; + set_ip->reserved = 0; + + for (i = 0; i < 4; i++) + set_ip->ipv6[i].exact = set_ipv6->ipv6_addr[i]; +} + static int nfp_flow_action_push_vlan(char *act_data, const struct rte_flow_action *action) @@ -1474,6 +1504,11 @@ struct nfp_mask_id_entry { ip_set_flag = true; } break; + case RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC: + PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC"); + nfp_flow_action_set_ipv6(position, action, true); + position += sizeof(struct nfp_fl_act_set_ipv6_addr); + break; default: PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type); return -ENOTSUP; -- 1.8.3.1