Soft Patch Panel
 help / color / mirror / Atom feed
From: x-fn-spp@sl.ntt-tx.co.jp
To: ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Cc: spp@dpdk.org
Subject: [spp] [PATCH 22/23] spp_vf: simplify changing VLAN tag
Date: Wed, 21 Nov 2018 10:35:57 +0900	[thread overview]
Message-ID: <201811210136.wAL1a1mv009710@imss03.silk.ntt-tx.co.jp> (raw)
In-Reply-To: <20181121013558.8869-1-x-fn-spp@sl.ntt-tx.co.jp>

From: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>

To change VLAN tag of a port, it should be deleted before and added as
new one. This update is to allow to change VLAN tag at once.

Signed-off-by: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/common/command_proc.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/vf/common/command_proc.c b/src/vf/common/command_proc.c
index 1331400..0c62968 100644
--- a/src/vf/common/command_proc.c
+++ b/src/vf/common/command_proc.c
@@ -337,13 +337,32 @@ spp_update_port(enum spp_command_action action,
 	switch (action) {
 	case SPP_CMD_ACTION_ADD:
 		ret_check = check_port_element(port_info, *num, ports);
-		if (ret_check >= 0)
+		/* registered check */
+		if (ret_check >= SPP_RET_OK) {
+			/* registered */
+			if (ability->ope == SPP_PORT_ABILITY_OPE_ADD_VLANTAG) {
+				while ((cnt < SPP_PORT_ABILITY_MAX) &&
+					    (port_info->ability[cnt].ope !=
+					    SPP_PORT_ABILITY_OPE_ADD_VLANTAG))
+					cnt++;
+				if (cnt >= SPP_PORT_ABILITY_MAX) {
+					RTE_LOG(ERR, APP, "update VLAN tag "
+						"Non-registratio\n");
+					return SPP_RET_NG;
+				}
+				memcpy(&port_info->ability[cnt], ability,
+					sizeof(struct spp_port_ability));
+
+				ret = SPP_RET_OK;
+				break;
+			}
 			return SPP_RET_OK;
+		}
 
 		if (*num >= RTE_MAX_ETHPORTS) {
 			RTE_LOG(ERR, APP, "Cannot assign port over the "
 				"maximum number.\n");
-			break;
+			return SPP_RET_NG;
 		}
 
 		if (ability->ope != SPP_PORT_ABILITY_OPE_NONE) {
@@ -387,7 +406,7 @@ spp_update_port(enum spp_command_action action,
 		break;
 
 	default:
-		break;
+		return SPP_RET_NG;
 	}
 
 	*(change_component + component_id) = 1;
-- 
2.18.0

  parent reply	other threads:[~2018-11-21  1:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20181121013558.8869-1-x-fn-spp@sl.ntt-tx.co.jp>
2018-11-21  1:35 ` [spp] [PATCH 01/23] spp_vf: fix invalid code for max chars x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 02/23] spp_vf: move common source and header files x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 03/23] spp_vf: change include path x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 04/23] spp_vf: update Makefile for common files x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 05/23] spp_vf: move functions to common directory x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 06/23] spp_vf: move defines to common dir x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 07/23] spp_vf: move functions for decode " x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 08/23] spp_vf: move defines " x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 09/23] spp_vf: move functions to command_proc.c x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 10/23] spp_vf: add management data registration x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 11/23] spp_vf: change reference of management data x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 12/23] spp_vf: change return values to explain result x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 13/23] spp_vf: define terms of commands as consts x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 14/23] spp_vf: remove unnecessary includes x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 15/23] spp_vf: add include header files x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 16/23] spp_vf: update comments for header file x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 17/23] spp_vf: update makefile of spp_vf x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 18/23] spp_vf: add check num of ports before forwarding x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 19/23] spp_vf: add flag for classifier table x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 20/23] spp_vf: add checking the number of ports x-fn-spp
2018-11-21  1:35 ` [spp] [PATCH 21/23] spp_vf: add vlantag command check flag x-fn-spp
2018-11-21  1:35 ` x-fn-spp [this message]
2018-11-21  1:35 ` [spp] [PATCH 23/23] spp_vf: add SPP_VF_MODULE preprocessor directive x-fn-spp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201811210136.wAL1a1mv009710@imss03.silk.ntt-tx.co.jp \
    --to=x-fn-spp@sl.ntt-tx.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).