git: f5b29d0f3510 - main - etherswitch: Add a new striptagingress port flag

Marcin Wojtas mw at FreeBSD.org
Tue Aug 3 10:08:00 UTC 2021


The branch main has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=f5b29d0f35100238068c4b3145e15486f991e911

commit f5b29d0f35100238068c4b3145e15486f991e911
Author:     Kornel Duleba <mindal at semihalf.com>
AuthorDate: 2021-06-23 11:13:05 +0000
Commit:     Marcin Wojtas <mw at FreeBSD.org>
CommitDate: 2021-08-03 10:07:48 +0000

    etherswitch: Add a new striptagingress port flag
    
    Felix switch found in LS1028A supports stripping VLAN tag on
    ingress, instead of egress. The striptag flag excepts the latter
    behaviour.
    Add a new flag to support the feature.
    
    Obtained from: Semihalf
    Sponsored by: Alstom Group
    Differential Revision: https://reviews.freebsd.org/D30922
---
 sbin/etherswitchcfg/etherswitchcfg.8 |  6 +++++-
 sbin/etherswitchcfg/etherswitchcfg.c |  4 ++++
 sys/dev/etherswitch/etherswitch.h    | 19 ++++++++++---------
 3 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/sbin/etherswitchcfg/etherswitchcfg.8 b/sbin/etherswitchcfg/etherswitchcfg.8
index 0695b0eddba4..9380c1f4f055 100644
--- a/sbin/etherswitchcfg/etherswitchcfg.8
+++ b/sbin/etherswitchcfg/etherswitchcfg.8
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 28, 2019
+.Dd June 23, 2021
 .Dt ETHERSWITCHCFG 8
 .Os
 .Sh NAME
@@ -139,6 +139,10 @@ Disable the add VLAN tag option.
 Strip the VLAN tags from the packets sent by the port.
 .It Fl striptag
 Disable the strip VLAN tag option.
+.It Cm striptagingress
+Strip the VLAN tags from the packets received by the port.
+.It Fl striptagingress
+Disable the strip VLAN tag on ingress option.
 .It Cm firstlock
 This options makes the switch port lock on the first MAC address it sees.
 After that, usually you need to reset the switch to learn different
diff --git a/sbin/etherswitchcfg/etherswitchcfg.c b/sbin/etherswitchcfg/etherswitchcfg.c
index f3af9f93825a..7f3403918fad 100644
--- a/sbin/etherswitchcfg/etherswitchcfg.c
+++ b/sbin/etherswitchcfg/etherswitchcfg.c
@@ -223,6 +223,8 @@ set_port_flag(struct cfg *cfg, int argc, char *argv[])
 			f = ETHERSWITCH_PORT_DOUBLE_TAG;
 		else if (strcasecmp(flag, "ingress") == 0)
 			f = ETHERSWITCH_PORT_INGRESS;
+		else if (strcasecmp(flag, "striptagingress") == 0)
+			f = ETHERSWITCH_PORT_STRIPTAGINGRESS;
 	}
 	bzero(&p, sizeof(p));
 	p.es_port = cfg->unit;
@@ -869,6 +871,8 @@ static struct cmds cmds[] = {
 	{ MODE_PORT, "-ingress", 0, set_port_flag },
 	{ MODE_PORT, "striptag", 0, set_port_flag },
 	{ MODE_PORT, "-striptag", 0, set_port_flag },
+	{ MODE_PORT, "striptagingress", 0, set_port_flag },
+	{ MODE_PORT, "-striptagingress", 0, set_port_flag },
 	{ MODE_PORT, "doubletag", 0, set_port_flag },
 	{ MODE_PORT, "-doubletag", 0, set_port_flag },
 	{ MODE_PORT, "firstlock", 0, set_port_flag },
diff --git a/sys/dev/etherswitch/etherswitch.h b/sys/dev/etherswitch/etherswitch.h
index 02bf91cd613c..9d87be03e26d 100644
--- a/sys/dev/etherswitch/etherswitch.h
+++ b/sys/dev/etherswitch/etherswitch.h
@@ -57,17 +57,18 @@ struct etherswitch_conf {
 };
 typedef struct etherswitch_conf etherswitch_conf_t;
 
-#define	ETHERSWITCH_PORT_CPU		(1 << 0)
-#define	ETHERSWITCH_PORT_STRIPTAG	(1 << 1)
-#define	ETHERSWITCH_PORT_ADDTAG		(1 << 2)
-#define	ETHERSWITCH_PORT_FIRSTLOCK	(1 << 3)
-#define	ETHERSWITCH_PORT_DROPUNTAGGED	(1 << 4)
-#define	ETHERSWITCH_PORT_DOUBLE_TAG	(1 << 5)
-#define	ETHERSWITCH_PORT_INGRESS	(1 << 6)
-#define	ETHERSWITCH_PORT_DROPTAGGED     (1 << 7)
+#define	ETHERSWITCH_PORT_CPU			(1 << 0)
+#define	ETHERSWITCH_PORT_STRIPTAG		(1 << 1)
+#define	ETHERSWITCH_PORT_ADDTAG			(1 << 2)
+#define	ETHERSWITCH_PORT_FIRSTLOCK		(1 << 3)
+#define	ETHERSWITCH_PORT_DROPUNTAGGED		(1 << 4)
+#define	ETHERSWITCH_PORT_DOUBLE_TAG		(1 << 5)
+#define	ETHERSWITCH_PORT_INGRESS		(1 << 6)
+#define	ETHERSWITCH_PORT_DROPTAGGED     	(1 << 7)
+#define	ETHERSWITCH_PORT_STRIPTAGINGRESS	(1 << 8)
 #define	ETHERSWITCH_PORT_FLAGS_BITS	\
 "\020\1CPUPORT\2STRIPTAG\3ADDTAG\4FIRSTLOCK\5DROPUNTAGGED\6QinQ\7INGRESS" \
-"\10DROPTAGGED"
+"\10DROPTAGGED\11STRIPTAGINGRESS"
 
 #define ETHERSWITCH_PORT_MAX_LEDS 3
 


More information about the dev-commits-src-main mailing list