Skip to content

Commit

Permalink
net/ncsi: Configure VLAN tag filter
Browse files Browse the repository at this point in the history
Make use of the ndo_vlan_rx_{add,kill}_vid callbacks to have the NCSI
stack process new VLAN tags and configure the channel VLAN filter
appropriately.
Several VLAN tags can be set and a "Set VLAN Filter" packet must be sent
for each one, meaning the ncsi_dev_state_config_svf state must be
repeated. An internal list of VLAN tags is maintained, and compared
against the current channel's ncsi_channel_filter in order to keep track
within the state. VLAN filters are removed in a similar manner, with the
introduction of the ncsi_dev_state_config_clear_vids state. The maximum
number of VLAN tag filters is determined by the "Get Capabilities"
response from the channel.

Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
sammj authored and davem330 committed Aug 28, 2017
1 parent 8579a67 commit 21acf63
Show file tree
Hide file tree
Showing 4 changed files with 326 additions and 4 deletions.
2 changes: 2 additions & 0 deletions include/net/ncsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ struct ncsi_dev {
};

#ifdef CONFIG_NET_NCSI
int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid);
int ncsi_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid);
struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
void (*notifier)(struct ncsi_dev *nd));
int ncsi_start_dev(struct ncsi_dev *nd);
Expand Down
11 changes: 11 additions & 0 deletions net/ncsi/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ struct ncsi_channel {
#define NCSI_CHANNEL_INACTIVE 1
#define NCSI_CHANNEL_ACTIVE 2
#define NCSI_CHANNEL_INVISIBLE 3
bool reconfigure_needed;
spinlock_t lock; /* Protect filters etc */
struct ncsi_package *package;
struct ncsi_channel_version version;
Expand Down Expand Up @@ -235,6 +236,9 @@ enum {
ncsi_dev_state_probe_dp,
ncsi_dev_state_config_sp = 0x0301,
ncsi_dev_state_config_cis,
ncsi_dev_state_config_clear_vids,
ncsi_dev_state_config_svf,
ncsi_dev_state_config_ev,
ncsi_dev_state_config_sma,
ncsi_dev_state_config_ebf,
#if IS_ENABLED(CONFIG_IPV6)
Expand All @@ -253,6 +257,12 @@ enum {
ncsi_dev_state_suspend_done
};

struct vlan_vid {
struct list_head list;
__be16 proto;
u16 vid;
};

struct ncsi_dev_priv {
struct ncsi_dev ndev; /* Associated NCSI device */
unsigned int flags; /* NCSI device flags */
Expand All @@ -276,6 +286,7 @@ struct ncsi_dev_priv {
struct work_struct work; /* For channel management */
struct packet_type ptype; /* NCSI packet Rx handler */
struct list_head node; /* Form NCSI device list */
struct list_head vlan_vids; /* List of active VLAN IDs */
};

struct ncsi_cmd_arg {
Expand Down
Loading

0 comments on commit 21acf63

Please sign in to comment.