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 8998A43C95; Tue, 12 Mar 2024 20:08:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 59E4F427E0; Tue, 12 Mar 2024 20:08:52 +0100 (CET) Received: from BL2PR02CU003.outbound.protection.outlook.com (mail-eastusazon11022010.outbound.protection.outlook.com [52.101.51.10]) by mails.dpdk.org (Postfix) with ESMTP id 63A6240E40 for ; Tue, 12 Mar 2024 20:08:50 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZQhRmN0zTOyXAiQn5QrtHv9zzkhuF5sIKVQwuJ/8U/0W3ONRSHLCUCTMriIIxX37Fky5Kl/4OfIaa5pj1ufIEsFhR9ojQcoUcWIw9QhqvVFfsCrdsIYyKGQtw5bxwgL/gOCvngnfZx2GVhI3RP5f0WZd33t17V4o4xKRbvmlX97E9GSKoe5SGR8335gex6WGxm1ImoYAh9Kj5CN5LWeZz32/FQqmyU1mIFguZtnaiTVP3d3l/W3In4WfMgjHA7Qq9pvIjDFKjmGP3la1vVdGFHXt8iPJx6Xg7eRQUIR+mxOseVOcJRg/V/RHl62IiWUnDr1wEnLMlgRvCvD8QAcrPA== 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=YYH+ZbkVkb4W0Qy8GCRB4bR8NZ7AwD2c3+mi4ZoUqPE=; b=dy9IuXBuuDfFjwCj34m3eT9g0ArwTFQA5naYv+sxXtkYChTDH++JG7qJEggJvbWcSd5d05HlO2XlUUYi15jL1ZhmcEjZqUbxHOtppH/6owRELQ2d0k3etGZOPgw2Ck/OrYdwkuXPUHdc5/EDp8y/QZlHv7iF6lu9BFZ8cBBgsZgjFof7HUm7VU+xSWPNwiVFat6NPKm7S+SqIY5MIX79BpqhGqzasGjcTfCIbdlRvmxEmXLCimrNr+2Y+wfdyAbISWgRnuV1Du2xgVKCQ6UhREDf1S7pMl8lG8W/JdSo40gOES6w5Dck3uT9reEO9aAYMuC2EPC+IkMS1mCSnYyueQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YYH+ZbkVkb4W0Qy8GCRB4bR8NZ7AwD2c3+mi4ZoUqPE=; b=OW04xsBKKsXhFe0LVjg/yJLdm7/A+liW84bMIz4F5friMZN0E44wNpyFK3EqpcPrFMJmUaSo1URkdvf7bsy6tD6SZuVYe7lmTTkA5TESDTZyXamxhNb2Jee5d+Q1Wz+jtxzJQvrdzJCuVZQTgPFp4/dpgY+lGFXsedzsk9Th8b4= Received: from SJ1PR21MB3457.namprd21.prod.outlook.com (2603:10b6:a03:453::5) by CY8PR21MB4062.namprd21.prod.outlook.com (2603:10b6:930:5a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.5; Tue, 12 Mar 2024 19:08:47 +0000 Received: from SJ1PR21MB3457.namprd21.prod.outlook.com ([fe80::70f:687e:92e6:45b7]) by SJ1PR21MB3457.namprd21.prod.outlook.com ([fe80::70f:687e:92e6:45b7%4]) with mapi id 15.20.7409.004; Tue, 12 Mar 2024 19:08:47 +0000 From: Long Li To: Alan Elder , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" , stephen Subject: RE: [PATCH v2] net/netvsc: fix number Tx queues > Rx queues Thread-Topic: [PATCH v2] net/netvsc: fix number Tx queues > Rx queues Thread-Index: AQHacYPU7gT4O4mJgUmWAw/k7AMSn7E0fTLg Date: Tue, 12 Mar 2024 19:08:47 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=979ac031-206c-4225-b627-540697dac625; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2024-02-29T19:11:26Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ1PR21MB3457:EE_|CY8PR21MB4062:EE_ x-ms-office365-filtering-correlation-id: e11e099e-1f08-46fc-8f82-08dc42c7d820 x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GxVLXXxgigsE990V4kmrhMxORPP8jRMhtES0EQkd/vVkYWMpsMbLzoVjj3HIoXYjsX7ZsYgQZVEu3tppjMo7i4EyJAsGffPhgSE/1exe1yjqcAqifCvM8ZW2Ltc8Jkc2pJUvgpC5kPnlfar6c3bSiXA1M2mPD2mdYbhs1+JdeHlXDqDtwWdOOielU/Cht1aaODwkV9YmbcVDWdLPSHiij8lVicjovtVePPFgEffD/CXxtyUmcEOwQVJG7x81eI0at7A7M9tVabop+JnatxJElSwGBvLg9NgCe0ZSDzaWgHvNR2ZCGhnGGnLnBIpyr+AVis1JakuN/cbSzD39D18POcGbUGxzq++Gcz90JQHkLk2OJsa5y86zwB6aNcGJz2guyM04uomtRvjZlBeCwIKYnKcs2SvhQfj9DMwhHs6XXpKK0LcgFtUZgIFHgwSim3i2CLZxm0RbcEdo7lZG8zOwxTS04QipvO20rcgivlQplHaM6TbhoVDS+lxvXHzG8h/b2aa9oZfZGvfSg+BEb+Y6ACXkbPG0DLMXyw5kGtbftwxS4Cq4SdiWj7Xja/OvllRzGmLEEqeefmTq80U+Ckb4/xLEtQmti8kyooQ4YZxz9nmSx1PhLMrtC9l+9yXkILnZ7ST0jH7ZU7daLAQxcDG2zi/Uq5aYN/Q7TP3vvnyQq4ca7SjqnVQ6GmHnqBwmFHeF/I3YNfa1RxBWtHAogeMUPUNJhRGR2QaolqYT+ivcsSc= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ1PR21MB3457.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?87PrmSTZ+0BhN0dq/0SGrlEm4MO3if1mZlmASMqxYEJM9yXgVUOOhGwUnFbH?= =?us-ascii?Q?2mhUmB7kahE7+RIb2b7FuqZIpY8Wz0GK5OhqgISnnhx39SBBQbyOynHurUwj?= =?us-ascii?Q?yWzTc3txtWXyEXNESyWSjtGaqDZiAsuNdv5xB/NSIlo5QoYIw1KWB1rpEHEZ?= =?us-ascii?Q?idQSUIJJIRyno3wyjKlkHRZvGkQq0w31R8ba1S/eD1E6N4pPVRF7RiGGpdhS?= =?us-ascii?Q?GJ/IcVZDruP0X9fg7e/9ql34S33oI6v/JsfSAfVp5LrSLqhfs2q8J9F+TXIl?= =?us-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S30NtWAU6Qvm2LcHY4W9/hhiI4vDDTc3Pmx?= =?us-ascii?Q?fMOu3gM7pg2un4mnEge1QWLHZWG9zKDB2AZpFHNILe+ZmH6DqvylVD2Zu0mK?= =?us-ascii?Q?7WMe5A0DsLXI3I7JplvGh7dIl+FjmDeXhFR+Euz5l8oPu+Gs89Tpy/OZ+3rn?= =?us-ascii?Q?ty+RkEiFxvK+guiOXCdwcThGktr7b7oZZWYUbiex2zksrrvEffIi2zBT5V3c?= =?us-ascii?Q?GUjF+crmrzMPuyw/D9Xm+Ts5vHeiOMpaY9A46jOswSS02CDC1SDi/J36IEo5?= =?us-ascii?Q?T3EqqVz5gm/Ro/EWz2Uxrs3/fxmTtFLzQ8uZmge62647ndWF2zjj87dC0BqZ?= =?us-ascii?Q?9uPwV8W1m4A2X2lDO+0moylfyUeSqsz7PDLeVaPLBjeVHcBFzjr6Vl0lD9o5?= =?us-ascii?Q?gK/SRr2o3Khqav1BgfGacy7ugP6uQF+lsIsMvMVB?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ1PR21MB3457.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e11e099e-1f08-46fc-8f82-08dc42c7d820 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Mar 2024 19:08:47.1287 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0fppqOrWEAfpgxC4swq6uu2L+C9upCzPC6st5zShyAt1GNl6VxWkYh5fSgBPTOvaiCGLTAvVOyVjoZYGu6D2HQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR21MB4062 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 > a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index > 9bf1ec5509..c0aaeaa972 100644 > --- a/drivers/net/netvsc/hn_rxtx.c > +++ b/drivers/net/netvsc/hn_rxtx.c > @@ -243,6 +243,7 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev, { > struct hn_data *hv =3D dev->data->dev_private; > struct hn_tx_queue *txq; > + struct hn_rx_queue *rxq; > char name[RTE_MEMPOOL_NAMESIZE]; > uint32_t tx_free_thresh; > int err =3D -ENOMEM; > @@ -301,6 +302,22 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev, > goto error; > } >=20 > + /* > + * If there are more Tx queues than Rx queues, allocate rx_queues > + * with event buffer so that Tx completion messages can still be > + * received > + */ > + if (queue_idx >=3D dev->data->nb_rx_queues) { > + rxq =3D hn_rx_queue_alloc(hv, queue_idx, socket_id); Need to check if rxq is NULL. > + /* > + * Don't allocate mbuf pool or rx ring. RSS is always configured > + * to ensure packets aren't received by this Rx queue. > + */ > + rxq->mb_pool =3D NULL; > + rxq->rx_ring =3D NULL; > + dev->data->rx_queues[queue_idx] =3D rxq; > + } > + > txq->agg_szmax =3D RTE_MIN(hv->chim_szmax, hv->rndis_agg_size); > txq->agg_pktmax =3D hv->rndis_agg_pkts; > txq->agg_align =3D hv->rndis_agg_align; @@ -354,6 +371,17 @@ static > void hn_txd_put(struct hn_tx_queue *txq, struct hn_txdesc *txd) > rte_mempool_put(txq->txdesc_pool, txd); } >=20 > +static void > +hn_rx_queue_free_common(struct hn_rx_queue *rxq) { > + if (!rxq) > + return; > + > + rte_free(rxq->rxbuf_info); > + rte_free(rxq->event_buf); > + rte_free(rxq); > +} > + > void > hn_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid) { @@ -36= 4,6 > +392,13 @@ hn_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid) > if (!txq) > return; >=20 > + /* > + * Free any Rx queues allocated for a Tx queue without a corresponding > + * Rx queue > + */ > + if (qid >=3D dev->data->nb_rx_queues) > + hn_rx_queue_free_common(dev->data->rx_queues[qid]); > + > rte_mempool_free(txq->txdesc_pool); >=20 > rte_memzone_free(txq->tx_rndis_mz); > @@ -942,6 +977,13 @@ hn_dev_rx_queue_setup(struct rte_eth_dev *dev, > if (queue_idx =3D=3D 0) { > rxq =3D hv->primary; > } else { > + /* > + * If the number of Tx queues was previously greater than > + * the number of Rx queues, we may already have allocated > + * an rxq. If so, free it now before allocating a new one. > + */ > + hn_rx_queue_free_common(dev->data- > >rx_queues[queue_idx]); This logic seems strange. How about check if rxq is already allocated. If n= ot, allocate it. Something like: if (!dev->data->rx_queues[queue_idx]) rxq =3D hn_rx_queue_alloc(hv, queue_idx, socket_id); Thanks, Long