net/netconsole: Support VLAN for netconsole
Subsystems (4)
PATCH 1/1 net/netconsole: Support VLAN for netconsole
During kernel startup phase, current netconsole doesn’t support VLAN since there is no VLAN interface setup already.
This patch provides VLAN ID and PCP as optional boot/module parameters to support VLAN environment, thus kernel startup log can be retrieved via VLAN.
--- Documentation/networking/netconsole.rst | 10 ++++- drivers/net/netconsole.c | 3 +- include/linux/netpoll.h | 3 ++ net/core/netpoll.c | 58 ++++++++++++++++++++++++- 4 files changed, 70 insertions(+), 4 deletions(-)
Documentation/networking/netconsole.rst +9 -1
@@ -13,6 +13,8 @@ IPv6 support by Cong Wang <[email protected]>, Jan 1 2013 Extended console support by Tejun Heo <[email protected]>, May 1 2015 +VLAN support by Libing Zhou <[email protected]>, Dec 8 2020 + Please send bug reports to Matt Mackall <[email protected]> Satyam Sharma <[email protected]>, and Cong Wang <[email protected]>
@@ -34,7 +36,7 @@ Sender and receiver configuration: It takes a string configuration parameter "netconsole" in the following format:: - netconsole=[+][src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr] + netconsole=[+][src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr][-V<vid:pcp>] where + if present, enable extended console support
@@ -44,11 +46,17 @@ following format:: tgt-port port for logging agent (6666) tgt-ip IP address for logging agent tgt-macaddr ethernet MAC address for logging agent (broadcast) + -V if present, enable VLAN support + vid:pcp VLAN identifier and priority code point Examples:: linux [email protected]/eth1,[email protected]/12:34:56:78:9a:bc +or using VLAN:: + + linux [email protected]/eth1,[email protected]/12:34:56:78:9a:bc-V100:1 + or:: insmod netconsole netconsole=@/,@10.0.0.2/
drivers/net/netconsole.c +1 -2
@@ -36,7 +36,6 @@#include <linux/inet.h> #include <linux/configfs.h> #include <linux/etherdevice.h> -MODULE_AUTHOR ("Maintainer: Matt Mackall <[email protected]>" );MODULE_DESCRIPTION ("Console driver for network interfaces" );MODULE_LICENSE ("GPL" );
@@ -46,7 +45,7 @@ MODULE_LICENSE("GPL");static char config[MAX_PARAM_LENGTH ];module_param_string (netconsole, config,MAX_PARAM_LENGTH ,0 ); -MODULE_PARM_DESC (netconsole," netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr]" ); +MODULE_PARM_DESC (netconsole," netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr][-V<vid:pcp>]" );static bool oops_only = false;module_param (oops_only, bool,0600 );
include/linux/netpoll.h +3 -0
@@ -31,6 +31,9 @@ struct netpoll {bool ipv6;u16 local_port, remote_port;u8 remote_mac[ETH_ALEN ]; +bool vlan_present; +u16 vlan_id; +u8 pcp; };struct netpoll_info {
net/core/netpoll.c +57 -1
85 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 95 lines · Libing Zhou
During kernel startup phase, current netconsole doesn’t support VLAN since there is no VLAN interface setup already.
This patch provides VLAN ID and PCP as optional boot/module parameters to support VLAN environment, thus kernel startup log can be retrieved via VLAN.
Signed-off-by Libing Zhou <[email protected]>--- Documentation/networking/netconsole.rst | 10 ++++- drivers/net/netconsole.c | 3 +- include/linux/netpoll.h | 3 ++ net/core/netpoll.c | 58 ++++++++++++++++++++++++- 4 files changed, 70 insertions(+), 4 deletions(-)Documentation/networking/netconsole.rst +9
-1@@ -13,6 +13,8 @@ IPv6 support by Cong Wang <[email protected]>, Jan 1 2013 Extended console support by Tejun Heo <[email protected]>, May 1 2015 +VLAN support by Libing Zhou <[email protected]>, Dec 8 2020 + Please send bug reports to Matt Mackall <[email protected]> Satyam Sharma <[email protected]>, and Cong Wang <[email protected]>@@ -34,7 +36,7 @@ Sender and receiver configuration: It takes a string configuration parameter "netconsole" in the following format:: - netconsole=[+][src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr] + netconsole=[+][src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr][-V<vid:pcp>] where + if present, enable extended console support@@ -44,11 +46,17 @@ following format:: tgt-port port for logging agent (6666) tgt-ip IP address for logging agent tgt-macaddr ethernet MAC address for logging agent (broadcast) + -V if present, enable VLAN support + vid:pcp VLAN identifier and priority code point Examples:: linux [email protected]/eth1,[email protected]/12:34:56:78:9a:bc +or using VLAN:: + + linux [email protected]/eth1,[email protected]/12:34:56:78:9a:bc-V100:1 + or:: insmod netconsole netconsole=@/,@10.0.0.2/drivers/net/netconsole.c +1
-2@@ -36,7 +36,6 @@#include <linux/inet.h> #include <linux/configfs.h> #include <linux/etherdevice.h> -MODULE_AUTHOR ("Maintainer: Matt Mackall <[email protected]>" );MODULE_DESCRIPTION ("Console driver for network interfaces" );MODULE_LICENSE ("GPL" );@@ -46,7 +45,7 @@ MODULE_LICENSE("GPL");static char config[MAX_PARAM_LENGTH ];module_param_string (netconsole, config,MAX_PARAM_LENGTH ,0 ); -MODULE_PARM_DESC (netconsole," netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr]" ); +MODULE_PARM_DESC (netconsole," netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr][-V<vid:pcp>]" );static bool oops_only = false;module_param (oops_only, bool,0600 );include/linux/netpoll.h +3
-0@@ -31,6 +31,9 @@ struct netpoll {bool ipv6;u16 local_port, remote_port;u8 remote_mac[ETH_ALEN ]; +bool vlan_present; +u16 vlan_id; +u8 pcp; };struct netpoll_info {net/core/netpoll.c +0
-0
net/core/netpoll.c void netpoll_send_udp(struct netpoll *np, const char *msg, int len) · line 487
Quoted 10 lines
net/core/netpoll.c +7
-0@@ -478,6 +478,14 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) skb->dev = np->dev; +if (np->vlan_present) { + skb->vlan_proto =htons (ETH_P_8021Q ); + +/* htons for tci is done in __vlan_insert_inner_tag, not here */ + skb->vlan_tci = (np->pcp <<VLAN_PRIO_SHIFT ) + (np->vlan_id &VLAN_VID_MASK ); + skb->vlan_present =1 ; + }
This does not seem to be the way to go around this, I would rather specifying eth0.<VID> on the netconsole parameters and automatically create a VLAN interface from that which would ensure that everything works properly and that the VLAN interface is linked to its lower device properly.
If you prefer your current syntax, that is probably fine, too but you should consider registering a VLAN device when you parse appropriate options.
Signature · 1 line
Florian
Quoted 115 lines · Florian Fainelli
Quoted 95 lines · Libing Zhou
During kernel startup phase, current netconsole doesn’t support VLAN since there is no VLAN interface setup already.
This patch provides VLAN ID and PCP as optional boot/module parameters to support VLAN environment, thus kernel startup log can be retrieved via VLAN.
Signed-off-by Libing Zhou <[email protected]>--- Documentation/networking/netconsole.rst | 10 ++++- drivers/net/netconsole.c | 3 +- include/linux/netpoll.h | 3 ++ net/core/netpoll.c | 58 ++++++++++++++++++++++++- 4 files changed, 70 insertions(+), 4 deletions(-)Documentation/networking/netconsole.rst +9
-1@@ -13,6 +13,8 @@ IPv6 support by Cong Wang <[email protected]>, Jan 1 2013 Extended console support by Tejun Heo <[email protected]>, May 1 2015 +VLAN support by Libing Zhou <[email protected]>, Dec 8 2020 + Please send bug reports to Matt Mackall <[email protected]> Satyam Sharma <[email protected]>, and Cong Wang <[email protected]>@@ -34,7 +36,7 @@ Sender and receiver configuration: It takes a string configuration parameter "netconsole" in the following format:: - netconsole=[+][src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr] + netconsole=[+][src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr][-V<vid:pcp>] where + if present, enable extended console support@@ -44,11 +46,17 @@ following format:: tgt-port port for logging agent (6666) tgt-ip IP address for logging agent tgt-macaddr ethernet MAC address for logging agent (broadcast) + -V if present, enable VLAN support + vid:pcp VLAN identifier and priority code point Examples:: linux [email protected]/eth1,[email protected]/12:34:56:78:9a:bc +or using VLAN:: + + linux [email protected]/eth1,[email protected]/12:34:56:78:9a:bc-V100:1 + or:: insmod netconsole netconsole=@/,@10.0.0.2/drivers/net/netconsole.c +1
-2@@ -36,7 +36,6 @@#include <linux/inet.h> #include <linux/configfs.h> #include <linux/etherdevice.h> -MODULE_AUTHOR ("Maintainer: Matt Mackall <[email protected]>" );MODULE_DESCRIPTION ("Console driver for network interfaces" );MODULE_LICENSE ("GPL" );@@ -46,7 +45,7 @@ MODULE_LICENSE("GPL");static char config[MAX_PARAM_LENGTH ];module_param_string (netconsole, config,MAX_PARAM_LENGTH ,0 ); -MODULE_PARM_DESC (netconsole," netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr]" ); +MODULE_PARM_DESC (netconsole," netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr][-V<vid:pcp>]" );static bool oops_only = false;module_param (oops_only, bool,0600 );include/linux/netpoll.h +3
-0@@ -31,6 +31,9 @@ struct netpoll {bool ipv6;u16 local_port, remote_port;u8 remote_mac[ETH_ALEN ]; +bool vlan_present; +u16 vlan_id; +u8 pcp; };struct netpoll_info {net/core/netpoll.c +0
-0net/core/netpoll.c void netpoll_send_udp(struct netpoll *np, const char *msg, int len) · line 487
Quoted 10 lines
net/core/netpoll.c +7
-0@@ -478,6 +478,14 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) skb->dev = np->dev; +if (np->vlan_present) { + skb->vlan_proto =htons (ETH_P_8021Q ); + +/* htons for tci is done in __vlan_insert_inner_tag, not here */ + skb->vlan_tci = (np->pcp <<VLAN_PRIO_SHIFT ) + (np->vlan_id &VLAN_VID_MASK ); + skb->vlan_present =1 ; + }This does not seem to be the way to go around this, I would rather specifying eth0.<VID> on the netconsole parameters and automatically create a VLAN interface from that which would ensure that everything works properly and that the VLAN interface is linked to its lower device properly.
Quoted 5 lines
If you prefer your current syntax, that is probably fine, too but you should consider registering a VLAN device when you parse appropriate options.
Signature · 1 line
Florian
I don't have a strong opinion, considering that I have not actually tried this. I do tend to agree with Florian about registering an 8021q interface, as long as there aren't any other complications associated with it. As for the syntax, I am not sure if "eth0.<VID>" is universal enough to make an ABI out of it.