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 4681DA04FA; Wed, 5 Feb 2020 17:44:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2822D1C227; Wed, 5 Feb 2020 17:44:08 +0100 (CET) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id 34C1D1C08E for ; Wed, 5 Feb 2020 17:44:07 +0100 (CET) Received: by mail-wm1-f66.google.com with SMTP id s10so3216798wmh.3 for ; Wed, 05 Feb 2020 08:44:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=vlX+0tigsNpD8SflNZVfIj/wX7FE+9HXBUQZ7VdiggQ=; b=vchvD6scxpSwGyI+QGYW4ZzI1MN+hsI4YTVKeI8PIAiuf6fMeAex3Hm2/IHVoo0Rih fW9u5pFOmcXoVuHyP0oaTMC6qwO0SFYxDhwRCJ0uAxuiOGgwAHWNZcMgRDJ1f0ez7w3u sjZapzK1HiOmRLxCwP/p70yZc933klGcufco8duSrCUqZfXbRVWAtaWmI2SM4nV99vpJ w95LlZYBrhwnByKk2oWk+WIVNFwpZEJVzwxRQIV6mPS1hJ3JZP1oGM8rJlGQ/kbe2ck/ u4pP0b8L+N9CV6sJ1ZCQNfu3tA8RPQ6XQjDpp4agxXifKLfatOqo010YqwfrsSz62tGr zsGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=vlX+0tigsNpD8SflNZVfIj/wX7FE+9HXBUQZ7VdiggQ=; b=pxcmiuHgsXnvZdTEZjzeA+Akc3pGgEIcpAxTJ9I8OZ15hikGNLxEZFNEM1k9trc0UJ 94JTrFG/Ws9DnBF0Vtv3rlnBTAOncz7iq36v811IAPfCAnaBDpRByvXaKW5mYAWZdJeL HKCNB3osjNVXqhYduWekkOGM1+XFo+fQcnDMnCta3+tiFstT9gPnVDr9DWfHFKd9VTm9 dozbRUjtyLz6/E3lqQep04zcWr1zQqVMEsksv5IdcUsfdI6pU17US0eaNJDZGhQy0S1K abzrGpxJQnS3c9YeaWBf0nv2h8OZIxshJvN36gy0VF3mlNlpYpENXpicd9tjwBVkDBzf h1nQ== X-Gm-Message-State: APjAAAX4zl4zfZwAOmRVnZSOHpu4Zt+DviT2n++OlkUd9jXk1+YjdP18 eaBQZngcNvPD1/qTVRwIVRQ= X-Google-Smtp-Source: APXvYqw5Z7lD0+pXMUa1rS6PwBG8WaIR7pHElrf97V5T3nci2qM7ot0JvMlZxFKJ8H8MxEIal1/H4Q== X-Received: by 2002:a1c:770e:: with SMTP id t14mr6520126wmi.101.1580921046871; Wed, 05 Feb 2020 08:44:06 -0800 (PST) Received: from vbox (81.89.53.154.host.vnet.sk. [81.89.53.154]) by smtp.gmail.com with ESMTPSA id z11sm417128wrv.96.2020.02.05.08.44.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Feb 2020 08:44:06 -0800 (PST) Date: Wed, 5 Feb 2020 17:44:05 +0100 From: =?iso-8859-1?Q?J=FAlius?= Milan To: Ferruh Yigit Cc: dev@dpdk.org, jgrajcia@cisco.com Message-ID: <20200205164405.GA26554@vbox> References: <20200205154133.GA16794@vbox> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH] net/memif: enable loopback 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" On Wed, Feb 05, 2020 at 04:00:19PM +0000, Ferruh Yigit wrote: > On 2/5/2020 3:41 PM, Július Milan wrote: >> With this patch it is possible to connect 2 DPDK memifs into loopback, >> i.e. when they have the same id and different roles, as for example: >> "--vdev=net_memif0,role=master,id=0" >> "--vdev=net_memif1,role=slave,id=0" > >Overall looks good idea but this cause a crash in testpmd on exit, can you >please check? > Thank you, Do you mean this message? "EAL: Error: Invalid memory" If not, how can I reproduce it? >> >> Fixes: 09c7e63a71 ("net/memif: introduce memory interface PMD") >> >> Signed-off-by: Július Milan >> --- >> drivers/net/memif/memif_socket.c | 17 ++++------------- >> 1 file changed, 4 insertions(+), 13 deletions(-) >> >> diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c >> index ad5e30b96..552d3bec1 100644 >> --- a/drivers/net/memif/memif_socket.c >> +++ b/drivers/net/memif/memif_socket.c >> @@ -203,7 +203,7 @@ memif_msg_receive_init(struct memif_control_channel *cc, memif_msg_t *msg) >> dev = elt->dev; >> pmd = dev->data->dev_private; >> if (((pmd->flags & ETH_MEMIF_FLAG_DISABLED) == 0) && >> - pmd->id == i->id) { >> + (pmd->id == i->id) && (pmd->role == MEMIF_ROLE_MASTER)) { >> /* assign control channel to device */ >> cc->dev = dev; >> pmd->cc = cc; >> @@ -965,20 +965,11 @@ memif_socket_init(struct rte_eth_dev *dev, const char *socket_filename) >> } >> pmd->socket_filename = socket->filename; >> >> - if (socket->listener != 0 && pmd->role == MEMIF_ROLE_SLAVE) { >> - MIF_LOG(ERR, "Socket is a listener."); >> - return -1; >> - } else if ((socket->listener == 0) && (pmd->role == MEMIF_ROLE_MASTER)) { >> - MIF_LOG(ERR, "Socket is not a listener."); >> - return -1; >> - } >> - >> TAILQ_FOREACH(elt, &socket->dev_queue, next) { >> tmp_pmd = elt->dev->data->dev_private; >> - if (tmp_pmd->id == pmd->id) { >> - MIF_LOG(ERR, "Memif device with id %d already " >> - "exists on socket %s", >> - pmd->id, socket->filename); >> + if (tmp_pmd->id == pmd->id && tmp_pmd->role == pmd->role) { >> + MIF_LOG(ERR, "Two interfaces with the same id (%d) can " >> + "not have the same role.", pmd->id); >> return -1; >> } >> } >> >