From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70072.outbound.protection.outlook.com [40.107.7.72]) by dpdk.org (Postfix) with ESMTP id D10021BE1A for ; Tue, 3 Jul 2018 03:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NW4Xyah+3he5JiAQQRW+1Y7On7aDdXreyYvBOzTg4xI=; b=ECS/LnnzDhx9ovCWd9+/p/CrDpvw0ef3ZCVSD567V4WIvqte7GMn/Zw4tjJSdS98AAuUv6LGEcE64hM9dgj0o16bHn/9ftRF3BaN08nUR0F6aA2cXZZkst+rZRL8EwdSyZdJPVGJeetf9ntcaNbnQn7Q65mGCFRu9dGObZKINLQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from yongseok-MBP.local (209.116.155.178) by VI1PR0501MB2048.eurprd05.prod.outlook.com (2603:10a6:800:36::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.20; Tue, 3 Jul 2018 01:07:17 +0000 Date: Mon, 2 Jul 2018 18:07:03 -0700 From: Yongseok Koh To: Nelio Laranjeiro Cc: dev@dpdk.org, Adrien Mazarguil Message-ID: <20180703010703.GB38831@yongseok-MBP.local> References: <1368a8720f3ec3c40e47a6b1d9ef1edf0f38a646.1530111623.git.nelio.laranjeiro@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1368a8720f3ec3c40e47a6b1d9ef1edf0f38a646.1530111623.git.nelio.laranjeiro@6wind.com> User-Agent: Mutt/1.9.3 (2018-01-21) X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: CY4PR19CA0045.namprd19.prod.outlook.com (2603:10b6:903:103::31) To VI1PR0501MB2048.eurprd05.prod.outlook.com (2603:10a6:800:36::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 90bb867d-5246-45a2-23d7-08d5e081529a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2048; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2048; 3:ci815fJS6cRiTR1TIacpwA3AwE9YXuqISEZhd0eJEuUA4xEYmBYTJN0ady6FQXwdxSeDJ7Rv6ozNE2o3XkmVr4/i87fVnlpsmzUl8SS+dA99OYAZQS3wxWQc/QcP9t9eqRzkoriZczz4kLZaxPqELsdAwBVn3Jxmds0QWDyPHwDcfWxW0fkJjDazq52f2atswz9BJdAr0l0ig2T2pgRDr3fxEMvi76IxQ4z/3mW9JqwO0MWpxY2zS7yL5/WInGJ1; 25:dre6F16t55WLxe1R8LdSt/Qan58NvaqzDNsW6owCBts63Q0sZsrIPqE7Qr5GMi3KPAmdh7alYOwXF2OkySplzJNGTWsCKQ8XoVW8mCyA3Z2rFn0nI4A6RGzOBYUxe/Rg3BDLctQ/P28yKp+L5Fyj2+j8ArH+nuxspkzOuyaINR+K5MXWOpvRVDvXSyMixFumDIl/LZ6eHuLROomSHj4pOhjn350reW8B6cWIrQdgrKoHoDrpKLo9LTkHv7P8YLTCbA4VVEYyz9jYZCYR/m6iyB+UEO3gwwu4l5pwG48Yh6OEOd8Sxkl/QLtKW0lGr4y4sO+UqUVH1nmnDrWPyQOz4w==; 31:ptaPu88Omb9yPeXL7MafSVQrMe4WTc7fwDfIJbzuHa5qw7TVA8KAJC6PO2VzAI4BGnOVu9kPX2ygB2TGjhhtWn3+lqnEjfzB6GjXZ8GNYqdbSvpDQFFXl+TB+H/sMt16QEaWWGX/dABQvodfInPWn9hyE532DilEiL2AIZ7w+0Oh0LXcMF3aYvALQFfVLv+Cpj2tWufAC+SkmGN45L1vAY4lVDBtXYpDQTYxpMiLIpY= X-MS-TrafficTypeDiagnostic: VI1PR0501MB2048: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2048; 20:PEB2Pg2EvqZBcHC/v9PEqV1SobCRYPcYTnYZix70Tk2SfPOYYPs4PhDIS0HcVvQiXU28A8ODZYmO4yxKdVgNTul2FzLmob8B9SXLk0jg9oLGCenszS2ugeiiciC9ClApylXqOg23B8kC7TJvbhaGYJNeTy9CvZCfeQ8elZqkap7EtN2en7Zf+79Z9iGYTA/fI4j8n022FUomxB41Eo22Xi+GLMITSs0PTUuOm54XHkSBgMGg8U8SOqWcK2eXVWiWx/5ja77MjQsSHds9UO/JYPqlbkB9HL4Vx4Xo0RoZpYoLgrHlbK2BFSVQp1pSle1tUM8YU7S0SeAschLYT6Gwie2wf++DOPKyu/pwZoEh5KcV/u9YAA4WU0VgxUQVPrgvY+w5NM5/6XeEu6g5Mrny25Vs9A5ir6d4ag7ILv4oGPL0EFeodUJ1Ez0LVb907AcNMrewLcGwThMR/NZfYXomeW0OUNJKlthhlfpzx9sy+QzkBu5ahw4bWOje/2VOM2Oy; 4:rT+dCFKlXgmQVr4cj5havXO15QlGX46rrh7JjfEGxkgKq8R9Ox/VRxTkANuVvgsniilaTQZ49T9w9+M61kPpeUVURyaxWYzYRkGIt7VnaD7hHarbJhiI4PKVwjcMBoWItBwbPgru3KqsVi8u9Knou2ejjR2weP7647gnD/Oe3o7QHRoncJA0+aAAvzm9Wb2Skto8zMSOeEMH3yHbq340/AKkBvGvuzXgAkPwcV8ljzEJTIsod5ITd9jzzkfbWjWGZMmWSfs9PXZMlHswMHckpw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0501MB2048; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2048; X-Forefront-PRVS: 0722981D2A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(376002)(366004)(39860400002)(346002)(199004)(189003)(9686003)(1076002)(33656002)(98436002)(446003)(486006)(105586002)(11346002)(476003)(956004)(305945005)(7736002)(8676002)(8936002)(76176011)(52116002)(7696005)(23726003)(26005)(81166006)(81156014)(316002)(16586007)(58126008)(6116002)(229853002)(3846002)(106356001)(2906002)(68736007)(5660300001)(86362001)(575784001)(6666003)(6916009)(66066001)(478600001)(47776003)(4326008)(55016002)(50466002)(6246003)(6506007)(386003)(186003)(14444005)(16526019)(33896004)(25786009)(53936002)(97736004)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2048; H:yongseok-MBP.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0501MB2048; 23:Trg929E5ClV4sIdEY2gH0ETW+uHGuqr87XetB5g?= =?us-ascii?Q?6wWUtGVmZ+tSiKbUz7HXWcVPf7yc+MHUwvGKDhZoUCHh1FQzxCuQOzVxdi1a?= =?us-ascii?Q?Mnjk8gWi+6hUqBk8QbYS7M08Hxvdp0SJbNpHRI/jNTeaRi8zVwKTQyXUuu+T?= =?us-ascii?Q?bnPtijAsr/r8S9aD6cmSn/LdMZ6kWWwmgWauDct9dIWpEjL7x/fKE4IbzJxQ?= =?us-ascii?Q?P5anMXyClmEGWpVvher0m+4LLvVKyxCp1quFOfNTh8oNH+DBbCFesXiNJSWC?= =?us-ascii?Q?P+PsO2yo9NFlMJG0JjQnYggshitt73GGtXLV6h6oQweRx7smTbCxVZHWjfLn?= =?us-ascii?Q?kGla95Eas71nhOCVMKCazPUc7TfUvAw5Cy3ZanseM1fSlz1j5AWKhvQ2rW7h?= =?us-ascii?Q?FaJnOAULClO1tzrTOPqkf7DqgwVgq5/44zJ6XsyaMx39rzrfOJcE2bNozZzI?= =?us-ascii?Q?mG3eXQbPASToo/ItpkQ3zvb5930gDvul/IhonnzOJuQhWolgSNYMCFYsR7ZM?= =?us-ascii?Q?w9znXbezTp7wu7ktHo6Qov5CyHqwQSecLnVJoNrhkv+CWSDXCSyvF3c7UGjF?= =?us-ascii?Q?vSet5rMD3Le/nkcJOVH16Lnw9jsd5pHOCXeGemDiZK8XhORrL8du82tILpFl?= =?us-ascii?Q?p2e6wz502OGM/ErgnCZ5B2Gr9hyGUcmZQCkoTk59iXgCoDnR3jXsF0csQe0N?= =?us-ascii?Q?M1P9o/1Jy3lpzAgMj1WOEfxCKNirns4BSiD6Hhopc89s7J1+TwWWWO7WTna6?= =?us-ascii?Q?SFHCJNZyeFibWfeVMu5vXxN9eOSbLF8c9MyvjVShUha+tbwYyxepSj9gi51v?= =?us-ascii?Q?10Q+QtCr6SyH0TKCvreZKEqNoGeEc9p+GHt0Ne61pzoVfqRw/9phrj/5Ux3A?= =?us-ascii?Q?rWIWa/jVOfuNyunljacwoiVQtCbcTFaOZzChuGsGQpInbMHGSkJJz/URMdCN?= =?us-ascii?Q?3FaNk53mNSjse+9wu3+CoKv+j+/UlJ8tDWo/+nS1MNGM6pYFuAuT12qz1ngC?= =?us-ascii?Q?P0/kvd952mI1ThO0YJqb+pKTfwfUubtYayrVF1eylKelLxC/kjaOK8TYJom1?= =?us-ascii?Q?a3bLE4xKlxek8DxKFycOfxpV/cx28hGPsjVIrvcf71z+sIqKQB+roIyzIWsb?= =?us-ascii?Q?Dqu6LHQrH26eAzhjzaOt9GAwwOAlBSCOkGu8t+9E+meP01fpKUinnV36JYCB?= =?us-ascii?Q?8tlG297JPk9J9hG1GCARNUB3UHUV2I7c+tKct+M5+Mf29ZKRpwbQ3rmASMBL?= =?us-ascii?Q?H7qoYqytj6pa5udw72QSjbJOPs/TeMif0NpY59Ulrh0ILs/9xrCstBHIZaMZ?= =?us-ascii?Q?q1jugRhRw9ZjRQdxg8/cUQM8=3D?= X-Microsoft-Antispam-Message-Info: Xcyp8qJ3gSOLzuitsQL6DJ8eIhpsjSUliuYhrIPTV+2f2NODZKPYie5l0mkv92jAX7k7f9m44NsQaAmYdqiorDU5hgAvF0i6bFmjtvvnn9maCUTea/d3LybEEjF/KftuOJCr5jbDH+m4KMZPoTTSEFLNKy2bx7wtFqIubnFZKnEdCjvBzqCzI5wNP09ENpmMewfNtSmdXfBJSsuVhtsAtPLAXMAWbIgTRK1VwdcySNdIh4NY8TV8/lJnR2eIsVzbKHfUadWzslyq5Q52Fm1FHUcfZk6L1uoQgc/UJQdQuVibU+UsWIjrebd0zn4HzMeG1Xvd0ZzQSeQcahWQGqggTjkOkjfd9dgU5iqHnTowSAg= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2048; 6:NH3xAHebagmdH1sBSS4dvrS87HxwaMTO67Mk+3Qr43AM8wl+kxqsXOHJEJBjVltqlkm/x3sivkHP9LJOpvljIdHxA6el1+u66F901ocsKYkAUxM0rmqoId0yaqao0fm5cNfB2OX3z8zlwxz5m/M6gOaeuHZjPoQpBXVOtNVRtvd+G7d3vmqGAQuLZkdePaRhiV9c0x/HEV8cooOm4HeqwpQxmKCNJ5DCUrBFfP6b6/ffTMkXF8It3xW4W9MUtG4/9tMYqN9lbjHFEBCPOJl/xSlAkrUH8phCrWoLd1jQhEhYsloJ6wKx0vv84GpT1yiK52b9C39T9YkkhmvfkDYCDiDLr/tXdC6lZd0csdwd7egi4fll6jMEelNofw4wii7LSrH+JSYd9V5NuPxML+J0xVgD041Gos1OX0UrgeAw6+mEXzC52XBSEEOY5P/MnEI4J8O+Hzo5MG4MDEd/4q07NQ==; 5:+kUPhLoMCji0wLb+YZs5lcBiV6PHbDfwtJ7Kt+IVClYPaQqQ77BcBUBPPvkzTI7zHcjd+oPF+ArTzteayLi+NGEH/JpJd90regM3XyLur1b+jE/P+6JDjNAzgXo3giE4uRyQ4x8UPd8lWvPI1Dw3YX51/Igx9RXBvp5qqsi7lMY=; 24:rsMv/amTZoWtzR8yvFl5Xd8BGAwiB9fN45jpCcGcqT4Jr0BjENHgHFh3gEQJjI2dotmm/wrcLIEKWN+4NzQ/inYVoInr6KW/ShTeEsXvKaU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2048; 7:k6pZZbK2NPs98FjVq13OBeww9lzy1cdNRHzD1innC6YDwUvcFW+o2P+AFIGAsUh/rB5ec0EeLJY1n/UgXmqGHTaKftTDsRVtQrr6AGYLcYzBc96GcaxtLkECbL2uASqL/V5XNzZ6ci17tS9ImSOEeR0OSjirrAycgejWmoUaFsXkImr20Y3YD5sqKvfMeaowoit2pvBcqHffZiMpqmG7CH30HS2RP3PYM44QdsWGpMTeDHkJX7Q+VesRSv1ULuzf X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2018 01:07:17.5252 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90bb867d-5246-45a2-23d7-08d5e081529a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2048 Subject: Re: [dpdk-dev] [PATCH v2 02/20] net/mlx5: handle drop queues are regular queues 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: , X-List-Received-Date: Tue, 03 Jul 2018 01:07:21 -0000 On Wed, Jun 27, 2018 at 05:07:34PM +0200, Nelio Laranjeiro wrote: > Drop queues are essentially used in flows due to Verbs API, the > information if the fate of the flow is a drop or not is already present > in the flow. Due to this, drop queues can be fully mapped on regular > queues. The title doesn't look good. Maybe typo? net/mlx5: handle drop queues are regular queues 'are' -> 'as'? > Signed-off-by: Nelio Laranjeiro > --- > drivers/net/mlx5/mlx5.c | 24 ++-- > drivers/net/mlx5/mlx5.h | 14 ++- > drivers/net/mlx5/mlx5_flow.c | 94 +++++++------- > drivers/net/mlx5/mlx5_rxq.c | 232 +++++++++++++++++++++++++++++++++++ > drivers/net/mlx5/mlx5_rxtx.h | 8 ++ > 5 files changed, 310 insertions(+), 62 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index d01c0f6cf..aba6c1f9f 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -260,7 +260,6 @@ mlx5_dev_close(struct rte_eth_dev *dev) > priv->txqs_n = 0; > priv->txqs = NULL; > } > - mlx5_flow_delete_drop_queue(dev); > mlx5_mprq_free_mp(dev); > mlx5_mr_release(dev); > if (priv->pd != NULL) { > @@ -1100,22 +1099,15 @@ mlx5_dev_spawn_one(struct rte_device *dpdk_dev, > mlx5_link_update(eth_dev, 0); > /* Store device configuration on private structure. */ > priv->config = config; > - /* Create drop queue. */ > - err = mlx5_flow_create_drop_queue(eth_dev); > - if (err) { > - DRV_LOG(ERR, "port %u drop queue allocation failed: %s", > - eth_dev->data->port_id, strerror(rte_errno)); > - err = rte_errno; > - goto error; > - } > /* Supported Verbs flow priority number detection. */ > - if (verb_priorities == 0) > - verb_priorities = mlx5_get_max_verbs_prio(eth_dev); > - if (verb_priorities < MLX5_VERBS_FLOW_PRIO_8) { > - DRV_LOG(ERR, "port %u wrong Verbs flow priorities: %u", > - eth_dev->data->port_id, verb_priorities); > - err = ENOTSUP; > - goto error; > + if (verb_priorities == 0) { > + err = mlx5_verbs_max_prio(eth_dev); > + if (err < 0) { > + DRV_LOG(ERR, "port %u wrong Verbs flow priorities", > + eth_dev->data->port_id); > + goto error; > + } > + verb_priorities = err; > } > priv->config.max_verbs_prio = verb_priorities; > /* > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h > index 6674a77d4..11aa0932f 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -131,9 +131,6 @@ enum mlx5_verbs_alloc_type { > MLX5_VERBS_ALLOC_TYPE_RX_QUEUE, > }; > > -/* 8 Verbs priorities. */ > -#define MLX5_VERBS_FLOW_PRIO_8 8 > - > /** > * Verbs allocator needs a context to know in the callback which kind of > * resources it is allocating. > @@ -145,6 +142,12 @@ struct mlx5_verbs_alloc_ctx { > > LIST_HEAD(mlx5_mr_list, mlx5_mr); > > +/* Flow drop context necessary due to Verbs API. */ > +struct mlx5_drop { > + struct mlx5_hrxq *hrxq; /* Hash Rx queue queue. */ > + struct mlx5_rxq_ibv *rxq; /* Verbs Rx queue. */ > +}; > + > struct priv { > LIST_ENTRY(priv) mem_event_cb; /* Called by memory event callback. */ > struct rte_eth_dev_data *dev_data; /* Pointer to device data. */ > @@ -175,7 +178,7 @@ struct priv { > struct rte_intr_handle intr_handle; /* Interrupt handler. */ > unsigned int (*reta_idx)[]; /* RETA index table. */ > unsigned int reta_idx_n; /* RETA index size. */ > - struct mlx5_hrxq_drop *flow_drop_queue; /* Flow drop queue. */ > + struct mlx5_drop drop; /* Flow drop queues. */ priv->drop sounds strange. Why did you change the name? How about priv->flow_drop if you didn't like the full name? > struct mlx5_flows flows; /* RTE Flow rules. */ > struct mlx5_flows ctrl_flows; /* Control flow rules. */ > struct { > @@ -306,7 +309,8 @@ int mlx5_traffic_restart(struct rte_eth_dev *dev); > > /* mlx5_flow.c */ > > -unsigned int mlx5_get_max_verbs_prio(struct rte_eth_dev *dev); > +int mlx5_verbs_max_prio(struct rte_eth_dev *dev); > +void mlx5_flow_print(struct rte_flow *flow); > int mlx5_flow_validate(struct rte_eth_dev *dev, > const struct rte_flow_attr *attr, > const struct rte_flow_item items[], > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index a45cb06e1..8b5b695d4 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -75,6 +75,58 @@ struct ibv_spec_header { > uint16_t size; > }; > > + /** > + * Get the maximum number of priority available. > + * > + * @param dev > + * Pointer to Ethernet device. > + * > + * @return > + * number of supported Verbs flow priority on success, a negative errno > + * value otherwise and rte_errno is set. > + */ > +int > +mlx5_verbs_max_prio(struct rte_eth_dev *dev) > +{ > + struct { > + struct ibv_flow_attr attr; > + struct ibv_flow_spec_eth eth; > + struct ibv_flow_spec_action_drop drop; > + } flow_attr = { > + .attr = { > + .num_of_specs = 2, > + }, > + .eth = { > + .type = IBV_FLOW_SPEC_ETH, > + .size = sizeof(struct ibv_flow_spec_eth), > + }, > + .drop = { > + .size = sizeof(struct ibv_flow_spec_action_drop), > + .type = IBV_FLOW_SPEC_ACTION_DROP, > + }, > + }; > + struct ibv_flow *flow; > + uint32_t verb_priorities; > + struct mlx5_hrxq *drop = mlx5_hrxq_drop_new(dev); > + > + if (!drop) { > + rte_errno = ENOTSUP; > + return -rte_errno; > + } > + for (verb_priorities = 0; 1; verb_priorities++) { > + flow_attr.attr.priority = verb_priorities; > + flow = mlx5_glue->create_flow(drop->qp, > + &flow_attr.attr); > + if (!flow) > + break; > + claim_zero(mlx5_glue->destroy_flow(flow)); > + } > + mlx5_hrxq_drop_release(dev, drop); > + DRV_LOG(INFO, "port %u flow maximum priority: %d", > + dev->data->port_id, verb_priorities); > + return verb_priorities; > +} > + > /** > * Convert a flow. > * > @@ -184,32 +236,6 @@ mlx5_flow_list_flush(struct rte_eth_dev *dev, struct mlx5_flows *list) > } > } > > -/** > - * Create drop queue. > - * > - * @param dev > - * Pointer to Ethernet device. > - * > - * @return > - * 0 on success, a negative errno value otherwise and rte_errno is set. > - */ > -int > -mlx5_flow_create_drop_queue(struct rte_eth_dev *dev __rte_unused) > -{ > - return 0; > -} > - > -/** > - * Delete drop queue. > - * > - * @param dev > - * Pointer to Ethernet device. > - */ > -void > -mlx5_flow_delete_drop_queue(struct rte_eth_dev *dev __rte_unused) > -{ > -} > - > /** > * Remove all flows. > * > @@ -292,6 +318,7 @@ mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev, > struct priv *priv = dev->data->dev_private; > const struct rte_flow_attr attr = { > .ingress = 1, > + .priority = priv->config.max_verbs_prio - 1, > }; > struct rte_flow_item items[] = { > { > @@ -830,18 +857,3 @@ mlx5_dev_filter_ctrl(struct rte_eth_dev *dev, > } > return 0; > } > - > -/** > - * Detect number of Verbs flow priorities supported. > - * > - * @param dev > - * Pointer to Ethernet device. > - * > - * @return > - * number of supported Verbs flow priority. > - */ > -unsigned int > -mlx5_get_max_verbs_prio(struct rte_eth_dev *dev __rte_unused) > -{ > - return 8; > -} > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index 17db7c160..5f17dce50 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -1949,3 +1949,235 @@ mlx5_hrxq_ibv_verify(struct rte_eth_dev *dev) > } > return ret; > } > + > +/** > + * Create a drop Rx queue Verbs object. > + * > + * @param dev > + * Pointer to Ethernet device. > + * > + * @return > + * The Verbs object initialised, NULL otherwise and rte_errno is set. > + */ > +struct mlx5_rxq_ibv * > +mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev) > +{ > + struct priv *priv = dev->data->dev_private; > + struct ibv_cq *cq; > + struct ibv_wq *wq = NULL; > + struct mlx5_rxq_ibv *rxq; > + > + if (priv->drop.rxq) > + return priv->drop.rxq; > + cq = mlx5_glue->create_cq(priv->ctx, 1, NULL, NULL, 0); > + if (!cq) { > + DEBUG("port %u cannot allocate CQ for drop queue", > + dev->data->port_id); > + rte_errno = errno; > + goto error; > + } > + wq = mlx5_glue->create_wq(priv->ctx, > + &(struct ibv_wq_init_attr){ > + .wq_type = IBV_WQT_RQ, > + .max_wr = 1, > + .max_sge = 1, > + .pd = priv->pd, > + .cq = cq, > + }); > + if (!wq) { > + DEBUG("port %u cannot allocate WQ for drop queue", > + dev->data->port_id); > + rte_errno = errno; > + goto error; > + } > + rxq = rte_calloc(__func__, 1, sizeof(*rxq), 0); > + if (!rxq) { > + DEBUG("port %u cannot allocate drop Rx queue memory", > + dev->data->port_id); > + rte_errno = ENOMEM; > + goto error; > + } > + rxq->cq = cq; > + rxq->wq = wq; > + priv->drop.rxq = rxq; > + return rxq; > +error: > + if (wq) > + claim_zero(mlx5_glue->destroy_wq(wq)); > + if (cq) > + claim_zero(mlx5_glue->destroy_cq(cq)); > + return NULL; > +} > + > +/** > + * Release a drop Rx queue Verbs object. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param rxq > + * Pointer to the drop Verbs Rx queue. > + * > + * @return > + * The Verbs object initialised, NULL otherwise and rte_errno is set. > + */ > +void > +mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev, struct mlx5_rxq_ibv *rxq) If rxq for drop is saved in priv->drop.rxq, then why does it have to get rxq pointer as an argument? Looks redundant. > +{ > + if (rxq->wq) > + claim_zero(mlx5_glue->destroy_wq(rxq->wq)); > + if (rxq->cq) > + claim_zero(mlx5_glue->destroy_cq(rxq->cq)); > + rte_free(rxq); > + ((struct priv *)dev->data->dev_private)->drop.rxq = NULL; > +} > + > +/** > + * Create a drop indirection table. > + * > + * @param dev > + * Pointer to Ethernet device. > + * > + * @return > + * The Verbs object initialised, NULL otherwise and rte_errno is set. > + */ > +struct mlx5_ind_table_ibv * > +mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev) > +{ > + struct priv *priv = dev->data->dev_private; > + struct mlx5_ind_table_ibv *ind_tbl; > + struct mlx5_rxq_ibv *rxq; > + struct mlx5_ind_table_ibv tmpl; > + > + rxq = mlx5_rxq_ibv_drop_new(dev); > + if (!rxq) > + return NULL; > + tmpl.ind_table = mlx5_glue->create_rwq_ind_table > + (priv->ctx, > + &(struct ibv_rwq_ind_table_init_attr){ > + .log_ind_tbl_size = 0, > + .ind_tbl = &rxq->wq, > + .comp_mask = 0, > + }); > + if (!tmpl.ind_table) { > + DEBUG("port %u cannot allocate indirection table for drop" > + " queue", > + dev->data->port_id); > + rte_errno = errno; > + goto error; > + } > + ind_tbl = rte_calloc(__func__, 1, sizeof(*ind_tbl), 0); > + if (!ind_tbl) { > + rte_errno = ENOMEM; > + goto error; > + } > + ind_tbl->ind_table = tmpl.ind_table; > + return ind_tbl; > +error: > + mlx5_rxq_ibv_drop_release(dev, rxq); > + return NULL; > +} > + > +/** > + * Release a drop indirection table. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param ind_tbl > + * Indirection table to release. > + */ > +void > +mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev, > + struct mlx5_ind_table_ibv *ind_tbl) ind_tbl is a redundant argument. Can be referenced by priv->drop.hrxq->ind_table. > +{ > + claim_zero(mlx5_glue->destroy_rwq_ind_table(ind_tbl->ind_table)); > + mlx5_rxq_ibv_drop_release > + (dev, ((struct priv *)dev->data->dev_private)->drop.rxq); > + rte_free(ind_tbl); > +} > + > +/** > + * Create a drop Rx Hash queue. > + * > + * @param dev > + * Pointer to Ethernet device. > + * > + * @return > + * The Verbs object initialised, NULL otherwise and rte_errno is set. > + */ > +struct mlx5_hrxq * > +mlx5_hrxq_drop_new(struct rte_eth_dev *dev) > +{ > + struct priv *priv = dev->data->dev_private; > + struct mlx5_ind_table_ibv *ind_tbl; > + struct ibv_qp *qp; > + struct mlx5_hrxq *hrxq; > + > + if (priv->drop.hrxq) { > + rte_atomic32_inc(&priv->drop.hrxq->refcnt); > + return priv->drop.hrxq; > + } > + ind_tbl = mlx5_ind_table_ibv_drop_new(dev); > + if (!ind_tbl) > + return NULL; > + qp = mlx5_glue->create_qp_ex(priv->ctx, > + &(struct ibv_qp_init_attr_ex){ > + .qp_type = IBV_QPT_RAW_PACKET, > + .comp_mask = > + IBV_QP_INIT_ATTR_PD | > + IBV_QP_INIT_ATTR_IND_TABLE | > + IBV_QP_INIT_ATTR_RX_HASH, > + .rx_hash_conf = (struct ibv_rx_hash_conf){ > + .rx_hash_function = > + IBV_RX_HASH_FUNC_TOEPLITZ, > + .rx_hash_key_len = rss_hash_default_key_len, > + .rx_hash_key = rss_hash_default_key, > + .rx_hash_fields_mask = 0, > + }, > + .rwq_ind_tbl = ind_tbl->ind_table, > + .pd = priv->pd > + }); > + if (!qp) { > + DEBUG("port %u cannot allocate QP for drop queue", > + dev->data->port_id); > + rte_errno = errno; > + goto error; > + } > + hrxq = rte_calloc(__func__, 1, sizeof(*hrxq), 0); > + if (!hrxq) { > + DRV_LOG(WARNING, > + "port %u cannot allocate memory for drop queue", > + dev->data->port_id); > + rte_errno = ENOMEM; > + goto error; > + } > + hrxq->ind_table = ind_tbl; > + hrxq->qp = qp; > + priv->drop.hrxq = hrxq; > + rte_atomic32_set(&hrxq->refcnt, 1); > + return hrxq; > +error: > + if (ind_tbl) > + mlx5_ind_table_ibv_drop_release(dev, ind_tbl); > + return NULL; > +} > + > +/** > + * Release a drop hash Rx queue. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param hrxq > + * Pointer to Hash Rx queue to release. > + */ > +void > +mlx5_hrxq_drop_release(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq) hrxq is a redundant argument. Can be referenced by priv->drop.hrxq. Thanks, Yongseok > +{ > + struct priv *priv = dev->data->dev_private; > + > + if (rte_atomic32_dec_and_test(&hrxq->refcnt)) { > + claim_zero(mlx5_glue->destroy_qp(hrxq->qp)); > + mlx5_ind_table_ibv_drop_release(dev, hrxq->ind_table); > + rte_free(hrxq); > + priv->drop.hrxq = NULL; > + } > +} > diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h > index f53bb43c3..51f7f678b 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.h > +++ b/drivers/net/mlx5/mlx5_rxtx.h > @@ -245,6 +245,9 @@ struct mlx5_rxq_ibv *mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx); > struct mlx5_rxq_ibv *mlx5_rxq_ibv_get(struct rte_eth_dev *dev, uint16_t idx); > int mlx5_rxq_ibv_release(struct mlx5_rxq_ibv *rxq_ibv); > int mlx5_rxq_ibv_releasable(struct mlx5_rxq_ibv *rxq_ibv); > +struct mlx5_rxq_ibv *mlx5_rxq_ibv_drop_new(struct rte_eth_dev *dev); > +void mlx5_rxq_ibv_drop_release(struct rte_eth_dev *dev, > + struct mlx5_rxq_ibv *rxq); > int mlx5_rxq_ibv_verify(struct rte_eth_dev *dev); > struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, > uint16_t desc, unsigned int socket, > @@ -265,6 +268,9 @@ struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_get(struct rte_eth_dev *dev, > int mlx5_ind_table_ibv_release(struct rte_eth_dev *dev, > struct mlx5_ind_table_ibv *ind_tbl); > int mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev); > +struct mlx5_ind_table_ibv *mlx5_ind_table_ibv_drop_new(struct rte_eth_dev *dev); > +void mlx5_ind_table_ibv_drop_release(struct rte_eth_dev *dev, > + struct mlx5_ind_table_ibv *ind_tbl); > struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev, > const uint8_t *rss_key, uint32_t rss_key_len, > uint64_t hash_fields, > @@ -277,6 +283,8 @@ struct mlx5_hrxq *mlx5_hrxq_get(struct rte_eth_dev *dev, > uint32_t tunnel, uint32_t rss_level); > int mlx5_hrxq_release(struct rte_eth_dev *dev, struct mlx5_hrxq *hxrq); > int mlx5_hrxq_ibv_verify(struct rte_eth_dev *dev); > +struct mlx5_hrxq *mlx5_hrxq_drop_new(struct rte_eth_dev *dev); > +void mlx5_hrxq_drop_release(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq); > uint64_t mlx5_get_rx_port_offloads(void); > uint64_t mlx5_get_rx_queue_offloads(struct rte_eth_dev *dev); > > -- > 2.18.0 >