From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AE1D5A0563; Wed, 15 Apr 2020 16:50:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DBB221D8EC; Wed, 15 Apr 2020 16:50:27 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 0EAD91D8EB for ; Wed, 15 Apr 2020 16:50:26 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id v2so70392plp.9 for ; Wed, 15 Apr 2020 07:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5V96XQmrouWA8ElhdNxRnmhTXmThib52RNjCs9AsV/M=; b=P+XoVr5bW8c1hTJM2KjxO4TafYEoittTpFz7ec9hvqac0jb0zW6c3BNFXKuPdTPwKD UgDMWIKAVWepscgIeXYHq5nJAy2dW5ZmhPC8WwxoYuLHwDX2vEsjQ/lV/DVO6CKuO/Fg o0c/DTrHMvbyjcEmZn7LUbxfoHXlfVG2nSYQk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5V96XQmrouWA8ElhdNxRnmhTXmThib52RNjCs9AsV/M=; b=IClrPybDAd+D//4VrlLRJ17W7h2rOya0vTeyQF53JN7IFnXOYlPBBxyqAYJntyA2+N DrwEf5qF17S8xtR140fRlml+LHSAf2TieWQAE8fjoJWIrEcoaCnMwjUkzCldCjEC7Xu5 sS7vq+G3Og2eoFXR9m2glSu2cgAIJ2cPX1ESf+RYNvBlg4boNYmwBiWD3hxF2XUV3LkS ZDVGt1QaS9Ej99D5HHNb90Hl6RJ1bmKJcGTnTQzXW2XqTKRYDEAWwBr4nsxEnS2mF5pj gcQAm8B6wjrBLOL/Gv2CnguLlA9JlX/zxmhmNJu1POoQ9zJHioVQDSstDGoF2DkxWUdU Wt1w== X-Gm-Message-State: AGi0Pub6Zw6Yninxj+oFIj2QBUTnr54Br4Pfrs6HTBGsnici+tzZllBr 0ND5fh+e/5Ggx3ZVAPO/KrSU8EAz+dP0GcXqvBSPVcHXoogH/r2V73G33uOTPndHvO1TZDlxEqx oWaB8FwSeVMkKQ3jGxdPIfAJsSDu4kZFc5cJipb9cBxPipXy8TuoFFuXjONRwFjFODNcx X-Google-Smtp-Source: APiQypJ6rSIvAb/iqhugAjMS6hnaFCmbdqlSeOw5qe1dysw/KIo2WujYl/DJoIgymdcw0Hl9hjsqqw== X-Received: by 2002:a17:902:9a03:: with SMTP id v3mr5055788plp.272.1586962224546; Wed, 15 Apr 2020 07:50:24 -0700 (PDT) Received: from S60.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 11sm13767969pfz.91.2020.04.15.07.50.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Apr 2020 07:50:23 -0700 (PDT) From: Venkat Duvvuru To: dev@dpdk.org Cc: Mike Baucom , Venkat Duvvuru Date: Wed, 15 Apr 2020 20:19:06 +0530 Message-Id: <1586962156-11179-2-git-send-email-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1586962156-11179-1-git-send-email-venkatkumar.duvvuru@broadcom.com> References: <1586962156-11179-1-git-send-email-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH 01/11] net/bnxt: SVIF changes for dpdk port id X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Mike Baucom Modification of the parser to get the SVIF from the driver for matches on port_id, pf, and phy_port. Reviewed-by: Kishore Padmanabha Signed-off-by: Mike Baucom Signed-off-by: Venkat Duvvuru --- drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c | 31 +++++------ drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 92 +++++++++++++++++++++++++------- drivers/net/bnxt/tf_ulp/ulp_rte_parser.h | 5 ++ 3 files changed, 90 insertions(+), 38 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c index 4958895..6203a49 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c @@ -72,14 +72,14 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev, struct ulp_rte_act_bitmap act_bitmap; struct ulp_rte_act_prop act_prop; enum ulp_direction_type dir = ULP_DIR_INGRESS; - uint32_t class_id, act_tmpl; - uint32_t app_priority; - int ret; struct bnxt_ulp_context *ulp_ctx = NULL; - uint32_t vnic; - uint8_t svif; + uint32_t class_id, act_tmpl; struct rte_flow *flow_id; + uint32_t app_priority; uint32_t fid; + uint8_t *buffer; + uint32_t vnic; + int ret; if (bnxt_ulp_flow_validate_args(attr, pattern, actions, @@ -100,19 +100,15 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev, memset(&act_bitmap, 0, sizeof(act_bitmap)); memset(&act_prop, 0, sizeof(act_prop)); - svif = bnxt_get_svif(dev->data->port_id, false); - BNXT_TF_DBG(ERR, "SVIF for port[%d][port]=0x%08x\n", - dev->data->port_id, svif); + if (attr->egress) + dir = ULP_DIR_EGRESS; - hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].size = sizeof(svif); - hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].spec[0] = svif; - hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].mask[0] = -1; - ULP_BITMAP_SET(hdr_bitmap.bits, BNXT_ULP_HDR_BIT_SVIF); + /* copy the device port id and direction in svif for further process */ + buffer = hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].spec; + rte_memcpy(buffer, &dev->data->port_id, sizeof(uint16_t)); + rte_memcpy(buffer + sizeof(uint16_t), &dir, sizeof(uint32_t)); - /* - * VNIC is being pushed as 32bit and the pop will take care of - * proper size - */ + /* Set the implicit vnic in the action property */ vnic = (uint32_t)bnxt_get_vnic_id(dev->data->port_id); vnic = htonl(vnic); rte_memcpy(&act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VNIC], @@ -132,9 +128,6 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev, if (ret != BNXT_TF_RC_SUCCESS) goto parse_error; - if (attr->egress) - dir = ULP_DIR_EGRESS; - ret = ulp_matcher_pattern_match(dir, &hdr_bitmap, hdr_field, &act_bitmap, &class_id); diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index 7a31b43..4339032 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -85,6 +85,8 @@ bnxt_ulp_rte_parser_hdr_parse(const struct rte_flow_item pattern[], } item++; } + /* update the implied SVIF */ + (void)ulp_rte_parser_svif_process(hdr_bitmap, hdr_field); return BNXT_TF_RC_SUCCESS; } @@ -132,9 +134,12 @@ static int32_t ulp_rte_parser_svif_set(struct ulp_rte_hdr_bitmap *hdr_bitmap, struct ulp_rte_hdr_field *hdr_field, enum rte_flow_item_type proto, - uint32_t svif, - uint32_t mask) + uint32_t dir, + uint16_t svif, + uint16_t mask) { + uint16_t port_id = svif; + if (ULP_BITMAP_ISSET(hdr_bitmap->bits, BNXT_ULP_HDR_BIT_SVIF)) { BNXT_TF_DBG(ERR, "SVIF already set," @@ -142,21 +147,51 @@ ulp_rte_parser_svif_set(struct ulp_rte_hdr_bitmap *hdr_bitmap, return BNXT_TF_RC_ERROR; } - /* TBD: Check for any mapping errors for svif */ /* Update the hdr_bitmap with BNXT_ULP_HDR_PROTO_SVIF. */ ULP_BITMAP_SET(hdr_bitmap->bits, BNXT_ULP_HDR_BIT_SVIF); - if (proto != RTE_FLOW_ITEM_TYPE_PF) { - memcpy(hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].spec, - &svif, sizeof(svif)); - memcpy(hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].mask, - &mask, sizeof(mask)); - hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].size = sizeof(svif); + if (proto == RTE_FLOW_ITEM_TYPE_PORT_ID) { + /* perform the conversion from dpdk port to svif */ + if (dir == ULP_DIR_EGRESS) + svif = bnxt_get_svif(port_id, true); + else + svif = bnxt_get_svif(port_id, false); } + memcpy(hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].spec, + &svif, sizeof(svif)); + memcpy(hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].mask, + &mask, sizeof(mask)); + hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].size = sizeof(svif); return BNXT_TF_RC_SUCCESS; } +/* Function to handle the parsing of the RTE port id + */ +int32_t +ulp_rte_parser_svif_process(struct ulp_rte_hdr_bitmap *hdr_bitmap, + struct ulp_rte_hdr_field *hdr_field) +{ + uint16_t port_id = 0; + uint32_t dir = 0; + uint8_t *buffer; + uint16_t svif_mask = 0xFFFF; + + if (ULP_BITMAP_ISSET(hdr_bitmap->bits, BNXT_ULP_HDR_BIT_SVIF)) + return BNXT_TF_RC_SUCCESS; + + /* SVIF not set. So get the port id and direction */ + buffer = hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].spec; + memcpy(&port_id, buffer, sizeof(port_id)); + memcpy(&dir, buffer + sizeof(port_id), sizeof(dir)); + memset(hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].spec, 0, + RTE_PARSER_FLOW_HDR_FIELD_SIZE); + + return ulp_rte_parser_svif_set(hdr_bitmap, hdr_field, + RTE_FLOW_ITEM_TYPE_PORT_ID, + dir, port_id, svif_mask); +} + /* Function to handle the parsing of RTE Flow item PF Header. */ int32_t ulp_rte_pf_hdr_handler(const struct rte_flow_item *item, @@ -165,8 +200,20 @@ ulp_rte_pf_hdr_handler(const struct rte_flow_item *item, uint32_t *field_idx __rte_unused, uint32_t *vlan_idx __rte_unused) { + uint16_t port_id = 0; + uint32_t dir = 0; + uint8_t *buffer; + uint16_t svif_mask = 0xFFFF; + + buffer = hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].spec; + memcpy(&port_id, buffer, sizeof(port_id)); + memcpy(&dir, buffer + sizeof(port_id), sizeof(dir)); + memset(hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].spec, 0, + RTE_PARSER_FLOW_HDR_FIELD_SIZE); + return ulp_rte_parser_svif_set(hdr_bitmap, hdr_field, - item->type, 0, 0); + item->type, + dir, port_id, svif_mask); } /* Function to handle the parsing of RTE Flow item VF Header. */ @@ -178,7 +225,7 @@ ulp_rte_vf_hdr_handler(const struct rte_flow_item *item, uint32_t *vlan_idx __rte_unused) { const struct rte_flow_item_vf *vf_spec, *vf_mask; - uint32_t svif = 0, mask = 0; + uint16_t svif = 0, mask = 0; vf_spec = item->spec; vf_mask = item->mask; @@ -188,12 +235,12 @@ ulp_rte_vf_hdr_handler(const struct rte_flow_item *item, * header fields. */ if (vf_spec) - svif = vf_spec->id; + svif = (uint16_t)vf_spec->id; if (vf_mask) - mask = vf_mask->id; + mask = (uint16_t)vf_mask->id; return ulp_rte_parser_svif_set(hdr_bitmap, hdr_field, - item->type, svif, mask); + item->type, 0, svif, mask); } /* Function to handle the parsing of RTE Flow item port id Header. */ @@ -205,7 +252,9 @@ ulp_rte_port_id_hdr_handler(const struct rte_flow_item *item, uint32_t *vlan_idx __rte_unused) { const struct rte_flow_item_port_id *port_spec, *port_mask; - uint32_t svif = 0, mask = 0; + uint16_t svif = 0, mask = 0; + uint32_t dir; + uint8_t *buffer; port_spec = item->spec; port_mask = item->mask; @@ -215,12 +264,15 @@ ulp_rte_port_id_hdr_handler(const struct rte_flow_item *item, * header fields. */ if (port_spec) - svif = port_spec->id; + svif = (uint16_t)port_spec->id; if (port_mask) - mask = port_mask->id; + mask = (uint16_t)port_mask->id; + + buffer = hdr_field[BNXT_ULP_HDR_FIELD_SVIF_INDEX].spec; + memcpy(&dir, buffer + sizeof(uint16_t), sizeof(uint16_t)); return ulp_rte_parser_svif_set(hdr_bitmap, hdr_field, - item->type, svif, mask); + item->type, dir, svif, mask); } /* Function to handle the parsing of RTE Flow item phy port Header. */ @@ -244,7 +296,7 @@ ulp_rte_phy_port_hdr_handler(const struct rte_flow_item *item, mask = port_mask->index; return ulp_rte_parser_svif_set(hdr_bitmap, hdr_field, - item->type, svif, mask); + item->type, 0, svif, mask); } /* Function to handle the parsing of RTE Flow item Ethernet Header. */ @@ -1124,6 +1176,8 @@ ulp_rte_pf_act_handler(const struct rte_flow_action *action_item __rte_unused, /* copy the PF of the current device into VNIC Property */ svif_buf = &act_prop->act_details[BNXT_ULP_ACT_PROP_IDX_VNIC]; ulp_util_field_int_read(svif_buf, &svif); + svif = (uint32_t)bnxt_get_vnic_id(svif); + svif = htonl(svif); vnic_buffer = &act_prop->act_details[BNXT_ULP_ACT_PROP_IDX_VNIC]; ulp_util_field_int_write(vnic_buffer, svif); diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h index 0ab43d2..0d571bb 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h @@ -20,6 +20,11 @@ #define BNXT_ULP_ENCAP_IPV6_SIZE 8 #define BNXT_ULP_ENCAP_UDP_SIZE 4 +/* Function to handle the parsing of the RTE port id. */ +int32_t +ulp_rte_parser_svif_process(struct ulp_rte_hdr_bitmap *hdr_bitmap, + struct ulp_rte_hdr_field *hdr_field); + /* * Function to handle the parsing of RTE Flows and placing * the RTE flow items into the ulp structures. -- 2.7.4