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

Commit 16e5cc64 authored by John Fastabend's avatar John Fastabend Committed by David S. Miller
Browse files

net: rework setup_tc ndo op to consume general tc operand



This patch updates setup_tc so we can pass additional parameters into
the ndo op in a generic way. To do this we provide structured union
and type flag.

This lets each classifier and qdisc provide its own set of attributes
without having to add new ndo ops or grow the signature of the
callback.

Signed-off-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e4c6734e
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1626,15 +1626,18 @@ static void xgbe_poll_controller(struct net_device *netdev)
}
#endif /* End CONFIG_NET_POLL_CONTROLLER */

static int xgbe_setup_tc(struct net_device *netdev, u32 handle, u8 tc)
static int xgbe_setup_tc(struct net_device *netdev, u32 handle, __be16 proto,
			 struct tc_to_netdev *tc_to_netdev)
{
	struct xgbe_prv_data *pdata = netdev_priv(netdev);
	unsigned int offset, queue;
	u8 i;
	u8 i, tc;

	if (handle != TC_H_ROOT)
	if (handle != TC_H_ROOT || tc_to_netdev->type != TC_SETUP_MQPRIO)
		return -EINVAL;

	tc = tc_to_netdev->tc;

	if (tc && (tc != pdata->hw_feat.tc_cnt))
		return -EINVAL;

+4 −3
Original line number Diff line number Diff line
@@ -4272,11 +4272,12 @@ int bnx2x_setup_tc(struct net_device *dev, u8 num_tc)
	return 0;
}

int __bnx2x_setup_tc(struct net_device *dev, u32 handle, u8 num_tc)
int __bnx2x_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
		     struct tc_to_netdev *tc)
{
	if (handle != TC_H_ROOT)
	if (handle != TC_H_ROOT || tc->type != TC_SETUP_MQPRIO)
		return -EINVAL;
	return bnx2x_setup_tc(dev, num_tc);
	return bnx2x_setup_tc(dev, tc->tc);
}

/* called with rtnl_lock */
+2 −1
Original line number Diff line number Diff line
@@ -486,7 +486,8 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev);

/* setup_tc callback */
int bnx2x_setup_tc(struct net_device *dev, u8 num_tc);
int __bnx2x_setup_tc(struct net_device *dev, u32 handle, u8 num_tc);
int __bnx2x_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
		     struct tc_to_netdev *tc);

int bnx2x_get_vf_config(struct net_device *dev, int vf,
			struct ifla_vf_info *ivi);
+6 −2
Original line number Diff line number Diff line
@@ -5370,13 +5370,17 @@ static int bnxt_change_mtu(struct net_device *dev, int new_mtu)
	return 0;
}

static int bnxt_setup_tc(struct net_device *dev, u32 handle, u8 tc)
static int bnxt_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
			 struct tc_to_netdev *ntc)
{
	struct bnxt *bp = netdev_priv(dev);
	u8 tc;

	if (handle != TC_H_ROOT)
	if (handle != TC_H_ROOT || ntc->type != TC_SETUP_MQPRIO)
		return -EINVAL;

	tc = ntc->tc;

	if (tc > bp->max_tc) {
		netdev_err(dev, "too many traffic classes requested: %d Max supported is %d\n",
			   tc, bp->max_tc);
+4 −3
Original line number Diff line number Diff line
@@ -1204,12 +1204,13 @@ int fm10k_setup_tc(struct net_device *dev, u8 tc)
	return err;
}

static int __fm10k_setup_tc(struct net_device *dev, u32 handle, u8 tc)
static int __fm10k_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
			    struct tc_to_netdev *tc)
{
	if (handle != TC_H_ROOT)
	if (handle != TC_H_ROOT || tc->type != TC_SETUP_MQPRIO)
		return -EINVAL;

	return fm10k_setup_tc(dev, tc);
	return fm10k_setup_tc(dev, tc->tc);
}

static int fm10k_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
Loading