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 482C7A0A02; Thu, 20 Oct 2022 04:22:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11CF442CBD; Thu, 20 Oct 2022 04:21:33 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2129.outbound.protection.outlook.com [40.107.237.129]) by mails.dpdk.org (Postfix) with ESMTP id E942C42C96 for ; Thu, 20 Oct 2022 04:21:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h5F0MS6dCbjshWxj43dGwDnKWx0hG1kiiYlXY0tTI3AIITLkX3U0LLAWcytFT2sukfehwK25mmuOMp6yhsi6OYBFzE0ca2TXx2gHXrejATbmbABEAfQSKyE15dibFrorJHWyJIKgd6sO0hR0nd7E9+cPySi2hQ+mDwI8OYx5c84vWC/7kcv6BbMbLLQ+bvtsEnUo8FOfF92c/PQEl16wzvfbmU62Y2AmiaVFuGdr4VejJWL/sYbP+IK9FGin2dPCf2nH/3Dq54y1HJWw1vQp7FZI5VlCGRJILqnIMxLgPHbMBKbZ5EHQv/iI4n3j5bEf5T3NWeoXIELdy4nWp8Jibw== 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=i2JeFswN7nFrTPF1g3T80MLqg9BUXZFRR7nffRpAXgE=; b=Yj58lTQg8xDLGSp+0DnWZGCnfp51XH0FbHuWmC/aWuyeUl3Mz/0grfT5MT2r/H8LFRX3JE6but2p8jogHPgjjAecXhIz5YRNWei6jjfpnqf/145dxMMSQdkUzlUNUXYhDqB1wxmBHJ/RDQWvA8L4qzJJmcQjFn6liAKd1nRDgjzr/CAjfZOWtX0Tso7ebBJ7yuGv2f0xZ4dYNSi3GC5MqxPvNi0DpFK2gqQLZcKm/IOrhylzUPKtAJD7EwZ7MoPHZViFecpKc6WUb7BeADBvwnIwAoBm8YfEaEyYPYWScJVJuSv69oikVGjyRuNgMty2LZnYektlFRV4fxLwHDMkaQ== 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=i2JeFswN7nFrTPF1g3T80MLqg9BUXZFRR7nffRpAXgE=; b=tHnZs79lA5RlqU/Ik5rL7pEkwvvFbIkUKgwyydbO3O8XRvZGscX52JuMf3ZDWOMVfbFDkSsuOgTTv9LlDn2p35f3BgUkNEeA57W0NtJViiOG5ru86wrh/19zxc/h9GWK4wp9fLmvYLWHDjrGaAy2TNMCaP8ORHfn7naxt0T0F2c= 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 CO3PR13MB5784.namprd13.prod.outlook.com (2603:10b6:303:167::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Thu, 20 Oct 2022 02:21:27 +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; Thu, 20 Oct 2022 02:21:27 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v5 16/25] net/nfp: support push VLAN flow action Date: Thu, 20 Oct 2022 10:19:42 +0800 Message-Id: <1666232391-29152-17-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> References: <1666092434-10357-1-git-send-email-chaoyong.he@corigine.com> <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR02CA0048.apcprd02.prod.outlook.com (2603:1096:4:196::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CO3PR13MB5784:EE_ X-MS-Office365-Filtering-Correlation-Id: a724d64c-83f5-4bdd-3e8e-08dab241ca7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EvifE+0cQV80pCq5rDwFBmVn1vAueOtImPu5Cv3uWBveZvxOhw1AvpE8cK52mjTMErV2H7IosGRfmcfVHTOEKWlPzP1QQt/zQVgtGZBzdaxhL7IaDNbF2Gwg7hRKOs2erPKc/SOwXnMjoLoWNaffSYTTvc74YLc7MyE1dOri/JQDcMaaGZZDtyAesUY7/IeBrsFPmzqOnWJndaO0IyMuvrl1t9EhJRvn0EWdvt0+90kK72Tn/nR2EZbDRNMimGSBonQOe9IKOVsg19x3W6y1D0a0KCuZlLzZdrNPi3rR1np+pqxjQg2Wugpax/8kVk5FVARG1cHnBbBOHIWCBK3MtRlk6WM767gf1uW12/SUFDpiOmTMLiUrqd5SMCAZiNznIV8SRAuj5+SO0Mu6RXunNYANsbdsmYIZAzzYm2aat1BZPxc7ooYrCFHLXuYyWmTRvEZVQWTibYA4or9o62Xb2/fCehqFXRtGq+uuxrc+irRW79aV1pH6EPxqbIgBgsaRWoVpWwA3Xa+2mzs7/g9XNGdYdvQjHknSrVXISh2JPAVPb9mRcU88DxwnjblYEW17i7J31WBxTY+HYS8GVZzHwV6zZ2ORAmQj290TXIqNBO2iabZXl+jO27aBmbm1zu/ZuONazS6MCs14MwTHuJZHR1vIl3o4ffGUfb1WCmIQ9kL5as72yb60SEzBVNVdFWgEEKdpooX+rsVO3f8onZfBIYmv5g3K3qEIZhpg3Yp/cMldJ7eLGUrzChF4T4GvZHRcnYISFmMPihdnQtee8BXKKA== 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)(346002)(396003)(39840400004)(366004)(376002)(451199015)(6916009)(44832011)(2906002)(316002)(8676002)(478600001)(41300700001)(66556008)(66476007)(6486002)(36756003)(4326008)(66946007)(5660300002)(38100700002)(8936002)(38350700002)(2616005)(6512007)(52116002)(186003)(86362001)(6506007)(6666004)(107886003)(83380400001)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WitNVmNmS2pWcWRyd3pmRFQ4LzdnK3ZUdzU2aXNEazZaMzlDWXg5U0ZrcFdU?= =?utf-8?B?Q0NoTjZQS09GTW5yb1hqQ1B5ajBmQ0FaZ01GYzdyMm5hbFg0bExhay9mR2Uy?= =?utf-8?B?SG1NTjF4ME12VGFnNDh5TmoxaWduOUs3NlhzajdnV0o3QmRnSXRhM25BM1Bi?= =?utf-8?B?N3lOTlEyK3huZ3JNMTZ5cGdEQllsU25jaDk5R0lYRVdjMkQzQWlTbWx4VXY2?= =?utf-8?B?Y0hQRE9pdHJXcS83OWs4UTRwRHN6aFZScFBvVzBsR0VwZU5oWm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ROFJqMHh6WUpaNElEVXRpNXNzYlg3MFUrZURkWmRGQmdO?= =?utf-8?B?S1hCT1R6dXZGRmV6TUtocG5PMGFQSzA3NzUwU053ajBzUlM0SEZmOCtaZkp5?= =?utf-8?B?VFE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: a724d64c-83f5-4bdd-3e8e-08dab241ca7c X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2022 02:21:26.9386 (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: GCgc1NpeYWKA2wZVbiNznUlgZ31TQowl4J0NphhEdroQVrkzqH+RRS6e1IB1NYeZ2NW+AIGfpWlz+p+QkQ/+ZCcu79+rqwPtW2pIeOJSksI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO3PR13MB5784 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 push_vlan action. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- doc/guides/nics/features/nfp.ini | 3 ++ drivers/net/nfp/flower/nfp_flower_cmsg.h | 7 ++++ drivers/net/nfp/nfp_flow.c | 60 ++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index 2c5d173..005129d 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -40,6 +40,9 @@ vlan = Y count = Y drop = Y of_pop_vlan = Y +of_push_vlan = Y +of_set_vlan_pcp = Y +of_set_vlan_vid = Y port_id = 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 4ce03da..30a9ff5 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -367,6 +367,13 @@ struct nfp_fl_act_pop_vlan { rte_be16_t reserved; }; +struct nfp_fl_act_push_vlan { + struct nfp_fl_act_head head; + rte_be16_t reserved; + rte_be16_t vlan_tpid; + rte_be16_t vlan_tci; +}; + 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 3a63239..686a1c0 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -610,6 +610,16 @@ struct nfp_mask_id_entry { PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_OF_POP_VLAN detected"); key_ls->act_size += sizeof(struct nfp_fl_act_pop_vlan); break; + case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN detected"); + key_ls->act_size += sizeof(struct nfp_fl_act_push_vlan); + break; + case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID detected"); + break; + case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP detected"); + break; default: PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type); return -ENOTSUP; @@ -1275,6 +1285,39 @@ struct nfp_mask_id_entry { } static int +nfp_flow_action_push_vlan(char *act_data, + const struct rte_flow_action *action) +{ + size_t act_size; + struct nfp_fl_act_push_vlan *push_vlan; + const struct rte_flow_action_of_push_vlan *push_vlan_conf; + const struct rte_flow_action_of_set_vlan_pcp *vlan_pcp_conf; + const struct rte_flow_action_of_set_vlan_vid *vlan_vid_conf; + + if (((action + 1)->type != RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP) || + ((action + 2)->type != RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID)) + return -EINVAL; + + act_size = sizeof(struct nfp_fl_act_push_vlan); + push_vlan = (struct nfp_fl_act_push_vlan *)act_data; + push_vlan->head.jump_id = NFP_FL_ACTION_OPCODE_PUSH_VLAN; + push_vlan->head.len_lw = act_size >> NFP_FL_LW_SIZ; + push_vlan->reserved = 0; + + push_vlan_conf = (const struct rte_flow_action_of_push_vlan *) + action->conf; + vlan_pcp_conf = (const struct rte_flow_action_of_set_vlan_pcp *) + (action + 1)->conf; + vlan_vid_conf = (const struct rte_flow_action_of_set_vlan_vid *) + (action + 2)->conf; + push_vlan->vlan_tpid = push_vlan_conf->ethertype; + push_vlan->vlan_tci = ((vlan_pcp_conf->vlan_pcp & 0x07) << 13) | + (vlan_vid_conf->vlan_vid & 0x0fff); + + return 0; +} + +static int nfp_flow_compile_action(__rte_unused struct nfp_flower_representor *representor, const struct rte_flow_action actions[], struct rte_flow *nfp_flow) @@ -1341,6 +1384,23 @@ struct nfp_mask_id_entry { nfp_flow_action_pop_vlan(position, nfp_flow_meta); position += sizeof(struct nfp_fl_act_pop_vlan); break; + case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: + PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN"); + ret = nfp_flow_action_push_vlan(position, action); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed when process" + " RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN"); + return ret; + } + + /* + * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP and + * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID + * have also been processed. + */ + action += 2; + position += sizeof(struct nfp_fl_act_push_vlan); + break; default: PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type); return -ENOTSUP; -- 1.8.3.1