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 695DE459CC for ; Wed, 18 Sep 2024 15:58:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 54E91432E2; Wed, 18 Sep 2024 15:58:33 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2046.outbound.protection.outlook.com [40.107.94.46]) by mails.dpdk.org (Postfix) with ESMTP id 6BE5042FC7; Wed, 18 Sep 2024 15:58:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sD/ue6Pm2jJ0QsumiVoev9n2dveanuNWtKBWX13vAp4moYK0PmTetzVIKCWQU63KXN0B2dzbN56DJP72BAuoAh1jJJ45KLrRnnV41L4R9PLYYTMDjc5Ee4CtP0PlV6DQ/v0G1K5AGPEioRzO0MvRk47p6wSfH58U5GVIxs78jevbgqz9kFerjWvvM1YSucQEMYNznDJr+81FOcgMtj47mZii1C35MVBeu+bz8m5GRDPg4bwPtIWiDYpbB3zntWWLNeoDq/VekDCvOycG+xVOWI0E2BX00pbmHs3UFmpYaWImfFNbeOtSYBaES1NS2lRi5tJCWtB7hTuKNkAo0FnFRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=t3QOhCAHGCpcHCQGjaT7oso/W6P62zSa7BYvisMfiWU=; b=c4JBCe79UAgwNrow9Oxosk8IGapRQxzli4o4PXpmGyYYj8XN0pRCcNbXOjDHuAfHku0UuAbpFxgfi/jCjwjS7fdCliR8LlOit08omZb9VhOXGUg24FWzZwweJVPDbmZ3S8UaE8SviJ7LJUptrV6R/3TRUPMwSqukP4kX2lxhPbnoofDHPJJx8b7EZNyEiosM1SEv5PBoZImgRNqGjZ6RdBKvX0NXZTByXe6QLpC6k4AJgIZJjLNNbcV8c/9wct/jZkZhGNgyVLj0Ru9poBtWp2Q021HPuvgwjkzQQqI2weu44/DbpAqsYlmPvXZLNiLYju+F1eR6gAlPJjUU6B33uQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t3QOhCAHGCpcHCQGjaT7oso/W6P62zSa7BYvisMfiWU=; b=C+6oFCmklevtPDldkdrLgG7t5pa9CIw9FCLfG+BH77Fxehdgux7dsLnkApKl9JmXsOtnKfie/r9OhZVC9GTmfhfvO7f4vpWxfIhXQqPdjIS84gNWHgWHRu19l2nuNadI98EGbjARCNzOi8g98I//FcBL1fPQSNA2ziQUiOvwa/PXx/m+Wvni61xBrD5Mjvgxj1ZhYbT5N7B+PJ1zp+RQS2k1+tWQdWe5CXFPqx1zLjly9BTYwCXLuG0pVlqWTHJShQVfdF0AxZ8n7vux1bpiLsFjqDSijgXqdbi5zpFeqC4SQwXmBUugRe3BpSfRYpUdLSb8bz+wZjN5V2Ssg6kPyg== Received: from CH3PR12MB8460.namprd12.prod.outlook.com (2603:10b6:610:156::15) by SA1PR12MB6919.namprd12.prod.outlook.com (2603:10b6:806:24e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.24; Wed, 18 Sep 2024 13:58:26 +0000 Received: from CH3PR12MB8460.namprd12.prod.outlook.com ([fe80::2e9d:7265:3b84:59b5]) by CH3PR12MB8460.namprd12.prod.outlook.com ([fe80::2e9d:7265:3b84:59b5%4]) with mapi id 15.20.7962.022; Wed, 18 Sep 2024 13:58:25 +0000 From: Dariusz Sosnowski To: Slava Ovsiienko , "dev@dpdk.org" CC: Matan Azrad , Raslan Darawsheh , Ori Kam , "stable@dpdk.org" Subject: RE: [PATCH v2 9/9] net/mlx5: fix flex item header length field translation Thread-Topic: [PATCH v2 9/9] net/mlx5: fix flex item header length field translation Thread-Index: AQHbCdFN/Dr3wBt4Cki2jANhmqnS0bJdkgDA Date: Wed, 18 Sep 2024 13:58:25 +0000 Message-ID: References: <20240911160458.524732-1-viacheslavo@nvidia.com> <20240918134623.8441-1-viacheslavo@nvidia.com> <20240918134623.8441-10-viacheslavo@nvidia.com> In-Reply-To: <20240918134623.8441-10-viacheslavo@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CH3PR12MB8460:EE_|SA1PR12MB6919:EE_ x-ms-office365-filtering-correlation-id: 5268599a-2898-4c96-6b71-08dcd7e9f77b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|366016|1800799024|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?js4VNzlfjNNTnuaj9fi0PWUvFwQy20brKR6FYNxlDI7L5uJWCeeU1rDoe5Cy?= =?us-ascii?Q?QXkFlf8fW23M7TWb6ak0LQYo9OAZmWVe7gXJQIBfszDPsiDzJ7ft1HFbzT70?= =?us-ascii?Q?2FaXKIA2MajxgvKZzNy+D0YiFx+WEIMrnnQcOdquRrEpnyJouj2Cj090vUmx?= =?us-ascii?Q?OblXykEQ9ev/K6IbTjHM0zvI9sX8nEpJcWDaxdoMHqbcpHx6XaYnpYrNdb67?= =?us-ascii?Q?NRjlcTXCbLkTKAUqvEIc2K4y/jaPnaZND8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rSil5kEfPFdI2rXCArQHUNJEOQv9xAiZVISgL9tRSbU?= =?us-ascii?Q?OvdYrd+I4L382jgVLsBLyTIn3xKSGnxmmwqQYbvfFBXnriHKIxpteJwEKHJa?= =?us-ascii?Q?Qv1V3L14XnEwkGlAk+PI1L99N0GsI6okfa0l7DIISH+k1B8Vb6Dk6CQLbnVE?= =?us-ascii?Q?wVDXbiqm2gYXGriSt7z9G3TzdKKr1G3OCJkIqFlPNqztw8KV/g1Tg54aQ8PY?= =?us-ascii?Q?RBlh+IqYuGCqpC1p2ZZo5o3lW6li2+gFLRDT/AUbw/+BKDqwGg=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH3PR12MB8460.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?4Ld6tlSs+7LvLjCRalHnCO1I9yZ1k8/jheCnoMdaPKNgok2iee9OcpJTXu7k?= =?us-ascii?Q?zxow6QMDMdjVJ2IY6YeN8GVbL5Xs/3/tH+mV0APIeva9L0UNFlKKjZH7Vo9u?= =?us-ascii?Q?8spO/SYRhSgmksD6/HtfEtOihvoFyaNinwHpVd/TENSlqXYCSA11tHPkfT7c?= =?us-ascii?Q?9YOiDBC7N4LEVEHbpSAG1A7UTNYukm7IZXESxOkwuNeyxBkVEIOLvwsh5Hdg?= =?us-ascii?Q?2/mg5djD4TZB3kXyMDPXDnLKSXpnoK9KZFtIuOjDsfs/DCICb+9TA7ayES2y?= =?us-ascii?Q?2fvHr0oBmJnz9fLr8bxTJx4huydQXQ2/8mUR4z4fw8Th6QG9WVpbL0wj7dMZ?= =?us-ascii?Q?YC5PJ7704IxW4Hpt4v+jN8UESHSvRuYt8/u8JNwNDeWIJUOpr31L4nnHFgAA?= =?us-ascii?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3X6WfGY8zkRzTHTkCMJw954sAPsK/a?= =?us-ascii?Q?6Bkadqmlp4ovfnECRyMp0OuJgwdhXtlVB0/Vf5ZGns5F8JhSxV61heFLpNbL?= =?us-ascii?Q?ctajWM/w36eVycOE0DTJ+g5FGHZf1IDm5wuUycux0jaXIWNhzhXjddz3nuP/?= =?us-ascii?Q?C0kXWc8HuCPuqijAtLKbQ6fhcKTwj9W9oFxhfGqiIwsFv4kixT8Aj9pcUwdX?= =?us-ascii?Q?Ql/X7XvUFwS2wj1RizQM2X1xtJr5YSYaDggjG+hXBupi+jYAcsOv3O95a5ZH?= =?us-ascii?Q?pX9uJg6AOInau9F2A7rKFCvSlaFyO6qf8fOMAH9Q?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH3PR12MB8460.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5268599a-2898-4c96-6b71-08dcd7e9f77b X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Sep 2024 13:58:25.8835 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: kmI0BdR4BpfTStbRRShsd1qLmR0h0huc51HetzRcRCu8LlDIiy4hRecQ91Ef1Qx2Dio+tgL+0x2eWQFl1PU2jg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6919 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org > -----Original Message----- > From: Slava Ovsiienko > Sent: Wednesday, September 18, 2024 15:46 > To: dev@dpdk.org > Cc: Matan Azrad ; Raslan Darawsheh > ; Ori Kam ; Dariusz Sosnowski > ; stable@dpdk.org > Subject: [PATCH v2 9/9] net/mlx5: fix flex item header length field trans= lation >=20 > There are hardware imposed limitations on the header length field descrip= tion for > the mask and shift combinations in the FIELD_MODE_OFFSET mode. >=20 > The patch updates: > - parameter check for FIELD_MODE_OFFSET for the header length > field > - check whether length field crosses dword boundaries in header > - correct mask extension to the hardware required width 6-bits > - correct adjusting the mask left margin offset, preventing > dword offset >=20 > Fixes: b293e8e49d78 ("net/mlx5: translate flex item configuration") > Cc: stable@dpdk.org >=20 > Signed-off-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_flow_flex.c | 120 ++++++++++++++++-------------- > 1 file changed, 66 insertions(+), 54 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_flex.c > b/drivers/net/mlx5/mlx5_flow_flex.c > index bf38643a23..afed16985a 100644 > --- a/drivers/net/mlx5/mlx5_flow_flex.c > +++ b/drivers/net/mlx5/mlx5_flow_flex.c > @@ -449,12 +449,14 @@ mlx5_flex_release_index(struct rte_eth_dev *dev, > * > * shift mask > * ------- --------------- > - * 0 b111100 0x3C > - * 1 b111110 0x3E > - * 2 b111111 0x3F > - * 3 b011111 0x1F > - * 4 b001111 0x0F > - * 5 b000111 0x07 > + * 0 b11111100 0x3C > + * 1 b01111110 0x3E > + * 2 b00111111 0x3F > + * 3 b00011111 0x1F > + * 4 b00001111 0x0F > + * 5 b00000111 0x07 > + * 6 b00000011 0x03 > + * 7 b00000001 0x01 > */ > static uint8_t > mlx5_flex_hdr_len_mask(uint8_t shift, > @@ -464,8 +466,7 @@ mlx5_flex_hdr_len_mask(uint8_t shift, > int diff =3D shift - MLX5_PARSE_GRAPH_NODE_HDR_LEN_SHIFT_DWORD; >=20 > base_mask =3D mlx5_hca_parse_graph_node_base_hdr_len_mask(attr); > - return diff =3D=3D 0 ? base_mask : > - diff < 0 ? (base_mask << -diff) & base_mask : base_mask >> diff; > + return diff < 0 ? base_mask << -diff : base_mask >> diff; > } >=20 > static int > @@ -476,7 +477,6 @@ mlx5_flex_translate_length(struct mlx5_hca_flex_attr > *attr, { > const struct rte_flow_item_flex_field *field =3D &conf->next_header; > struct mlx5_devx_graph_node_attr *node =3D &devx->devx_conf; > - uint32_t len_width, mask; >=20 > if (field->field_base % CHAR_BIT) > return rte_flow_error_set > @@ -504,7 +504,14 @@ mlx5_flex_translate_length(struct mlx5_hca_flex_attr > *attr, > "negative header length field base (FIXED)"); > node->header_length_mode =3D > MLX5_GRAPH_NODE_LEN_FIXED; > break; > - case FIELD_MODE_OFFSET: > + case FIELD_MODE_OFFSET: { > + uint32_t msb, lsb; > + int32_t shift =3D field->offset_shift; > + uint32_t offset =3D field->offset_base; > + uint32_t mask =3D field->offset_mask; > + uint32_t wmax =3D attr->header_length_mask_width + > + > MLX5_PARSE_GRAPH_NODE_HDR_LEN_SHIFT_DWORD; > + > if (!(attr->header_length_mode & > RTE_BIT32(MLX5_GRAPH_NODE_LEN_FIELD))) > return rte_flow_error_set > @@ -514,47 +521,73 @@ mlx5_flex_translate_length(struct mlx5_hca_flex_att= r > *attr, > return rte_flow_error_set > (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > "field size is a must for offset mode"); > - if (field->field_size + field->offset_base < attr- > >header_length_mask_width) > + if ((offset ^ (field->field_size + offset)) >> 5) > return rte_flow_error_set > (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > - "field size plus offset_base is too small"); > - node->header_length_mode =3D > MLX5_GRAPH_NODE_LEN_FIELD; > - if (field->offset_mask =3D=3D 0 || > - !rte_is_power_of_2(field->offset_mask + 1)) > + "field crosses the 32-bit word boundary"); > + /* Hardware counts in dwords, all shifts done by offset within > mask */ > + if (shift < 0 || (uint32_t)shift >=3D wmax) > + return rte_flow_error_set > + (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > + "header length field shift exceeds limits > (OFFSET)"); > + if (!mask) > + return rte_flow_error_set > + (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > + "zero length field offset mask (OFFSET)"); > + msb =3D rte_fls_u32(mask) - 1; > + lsb =3D rte_bsf32(mask); > + if (!rte_is_power_of_2((mask >> lsb) + 1)) > return rte_flow_error_set > (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > - "invalid length field offset mask (OFFSET)"); > - len_width =3D rte_fls_u32(field->offset_mask); > - if (len_width > attr->header_length_mask_width) > + "length field offset mask not contiguous > (OFFSET)"); > + if (msb >=3D field->field_size) > return rte_flow_error_set > (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > - "length field offset mask too wide > (OFFSET)"); > - mask =3D mlx5_flex_hdr_len_mask(field->offset_shift, attr); > - if (mask < field->offset_mask) > + "length field offset mask exceeds field size > (OFFSET)"); > + if (msb >=3D wmax) > return rte_flow_error_set > (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > - "length field shift too big (OFFSET)"); > - node->header_length_field_mask =3D RTE_MIN(mask, > - field- > >offset_mask); > + "length field offset mask exceeds supported > width (OFFSET)"); > + if (mask & ~mlx5_flex_hdr_len_mask(shift, attr)) > + return rte_flow_error_set > + (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > + "mask and shift combination not supported > (OFFSET)"); > + msb++; > + offset +=3D field->field_size - msb; > + if (msb < attr->header_length_mask_width) { > + if (attr->header_length_mask_width - msb > offset) > + return rte_flow_error_set > + (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > + "field size plus offset_base is too > small"); > + offset +=3D msb; > + /* > + * Here we can move to preceding dword. Hardware > does > + * cyclic left shift so we should avoid this and stay > + * at current dword offset. > + */ > + offset =3D (offset & ~0x1Fu) | > + ((offset - attr->header_length_mask_width) > & 0x1F); > + } > + node->header_length_mode =3D > MLX5_GRAPH_NODE_LEN_FIELD; > + node->header_length_field_mask =3D mask; > + node->header_length_field_shift =3D shift; > + node->header_length_field_offset =3D offset; > break; > + } > case FIELD_MODE_BITMASK: > if (!(attr->header_length_mode & > RTE_BIT32(MLX5_GRAPH_NODE_LEN_BITMASK))) > return rte_flow_error_set > (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > "unsupported header length field mode > (BITMASK)"); > - if (attr->header_length_mask_width < field->field_size) > + if (field->offset_shift > 15 || field->offset_shift < 0) > return rte_flow_error_set > (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > - "header length field width exceeds limit"); > + "header length field shift exceeds limit > (BITMASK)"); > node->header_length_mode =3D > MLX5_GRAPH_NODE_LEN_BITMASK; > - mask =3D mlx5_flex_hdr_len_mask(field->offset_shift, attr); > - if (mask < field->offset_mask) > - return rte_flow_error_set > - (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > - "length field shift too big (BITMASK)"); > - node->header_length_field_mask =3D RTE_MIN(mask, > - field- > >offset_mask); > + node->header_length_field_mask =3D field->offset_mask; > + node->header_length_field_shift =3D field->offset_shift; > + node->header_length_field_offset =3D field->offset_base; > break; > default: > return rte_flow_error_set > @@ -567,27 +600,6 @@ mlx5_flex_translate_length(struct mlx5_hca_flex_attr > *attr, > (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, > "header length field base exceeds limit"); > node->header_length_base_value =3D field->field_base / CHAR_BIT; > - if (field->field_mode =3D=3D FIELD_MODE_OFFSET || > - field->field_mode =3D=3D FIELD_MODE_BITMASK) { > - if (field->offset_shift > 15 || field->offset_shift < 0) > - return rte_flow_error_set > - (error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM, NULL, > - "header length field shift exceeds limit"); > - node->header_length_field_shift =3D field->offset_shift; > - node->header_length_field_offset =3D field->offset_base; > - } > - if (field->field_mode =3D=3D FIELD_MODE_OFFSET) { > - if (field->field_size > attr->header_length_mask_width) { > - node->header_length_field_offset +=3D > - field->field_size - attr- > >header_length_mask_width; > - } else if (field->field_size < attr->header_length_mask_width) { > - node->header_length_field_offset -=3D > - attr->header_length_mask_width - field- > >field_size; > - node->header_length_field_mask =3D > - RTE_MIN(node- > >header_length_field_mask, > - (1u << field->field_size) - > 1); > - } > - } > return 0; > } >=20 > -- > 2.34.1 Acked-by: Dariusz Sosnowski Resending the Ack for each patch separately, because patchwork assigned my = Ack for the series to v1, not v2. Best regards, Dariusz Sosnowski