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 5FD3EA0032; Fri, 21 Oct 2022 10:04:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D02B42C5B; Fri, 21 Oct 2022 10:03:02 +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 E260642C3F for ; Fri, 21 Oct 2022 10:02:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hu+R8iR6VWjlmiZC1YxP1FrQ3ukvH1RDbySZrLgyCE+npvr+AZjrVosxw+Ermb+umbNI8qhqoqVIqiCEVpJiqwqKAzRK9FvoWcsf+WhkizhNNYQzGLaW+wQ4Q0YQ74pbBYZRfBGZeqqyWWR+/7DS7ZZ2kSoabxvUDld7mTwWJFCtbJlwtWH1uhqb7f+F48CTe32e0LK+OhVduKSVWpvklqeJWS/NaD22rZRBLDtrJT3OFpw74R3CpQotvwVF0Rm7SV5bLxqyyXg9zzexgXpAzytRGFs24+7Hrbc74cgjrVniW5XbYj81SwXSBYLMNiwUr9GNXhKpbsDfj3ktUaScwQ== 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=gRCFMRo5tz8rQroRKb8RM33qMAc+bn8aWgUZd7zZnLg=; b=INuowg+Yvn9i5K1JipkwMowb/ofIKDfIkvW0G4PO4nPArZR36hKGApA3FaEPct9JZGHO3w7pDNu2FTFSTjhrWP2ENTGYa5l9kfoVmOOf6RmhuGym9dISwiiq0PfoMxqNlbZIAo+eZGLnob9LwaCymAPJTWckJARmlMu0nyMelJ8MMW6RHgtX4lg5PF/ND+L4RybzyUFMziC0G3Xo6VQPhpsUCpfmkGhGUdiLEgzXQ03XRgsr0+HYxXshrHDBQKoVLTjAB9sIalEP8jiYyOPobeTV8o+4UTMFAgL6w9/eJtBrWsdYUvSFf8+1YABxxoeSQ2Fx/+ewoGYjcgkNbKTEUw== 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=gRCFMRo5tz8rQroRKb8RM33qMAc+bn8aWgUZd7zZnLg=; b=MJT8Yo4l5Sd2tFtLr4f480toSs5YG/Q2wRqq0zb0olAXvo9uCv1uq1otj6JU7hjAXtbYzJnJzFnxUFlw0sC17kx6AxtAlxjoLc7C3N+Ack4hmNrm4WqhVrh28PtSGzGID8oxSYYAQEcwJScYJl4KFPP6K6t8OS/BHQ9owjWanpQ= 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:02:57 +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:02:57 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v6 18/27] net/nfp: support push VLAN flow action Date: Fri, 21 Oct 2022 16:01:54 +0800 Message-Id: <1666339323-24016-19-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: a7b9e76c-e35e-4a54-ade9-08dab33aaa47 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JuxXi4kt9S6Im5t1SFCRo+PmMLVFlDHkCTtq3BiUhGlGt2NE3BicXs0snFXaTk4mLhTRZNIVLu3zM7qr3F2pbl+sriuvwIKW8Dofk4NY4FvGdTijL/rkWiwADATq6Yqb4AYsnuhip9cz2ywO4UKNR8sFvIF4ZPlaxqF/ZozgdLpTHJlUPNdYndZT6zHQ/V6lXskBdqLklDwXvH/dKFV4GTRhVz/d9CMhtdKNqbfLaItQY6avYqHHztizc3UeSRVv0335tlA0cwqokfAVBHNVRogcr/RMI2XK7ILtWdDdJhwrM/VhthZ/8U1b9AxLjqVFi+D3oQ8Xno6iF+ZHiqliqwwHe4m0O+d5v39jE/XxXKB/ncC7r9a15dnPUKf9yRkMzoEfTPRbGZNSRfL/5eNnsY2/PO4EQrlnohbzwc+JTAQGt8CtsbGkm9IIcEJ+4RWWPycKiDMgy6C02jAKRcPDqE8Sa1QtK9TL+iSKwNX5tlXrT0s+BZEplpiOEi5GDekEito2vEIX7/VRO8cx05/7ENGSjTGme3uogNLdVAZKcOKrDpgU4pQUbcFB0TCY9vqEHeL7KTX6wDpQ3eN0EARIZN9DjZWDm5z8NJ1iuwRdTf6LIBMFPa6fOaD9xjoGTo/6LFdzNpIBaC+OmGBvQ+jkK4Q+qCPM6pkgN8RQFLRPTC2TcyxLbY7trg//gNh0xn6/NE/55xA0Kux+DErOhRmCvhgUcZ7DR2TV8WfE+ZBer9FnE43WKyC6+4J/rwS/mQKjHO5Bjt7nsv/rqcHiboN7+A== 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?amowb3ZJVE9ibG54RnpwN1ZZNXpsSU9FMmNDK1Z0eUZFMjRabkE3cTdocitr?= =?utf-8?B?R3U5SUdZOUJPNDdERTFoRG1Ud2tQQUFZdlRYZFZWQjlFSVJWeFVDQjRiQ2ts?= =?utf-8?B?STNJSkR5VSt4WjEyZ29tWUhGVTdjM3IyTTBEZlhWQnpRMkZQci9TSVR5aDBy?= =?utf-8?B?YitnWGw2bmdlMzBSZ3llVEUzNy83djV5anc2dlEyaHRLTEdQdVBaRzdVUVRs?= =?utf-8?B?Q3hwbmVSenBnTGk4WFIzc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F5?= =?utf-8?B?b0tqRGhNVTQzZmFDenVVQktPaW1wRks4NmZhNllQWnZrL3pzR0ttK3E0M2tD?= =?utf-8?B?a205OVpwQXhGMzAyZjJzc1d1R2xMNUlyNjBNZFk0QnBKMTY3YU1GM0FMRUU1?= =?utf-8?B?TXc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7b9e76c-e35e-4a54-ade9-08dab33aaa47 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:02:57.5770 (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: 8f0An37Aul4oosB/uWeqJKHK6eZoI9G6hy80u3SdNEED/Sr7NUX3WwTeuCAiVJTwW9g+UagBNMcWsNtk9LssSy/HbUMYa+po96ByqzH8DHc= 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 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 d496be7..2339efb 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -604,6 +604,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; @@ -1269,6 +1279,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) @@ -1329,6 +1372,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