netdev/ioctl: Add support for simple VLAN ioctl

Supporting ADD_VLAN_CMD and DEL_VLAN_CMD of SIOCSIFVLAN
Ref: https://github.com/torvalds/linux/blob/v6.12/net/8021q/vlan.c#L621

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2025-01-07 17:30:59 +08:00 committed by Alan C. Assis
parent 242c253178
commit 2b34bcfcb1
4 changed files with 137 additions and 2 deletions

View file

@ -154,6 +154,11 @@
#define SIOCNOTIFYRECVCPU _SIOC(0x003F) /* RSS notify recv cpu */
/* VLAN control *************************************************************/
#define SIOCGIFVLAN _SIOC(0x0043) /* Get VLAN interface */
#define SIOCSIFVLAN _SIOC(0x0044) /* Set VLAN interface */
/****************************************************************************
* Public Type Definitions
****************************************************************************/

View file

@ -49,6 +49,35 @@
* Public Type Definitions
****************************************************************************/
/* Passed in vlan_ioctl_args structure to determine behaviour. */
enum vlan_ioctl_cmds
{
ADD_VLAN_CMD,
DEL_VLAN_CMD,
SET_VLAN_INGRESS_PRIORITY_CMD,
SET_VLAN_EGRESS_PRIORITY_CMD,
GET_VLAN_INGRESS_PRIORITY_CMD,
GET_VLAN_EGRESS_PRIORITY_CMD,
SET_VLAN_NAME_TYPE_CMD,
SET_VLAN_FLAG_CMD,
GET_VLAN_REALDEV_NAME_CMD, /* If this works, you know it's a VLAN device, btw */
GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */
};
struct vlan_ioctl_args
{
int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */
char device1[IFNAMSIZ];
union
{
int16_t VID;
} u;
int16_t vlan_qos;
};
/****************************************************************************
* Public Data
****************************************************************************/