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 C4141A0032; Fri, 21 Oct 2022 10:05:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A834242C4F; Fri, 21 Oct 2022 10:03:09 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2109.outbound.protection.outlook.com [40.107.243.109]) by mails.dpdk.org (Postfix) with ESMTP id 131FC4281C for ; Fri, 21 Oct 2022 10:03:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TDuDJrV/SnWMUJEbKdhXc01L8TN5OCZhJlZIC19Zryn/UxirIR5M5x2OPmbnJ/084rmJT8jVBEzFJLyrZOV9RL/rotUkBJS1DNUj4tGoRw9sHb+cyad0HNa3mnU1Q4aq0L3Kq1HMoTtl6YGUF01Kja/hXmCb30ScLiQqbMlu1xg3Q8PoWqBbpitKIHhhjmSuv8GHc5G6N1hMRLvzvZ2FwTZmtXhCF3qGKZxyCs1nL+kY4RN+9EoYnjGJ0CgfX0JRxHSQtSuJNwgUlg17FQcerXaJsoIqICUAl+TSaQfQL7uFGBWMcEiVZO7w4vEa/NK64eebfhVT6zSn8D6Wgl7L4Q== 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=RlDXbvH+MNc+ShLtZ+xUiqFUBBjBUYKOW3llMO0PIt0=; b=aLAZifLXKxNxitCKl1Xbnx3bNAsVkuFrVFJ7lMTu8vhYUNlExMwugvWSPztl9eI5R7ABqY8XG20huuBiWx2W3R83KfK9xR2gwHeDgdtQi7k82zQIFBnwPmINgoQV1JcfwXh3rFcn1zcOT1uW5ctXkVEM00hOgYBvGzssc8KPofQTWrNMXUjKBAX0jBh3bP+IRqebqcTBH4anf1k/MV468kYCVxVF1hayDwy2zGrxb3mWlmJKrv/cOCiqqtS47bHtxgzVAReDnH4dnGEm326Nx+7XX75jGJ65UH3eCs5IwliLIKqyP4bS64URU4wvi7gie6+1bjRC4CyiA+rrrqA2TA== 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=RlDXbvH+MNc+ShLtZ+xUiqFUBBjBUYKOW3llMO0PIt0=; b=fEvDoqGYDSr9GTJ4MeegkoyFNKcjTyDEtFdUxKUbY3OaIOWgi/+R+B3w9A83iHzquMdQXBQUG9TkKMqxDGeHt4x59n2M2N5luQbmK6fFrxRgB7GOSDOVhEcybOa0B0i+NE3gBKEJZuQCwSaQw0U3DCBQ1Yqr+LxYAYuuAdpPMtk= 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 BL3PR13MB5162.namprd13.prod.outlook.com (2603:10b6:208:339::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.17; Fri, 21 Oct 2022 08:03:03 +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; Fri, 21 Oct 2022 08:03:03 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v6 21/27] net/nfp: support SRC IPv6 flow action Date: Fri, 21 Oct 2022 16:01:57 +0800 Message-Id: <1666339323-24016-22-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666339323-24016-1-git-send-email-chaoyong.he@corigine.com> References: <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> <1666339323-24016-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_|BL3PR13MB5162:EE_ X-MS-Office365-Filtering-Correlation-Id: d060daf6-a49e-4deb-5b2b-08dab33aaddb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TOcQXryjARkdmj1Z5CLO3/LWdt8oLvSjoLkyJhNcdg35Uo+jqgClzteXxz2/2SG4T8Xgvjn/V7Lx8sCTgFwcY40tu5VgQGKEf4+FPFEesKXNF44xo/0yJ2gsZ3Gi3SmWRLm4/lf+NrnE2hT4LQgvnJYxkUBu8x2i1m9I+5549IZ+aDobIGKxTMgqbeIFpY9CzLdH4Q9U1h06b5x5ACjqY5DovQK3P9p7TmYLP/QL8Z390qGSSssed3tMom7yzSB7yMstCHObC0IuGMJe/q/QkZFivueBb4nutPQwgR6kJr845MvUNYHFXGIUYgjf8X05ikxLuvy4lToaEGYvTrZA/K/VmdKzNkCgM+SFTwMMimWGSvgEfSvtTE5h4AIwdLPHisJNHkK6RAurof3ojTrdw/WMndGNzlu7SMFrawU/eyymkLw6znEKXpOMDnqyG/l/gbqHBbkBzg5zmxEx+KC92zGljXJdAGOVqr0Po4YXuHdTVa5lqvRZzi6MMLku74FmY42EnPf6kGzdgNB1LYHDy2s/G7z2NcRLQrsvow85Xjqw5dVhei8KOxcoaLObXRGo//CNGQAm4LbUwE8SSQJuPfpD5MTuJhrXS8ITxNzGw+CHRYWPz5Wmsewkb7p1dxOh2evAW3yxOJFrxc/9GQtTEdPyBmJ4c06eUR7JfijU6y6QivApHcN7lDW7I0EHcXqokI4gCUh9l9aMrwvEDg9sjBRvoKRRui6cnHC3zxlSWBAG30pNpV7O0y6MmJt9kRk7+xzPxSDabBODsbpzOCaDlw== 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)(376002)(396003)(346002)(136003)(39840400004)(366004)(451199015)(2616005)(6916009)(38350700002)(6512007)(6506007)(52116002)(8936002)(66946007)(4326008)(186003)(107886003)(8676002)(41300700001)(2906002)(66556008)(316002)(66476007)(38100700002)(44832011)(26005)(5660300002)(6666004)(83380400001)(478600001)(6486002)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MVJBRGRMdVo3K3pTaWtyOHB4T1hoeVZMUG1yYjVGczVFNnRlcEt3Nm5DNE5E?= =?utf-8?B?cjhkZ3hGWHY3V0pPN0lhTWIxQStsZWhXZGwvNUlOUTRlNWljL25nbkJydmNM?= =?utf-8?B?ek1NTjd2aWhFMzFOMjRUZjRmVDJhaEZzVHF1aENTU054d2pnYkpUZG5vVDdO?= =?utf-8?B?ZHlDeXh3bVZVMFdrcWtEWUZjeTk3SUZ6ajl3VnMveUVkQmRKWkZIeTBLblhI?= =?utf-8?B?S2RrRmRnOU1NRnl3WWhseVZlQmFic0hMUjNaVU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utf-8?B?N2RFNXREVk5XWlkzN1dDWU5leFRBMTdYMkVTRU9USzJCcWR5U0hRUlhPUk5j?= =?utf-8?B?S1VCRXdEbXBDcHJPL0Jqa3hkSy9meGdRV0NOWktVaFFqZkdVMXRrQjQyL1N4?= =?utf-8?B?SHc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d060daf6-a49e-4deb-5b2b-08dab33aaddb X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 08:03:03.5467 (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: 0J1thmYvx4yC6C4q8YA981fpoywF9GkiT5OeUODR8KQz2BqYAvmr4SZL3L51uvsat3Ugw4tkNeavbQKKVXt6J9lHEBQS6xG2QSxkG7jVSVI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR13MB5162 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 ddc457f..b17c701 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -46,5 +46,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 2b39d39..6821e29 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -631,6 +631,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; @@ -1322,6 +1326,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) @@ -1450,6 +1480,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