From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 02854A00BE;
	Thu, 10 Feb 2022 19:40:26 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id BF48E40140;
	Thu, 10 Feb 2022 19:40:26 +0100 (CET)
Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com
 [66.111.4.230]) by mails.dpdk.org (Postfix) with ESMTP id DD8D84013F
 for <dev@dpdk.org>; Thu, 10 Feb 2022 19:40:24 +0100 (CET)
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
 by mailnew.nyi.internal (Postfix) with ESMTP id 1DFC55801FE;
 Thu, 10 Feb 2022 13:40:24 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute5.internal (MEProxy); Thu, 10 Feb 2022 13:40:24 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:cc:content-transfer-encoding:content-type:date:date:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:sender:subject:subject:to:to; s=fm3; bh=Xia21YWWShyFqo
 y0vrfLF8nMyd/aAh12QdgGtfE99Nc=; b=pqI/4GMkDk2OINtBiLxvq1Lnxi/hNN
 KFyVFEVvPTuSSdlRc/aYjxazdxRzB4YDS6WMnwxRReP77pWWtGyvJuyRCFhe0dLj
 KCjyvyBdRwOdUYAsurFN3X4jna+A2xV7hHwCf/3REnzrnueN2z0NvWKGSSRgo+6N
 LCysl0CTeQi4fHwQczWm53IMMF3g22TpyT8VLgfPvURN9eRS4yFoYX7aIc1g88am
 D9rANqwW9MV4bpOE8sT9SvJAsfgR+y0goqUi08XU1Pjdbf/jH2LuokRTDrFLkQV+
 xKKDoniVQTQypBy9l7P5zmPz16SS4hekYElOUYA4wDm7rOXzePB7E3lw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:date:date:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:sender:subject
 :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm2; bh=Xia21YWWShyFqoy0vrfLF8nMyd/aAh12QdgGtfE99
 Nc=; b=ooLLL1vXggyuRClT24aVt1X+EV87z2ry9KJjSuw2iVFDPmnp/0MNUxaFT
 qaxRm5rJ+nWjjOb9kA2eI5p6ylmAjSJVJL01si9isTJH15I2+CKgadZNIzRSEFzV
 fs47bj9Yd+qq6TBmp9K4mScWSEM7nwBN/q7cI2XqntkuqsC4qXBDHYvHwbNpIIaM
 WwkhCnj/5EDLoMVxpEor8AaXgzZOSoCCTkjJZE9oA4d0Q2kZQEPbG7wk8V4vUz5K
 cFf/flJMSEAM7zaR0dEHK0P88U6Pyba/Ya9dPkDKz6r87kJGzZLgMvvW+0W0h3cH
 JdQJsNQdk3MjMV+ZH7/PAjgRtnjQQ==
X-ME-Sender: <xms:F1wFYu-1JOoMuvfStobfPjenitwP2i2VShC0VekuZlH8SpyIPZON2g>
 <xme:F1wFYutMYO-1wbuhd_ajql5LeIL9zdd_t_VmKq5oz-Qf7rtaSzjl9glrmhs_3IDya
 5tIRWrFV1HvkyWzNg>
X-ME-Received: <xmr:F1wFYkA6IBtbKUESDMz9PvDxvYlSHOqidVjbsW4El5Q2ndsd4_UYRDqp1ho8C8l5tlOQidSC2j9OUXI3PCzoR-mmuA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddriedugdduudefucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr
 shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg
 ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu
 ieeivdffgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh
 homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth
X-ME-Proxy: <xmx:F1wFYme58fi6R-0HJEDuzqr7bRKx0ETAe1tg_zDK2qDoDCCyCIeoKw>
 <xmx:F1wFYjM_tqT708YgUy94j9ymZAbzukwUfkjXc9PwDio9m5lB9B06Lw>
 <xmx:F1wFYglXS9zuIVYipZKCVtr8tfChNsVHkF5AyhhgIult61pJv0UKDw>
 <xmx:GFwFYtX-BG01oLuKfzXKOjKJH8FnLaRKQjhPrpMpwwp51nh4xlG7aw>
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 10 Feb 2022 13:40:20 -0500 (EST)
From: Thomas Monjalon <thomas@monjalon.net>
To: Ferruh Yigit <ferruh.yigit@intel.com>,
 Stephen Hemminger <stephen@networkplumber.org>
