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 6C6C2A0560; Tue, 18 Oct 2022 13:29:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 66F2A42B8D; Tue, 18 Oct 2022 13:28:11 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2112.outbound.protection.outlook.com [40.107.93.112]) by mails.dpdk.org (Postfix) with ESMTP id CC40642B8A for ; Tue, 18 Oct 2022 13:28:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XHZVZodEu4+12LArnGDTInEsgk+WbUmkj1cXlaxfKeOZ1DrYumnY1oIhJN6iloKsqJNnSQ7FpINioLba9QHvVsmDBIBFY5moHyHseGORf2I7Ryyoz9hr/4zNS7NH8ytr6Szb1LUk72TX9eH7bWU6KuPj+foqAprnmSKwetwm8uB/nvUaTjmNVNcs6ouURWO8dBe6J/9QpN38WF1BsJljgTPU91pmnJtwv1evZrJUV0W6GNSt7abfTnitw/ZxiJepDr7cNOL4EVatWQVpovOejT5cit3z5AEjZccdjgKaK5/yE9hbgCzVVVNXw5dBS2Annte7Qp9qeoepDNM3hzN9sw== 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=X7792lY1BeeOLxBfY9oq2rurYZq+3SzjH0ODls5XD+U=; b=feq1TdI45YiqfXTlbUt9GevgsmxMNLVddfkaWtJPCY977R3ablOdmOVomqHaqpiaegTqnCqpq2Bsw8Yxg/QPfURUX8673Vx0iX/QnVTC2C4gw0cIldSltl+pch9HdjNkHhn2xM6dEIvW6igky7Wv2fGIFseEFH/hkn/UgdJXUFmjMj8cqnh2RzD3mIUmE4RNbc4XKVuhce7fBidEs6fWdg684Si4Ny1Y3CZUPobRNx+LpnPsAmL8UAYEbXd7+m+B31tn+qGyyDuTOgpf3SSPidzCtyseh9pv8hFQal/hvMOZWyh/OVFkt1WwTEauvvOLTfbAcI4ec6aOYFLHcK3p6w== 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=X7792lY1BeeOLxBfY9oq2rurYZq+3SzjH0ODls5XD+U=; b=bsPUTlFiW7R+nVnQ+zRNtw1vB85TCo/HJbI8XIRO0fudbNPZdVouDuUk5bSx+qVQcLUekU26wzpVrKst+8BkMDYhHdDsnWeTinYRLH66GqYarbZ4pQvdgloY9yLUQiRw/B88+jusr+OKY0wPhKq0+feHISNenXyaunq0JW0EJF8= 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 SA0PR13MB4160.namprd13.prod.outlook.com (2603:10b6:806:93::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Tue, 18 Oct 2022 11:28:08 +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; Tue, 18 Oct 2022 11:28:08 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v4 16/25] net/nfp: support push VLAN flow action Date: Tue, 18 Oct 2022 19:27:05 +0800 Message-Id: <1666092434-10357-17-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666092434-10357-1-git-send-email-chaoyong.he@corigine.com> References: <1666092434-10357-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA0PR13MB4160:EE_ X-MS-Office365-Filtering-Correlation-Id: eab6e3c2-83e5-454c-e824-08dab0fbd49d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rrDdeCjir2XQnTUphjVx7mdUWZjAiH4iBAY7rBusdY+x21bgqcWV78gkUUsQkSPFs0z65LMi+vHthWJDw86L+GaWUYjyWEgV8Z7pucs92VQr+5MOl12SxarUGPsqSfCigbu00YKrtJ//mPiTdYlRrumXn032FMcAwJiazyEnE87VkjfUTFyR3Xxrd0GS/GFR4X4Ef+7+Fm9EgCxZeQ0JHiMc0pSddHcmjAoJpCIeold9Mwhbp/TGeyKnz/MJQvFlCZCe7l2Rr4Kf7QsmFDg0koPgO38n8s/SNoFGei/2IOuFACmCmb1DAhgfpQ2Y2takosIBmNZY4wmBPTGizFJ3vs4R6/i9/8uA3U3WgV/N4COegInpeG0qAF39oxDW5krZnUiyuJHzAuQDIOAg7WtYm+YeRQ4HpFBupShm4tnjak9PVBWXQDAuZoKMntpGl3FCYC9EP83S51rlv1TTYjxEVn6vy6E+sBIfnAMwYdWsistPXQ8nsAOTQNLvpv8EOD3y9EscjJROT4nl+2KhLrDtcN9bSZnPGIx03U/WgXYdoNuKw8/2yU1oLGFbsTY+SMT3o4O9tcaFFTpOJI7g9hbmwf0ioinI7lG6lm1IUU429WwG+r1oUcZvQ8lYBmfIt7864NXWoBamlM1DLWLF6LMNy+1U6p+7hjvtyFMulY3wUzrQVCEDGqvqjDLykKJktwEit1JeD/XW4KYea4rAwUSPGU5cxbzI+W7utM0KamDH/U2fQ0ZfpvIFBRHBzkMWFk8IQrAWZrRqRRh9gyDtZFMr1B5M5Vwfg3Q3q3qnCZ624LDe+X25nxKKFH2dO9psZpqY 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)(39840400004)(346002)(396003)(366004)(451199015)(6486002)(36756003)(41300700001)(4326008)(38350700002)(8676002)(66556008)(66946007)(107886003)(6506007)(6512007)(66476007)(5660300002)(2616005)(6666004)(44832011)(8936002)(26005)(478600001)(86362001)(186003)(6916009)(52116002)(83380400001)(316002)(2906002)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YnY4TXpqdVdHdEp2cTRyeWdHeldaVFlnVStSV3RjZFE1eFloOTFOeVNCN3pz?= =?utf-8?B?dEZHNHJQVFRWQ2NUZXloaTdQU051UTJQMUdDZFZJM0RlUXhIQnM4RlJKWlA3?= =?utf-8?B?aFIwc2phZ1dwV0s2TDZtTEV5WE03RDlHQzNmckhxOEJjYmIxdjJ2NFVFbkVt?= =?utf-8?B?T2JqV1c2UjNKcUtHYzl3RVBOaTFNWmxGamFMdWtiT3hmUjd4aHUzUk4yT1VB?= =?utf-8?B?ajdkZ1Vza3FhaHZiQXZHKzVYMTVhMDg0dk1BcnVhTFRZZHU5TkJCRGtXaVpC?= =?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J2YWFWaWxCd2EwdFhLTHpPWlo3?= =?utf-8?B?RTVlRGlWVXZoa0lSQmtWckYrZllCZ3RyeEoxM2l1K2xEQXJKNlh4c3hVL3FU?= =?utf-8?B?YXc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: eab6e3c2-83e5-454c-e824-08dab0fbd49d X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 11:28:07.9244 (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: fjRdGOCt/lOTN4Mpu7cOrm5vUWgBbg1YrMfS2ANiQaDn73nl3ChAevA5eSMafo/Ptrw9r5E+icI+OPDehMpEvNEQKHPQD4sA98JT/x9LUCg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR13MB4160 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 ef089fb..ba3455c 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -41,6 +41,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 18867fd..fecc97a 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -622,6 +622,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; @@ -1287,6 +1297,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) @@ -1353,6 +1396,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