Skip to content

Commit

Permalink
etherswitch: Add a new striptagingress port flag
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kornelduleba authored and wojtas-marcin committed Aug 3, 2021
1 parent 428a32e commit f5b29d0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
6 changes: 5 additions & 1 deletion sbin/etherswitchcfg/etherswitchcfg.8
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd June 28, 2019
.Dd June 23, 2021
.Dt ETHERSWITCHCFG 8
.Os
.Sh NAME
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions sbin/etherswitchcfg/etherswitchcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 },
Expand Down
19 changes: 10 additions & 9 deletions sys/dev/etherswitch/etherswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f5b29d0

Please sign in to comment.