Cc: Shepard Siegel <shepard.siegel@atomicrules.com>,
 Ed Czeck <ed.czeck@atomicrules.com>, John Miller <john.miller@atomicrules.com>,
 Rasesh Mody <rmody@marvell.com>, Shahed Shaikh <shshaikh@marvell.com>,
 Ajit Khaparde <ajit.khaparde@broadcom.com>,
 Somnath Kotur <somnath.kotur@broadcom.com>,
 Nithin Dabilpuram <ndabilpuram@marvell.com>,
 Kiran Kumar K <kirankumark@marvell.com>, Sunil Kumar Kori <skori@marvell.com>,
 Satha Rao <skoteshwar@marvell.com>, Hemant Agrawal <hemant.agrawal@nxp.com>,
 Sachin Saxena <sachin.saxena@oss.nxp.com>, John Daley <johndale@cisco.com>,
 Hyong Youb Kim <hyonkim@cisco.com>, "Min Hu (Connor)" <humin29@huawei.com>,
 Yisen Zhuang <yisen.zhuang@huawei.com>, Lijun Ou <oulijun@huawei.com>,
 Matan Azrad <matan@nvidia.com>, Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
 Gagandeep Singh <g.singh@nxp.com>,
 Devendra Singh Rawat <dsinghrawat@marvell.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>, dev@dpdk.org,
 Ciara Loftus <ciara.loftus@intel.com>
Subject: Re: [PATCH] ethdev: introduce generic dummy packet burst function
Date: Thu, 10 Feb 2022 19:40:19 +0100
Message-ID: <6278839.K2JlShyGXD@thomas>
In-Reply-To: <20220210083020.028303f3@hermes.local>
References: <20220208194437.426143-1-ferruh.yigit@intel.com>
 <65625d88-ec45-80d8-0228-f9605ade18bd@intel.com>
 <20220210083020.028303f3@hermes.local>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

10/02/2022 17:30, Stephen Hemminger:
> On Thu, 10 Feb 2022 13:58:43 +0000
> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > On 2/8/2022 7:44 PM, Ferruh Yigit wrote:
> > > --- a/drivers/net/mlx5/mlx5.c
> > > +++ b/drivers/net/mlx5/mlx5.c
> > > @@ -1559,8 +1559,8 @@ mlx5_dev_close(struct rte_eth_dev *dev)
> > >   	mlx5_action_handle_flush(dev);
> > >   	mlx5_flow_meter_flush(dev, NULL);
> > >   	/* Prevent crashes when queues are still in use. */
> > > -	dev->rx_pkt_burst = removed_rx_burst;
> > > -	dev->tx_pkt_burst = removed_tx_burst;
> > > +	dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
> > > +	dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
> > >   	rte_wmb();
> > >   	/* Disable datapath on secondary process. */
> > >   	mlx5_mp_os_req_stop_rxtx(dev);
> > > diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c
> > > index f388fcc31395..11ea935d72f0 100644
> > > --- a/drivers/net/mlx5/mlx5_rx.c
> > > +++ b/drivers/net/mlx5/mlx5_rx.c
> > > @@ -252,7 +252,7 @@ mlx5_rx_queue_count(void *rx_queue)
> > >   	dev = &rte_eth_devices[rxq->port_id];
> > >   
> > >   	if (dev->rx_pkt_burst == NULL ||
> > > -	    dev->rx_pkt_burst == removed_rx_burst) {
> > > +	    dev->rx_pkt_burst == rte_eth_pkt_burst_dummy) {
> > >   		rte_errno = ENOTSUP;
> > >   		return -rte_errno;
> > >   	}  
> > 
> > Thinking twice I am not sure if above change works.
> > 
> > Since function is in the header file, and the .c file that assign
> > the 'dev->rx_pkt_burst' and the .c file that check function pointer
> > are different, these two different instance of same function may
> > have different addresses and above check may fail when it should match.
> > 
> > I guess solution is move the function to a .c file and export it
> > internally.
> > I was thinking to add ethdev_driver.c file, perhaps this can be
> > a motivation to start that file.
> > Thomas, Andrew, what do you think about ethdev_driver.c file?
> 
> Right putting it the header file ends up with multiple copies of same
> code compiled into each driver.

I'm OK with introducing such .c file.