Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80d5c368 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

net: vlan: prepare for 802.1ad VLAN filtering offload



Change the rx_{add,kill}_vid callbacks to take a protocol argument in
preparation of 802.1ad support. The protocol argument used so far is
always htons(ETH_P_8021Q).

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f646968f
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -428,14 +428,15 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
 * @bond_dev: bonding net device that got called
 * @vid: vlan id being added
 */
static int bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid)
static int bond_vlan_rx_add_vid(struct net_device *bond_dev,
				__be16 proto, u16 vid)
{
	struct bonding *bond = netdev_priv(bond_dev);
	struct slave *slave, *stop_at;
	int i, res;

	bond_for_each_slave(bond, slave, i) {
		res = vlan_vid_add(slave->dev, vid);
		res = vlan_vid_add(slave->dev, proto, vid);
		if (res)
			goto unwind;
	}
@@ -453,7 +454,7 @@ static int bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid)
	/* unwind from head to the slave that failed */
	stop_at = slave;
	bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at)
		vlan_vid_del(slave->dev, vid);
		vlan_vid_del(slave->dev, proto, vid);

	return res;
}
@@ -463,14 +464,15 @@ static int bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid)
 * @bond_dev: bonding net device that got called
 * @vid: vlan id being removed
 */
static int bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid)
static int bond_vlan_rx_kill_vid(struct net_device *bond_dev,
				 __be16 proto, u16 vid)
{
	struct bonding *bond = netdev_priv(bond_dev);
	struct slave *slave;
	int i, res;

	bond_for_each_slave(bond, slave, i)
		vlan_vid_del(slave->dev, vid);
		vlan_vid_del(slave->dev, proto, vid);

	res = bond_del_vlan(bond, vid);
	if (res) {
@@ -488,7 +490,8 @@ static void bond_add_vlans_on_slave(struct bonding *bond, struct net_device *sla
	int res;

	list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
		res = vlan_vid_add(slave_dev, vlan->vlan_id);
		res = vlan_vid_add(slave_dev, htons(ETH_P_8021Q),
				   vlan->vlan_id);
		if (res)
			pr_warning("%s: Failed to add vlan id %d to device %s\n",
				   bond->dev->name, vlan->vlan_id,
@@ -504,7 +507,7 @@ static void bond_del_vlans_from_slave(struct bonding *bond,
	list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
		if (!vlan->vlan_id)
			continue;
		vlan_vid_del(slave_dev, vlan->vlan_id);
		vlan_vid_del(slave_dev, htons(ETH_P_8021Q), vlan->vlan_id);
	}
}

+4 −2
Original line number Diff line number Diff line
@@ -594,7 +594,8 @@ static const struct ethtool_ops ethtool_ops;


#ifdef VLAN_SUPPORT
static int netdev_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
static int netdev_vlan_rx_add_vid(struct net_device *dev,
				  __be16 proto, u16 vid)
{
	struct netdev_private *np = netdev_priv(dev);

@@ -608,7 +609,8 @@ static int netdev_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
	return 0;
}

static int netdev_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
static int netdev_vlan_rx_kill_vid(struct net_device *dev,
				   __be16 proto, u16 vid)
{
	struct netdev_private *np = netdev_priv(dev);

+2 −4
Original line number Diff line number Diff line
@@ -3068,8 +3068,7 @@ bnad_change_mtu(struct net_device *netdev, int new_mtu)
}

static int
bnad_vlan_rx_add_vid(struct net_device *netdev,
				 unsigned short vid)
bnad_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
{
	struct bnad *bnad = netdev_priv(netdev);
	unsigned long flags;
@@ -3090,8 +3089,7 @@ bnad_vlan_rx_add_vid(struct net_device *netdev,
}

static int
bnad_vlan_rx_kill_vid(struct net_device *netdev,
				  unsigned short vid)
bnad_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
{
	struct bnad *bnad = netdev_priv(netdev);
	unsigned long flags;
+2 −2
Original line number Diff line number Diff line
@@ -212,7 +212,7 @@ int enic_dev_deinit_done(struct enic *enic, int *status)
}

/* rtnl lock is held */
int enic_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
int enic_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
{
	struct enic *enic = netdev_priv(netdev);
	int err;
@@ -225,7 +225,7 @@ int enic_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
}

/* rtnl lock is held */
int enic_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
int enic_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
{
	struct enic *enic = netdev_priv(netdev);
	int err;
+2 −2
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@ int enic_dev_packet_filter(struct enic *enic, int directed, int multicast,
	int broadcast, int promisc, int allmulti);
int enic_dev_add_addr(struct enic *enic, u8 *addr);
int enic_dev_del_addr(struct enic *enic, u8 *addr);
int enic_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
int enic_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
int enic_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid);
int enic_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid);
int enic_dev_notify_unset(struct enic *enic);
int enic_dev_hang_notify(struct enic *enic);
int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic);
Loading