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 4F20DA04FA; Wed, 5 Feb 2020 16:41:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E83DE1C2A2; Wed, 5 Feb 2020 16:41:36 +0100 (CET) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id F21071C2A0 for ; Wed, 5 Feb 2020 16:41:35 +0100 (CET) Received: by mail-wr1-f66.google.com with SMTP id c9so3280289wrw.8 for ; Wed, 05 Feb 2020 07:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :content-transfer-encoding:user-agent; bh=+rRdD/xEr81VSx9G2RCyezBXGG3DP9M80kiXc/BUt/A=; b=Qy8lGoEKGt7xYWvGPM48FthO2IUtbKwDBRNMquWx9EjvaubREWsdhtH/MH9rUdXDlx GnddBak/9J/IW+eBN4vhSWyRcTc8rpmpa0yfPuJybOE1Ebo0CEtpU8RXDGCtOh1qVucn pMyJSLgY6nOcFSxyG609+VQ1+qx9aRr+2bNj7g6G6/8MKyXilf97sjLYnRxBWaPDMEUs 7bw02Y7opMN3hqDgLj2ZzkgR1nwSPnWsVTuoZ7bjVarI9If5V2ejO+4MHxKlVC/zfDRm nBdGGtmp/mZSErLjKvtFwJi3U02zv3hzw1BmvYQ7MJ9EDPcqZ47pHiKq98+nS8JDQJq7 XAWw== 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:subject:message-id:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=+rRdD/xEr81VSx9G2RCyezBXGG3DP9M80kiXc/BUt/A=; b=S4sKRWID6YS11rZ5JaprRnpgwhdX3Rt++Cxhf+Y9omiOt7eopWIIhVxZvzI8JO/cIA YK8SaS4kTLPWnhgO5Hk2r7EyIBysectbZyIXxa8K925yHvJVnsH0PTdUNgXDQ14jjPN1 PdDG1845ob8qy515dRJmS+EnC95WJxdsI9ZWrEh5iyvtLSqtFmMPgdegDL5gb1fht1Y3 /oZuCBODA2h/3L1m5MPlIQMAMIVDSGRFtuwboKlLHbGHKadcFa+nPuc3u+bM7vO90m3D KfrPrhfkAJEfYYF8feNbldISwbCLV+ClJ2MleFRUGUBX2bmhaBEhSePHy2p4VMmVr5nj LZ4w== X-Gm-Message-State: APjAAAUnqH+w/UMP3F4rgCoTZDIfOiFtY1kJvkV+pNoXnZm+69oxA+z3 1Ys7UgErW9BbxV6pQM4f74hkdxw/SYo= X-Google-Smtp-Source: APXvYqwyXP8NFF59LYZ7s2ZNH/M4E7hXKlH/FKK7Bon2SNG6C0gXrDv28aAKI6I8TZfzlHLPeOiIcA== X-Received: by 2002:adf:a41c:: with SMTP id d28mr30823677wra.410.1580917295220; Wed, 05 Feb 2020 07:41:35 -0800 (PST) Received: from vbox (81.89.53.154.host.vnet.sk. [81.89.53.154]) by smtp.gmail.com with ESMTPSA id y139sm8664104wmd.24.2020.02.05.07.41.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Feb 2020 07:41:34 -0800 (PST) Date: Wed, 5 Feb 2020 16:41:33 +0100 From: =?iso-8859-1?Q?J=FAlius?= Milan To: dev@dpdk.org, jgrajcia@cisco.com Message-ID: <20200205154133.GA16794@vbox> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.9.4 (2018-02-28) Subject: [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" 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" 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; } } -- 2.17.1