From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <spp-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 5E8FAA052F
	for <public@inbox.dpdk.org>; Sun, 26 Jan 2020 19:45:45 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 502564C74;
	Sun, 26 Jan 2020 19:45:45 +0100 (CET)
Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com
 [209.85.214.193]) by dpdk.org (Postfix) with ESMTP id E1B364C74
 for <spp@dpdk.org>; Sun, 26 Jan 2020 19:45:42 +0100 (CET)
Received: by mail-pl1-f193.google.com with SMTP id p12so2512176plr.7
 for <spp@dpdk.org>; Sun, 26 Jan 2020 10:45:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references;
 bh=4tkfA+bkJFkYa2frYMmWsMPt4sH84Py1fKLmTA07VHc=;
 b=rbAa5ssGCio0yI9dVYeYmWp7pi+ZtmcF4SrOJ1tSt82tbuIX0iyAICW9xADSCAaUjt
 kFuRk/da0HI9VSwzqLJaomOtURzAV/pmO3MKxoYKaWsSoV1G3jCLSSQvcrqjag9nzZKe
 ykmJKsURXIF+nukWu4LZ1jimlQCU1Pj2CRIsrFTEoDTgGLWr1FHeSm2eoSXA1dPmA25o
 oRrJNLRGwc+krPhN7xufx/lHtXEz5SyuUDDepfM13nVlmPSW68RKX4TEvyc1d2H+o+xi
 D9fp/FW1q8C9Jx3pzuE0T70cR0u1LNdUpoJKHqxt2x72u2+Pm8McZsJJ0JRCJdMqBL9k
 4K9A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references;
 bh=4tkfA+bkJFkYa2frYMmWsMPt4sH84Py1fKLmTA07VHc=;
 b=SO3pXWtDzctW9QyoSSQKgsbZnh97PxF+TLo30XJlluCXhxtT7ncNj/hnTAzDRxzkhl
 6xBfD4Q1IeGblu0GaKqqdkPSLc4NqYpBxQ7dOy+O4u3//cOdJneKlYNStC8/cnmUH3w2
 jbormDIu/Bub+9Oa8lrinTRRU8D0bKbrffK5ZQJf0PDSv/ly9mv20luNBWvre6C1b9z+
 T93YHmugH7aEtsqS7a0LN7VmoQCcm+AxBY8BAvfzHUakTpDEk1UsXglX7QKYtOWsV7xf
 CfZNjGBUN4XLCdtK8HT3RPEZFLHKM2soHzJ6itioCXrPvhvhRTlhT8KDEFTJ1vyQvDA6
 2zNA==
X-Gm-Message-State: APjAAAVwMT+eGit2821MO5flxlWQxBm6y2QrSTBqgfHtAFkBPI6j7wY0
 aU7Iog+pRFk+2n0RTYcuP0D1ahJ7
X-Google-Smtp-Source: APXvYqwJdAiYsJiCcm61sPy8NnBkbCcpZF0QbAqrI35haMZofeSa74rzsQKuRl1eyUt3x78doxAxQA==
X-Received: by 2002:a17:902:b190:: with SMTP id
 s16mr13112861plr.299.1580064342043; 
 Sun, 26 Jan 2020 10:45:42 -0800 (PST)
Received: from localhost.localdomain
 ([2400:4050:c8c2:de00:b50a:4377:14ac:92ae])
 by smtp.gmail.com with ESMTPSA id h7sm13639086pfq.36.2020.01.26.10.45.40
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 26 Jan 2020 10:45:41 -0800 (PST)
From: Yasufumi Ogawa <yasufum.o@gmail.com>
To: spp@dpdk.org,
	ferruh.yigit@intel.com,
	yasufum.o@gmail.com
Date: Mon, 27 Jan 2020 03:45:31 +0900
Message-Id: <20200126184533.10762-3-yasufum.o@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200126184533.10762-1-yasufum.o@gmail.com>
References: <20200126184533.10762-1-yasufum.o@gmail.com>
Subject: [spp] [PATCH 2/4] spp_primary: enable to add and del memif
X-BeenThere: spp@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Soft Patch Panel <spp.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/spp>,
 <mailto:spp-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/spp/>
List-Post: <mailto:spp@dpdk.org>
List-Help: <mailto:spp-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/spp>,
 <mailto:spp-request@dpdk.org?subject=subscribe>
Errors-To: spp-bounces@dpdk.org
Sender: "spp" <spp-bounces@dpdk.org>

This update is to enable spp_primary to add and del while running.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/primary/main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/primary/main.c b/src/primary/main.c
index 15152a0..d3828e8 100644
--- a/src/primary/main.c
+++ b/src/primary/main.c
@@ -831,6 +831,11 @@ add_port(char *p_type, int p_id)
 		port_id_list[cnt].port_id = p_id;
 		port_id_list[cnt].type = PCAP;
 
+	} else if (!strcmp(p_type, "memif")) {
+		res = add_memif_pmd(p_id);
+		port_id_list[cnt].port_id = p_id;
+		port_id_list[cnt].type = MEMIF;
+
 	} else if (!strcmp(p_type, "nullpmd")) {
 		res = add_null_pmd(p_id);
 		port_id_list[cnt].port_id = p_id;
@@ -906,6 +911,12 @@ del_port(char *p_type, int p_id)
 			return -1;
 		dev_detach_by_port_id(dev_id);
 
+	} else if (!strcmp(p_type, "memif")) {
+		dev_id = find_ethdev_id(p_id, MEMIF);
+		if (dev_id == PORT_RESET)
+			return -1;
+		dev_detach_by_port_id(dev_id);
+
 	} else if (!strcmp(p_type, "nullpmd")) {
 		dev_id = find_ethdev_id(p_id, NULLPMD);
 		if (dev_id == PORT_RESET)
-- 
2.17.1