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

Commit 86f44778 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'tc-hw-offload'



John Fastabend says:

====================
tc offload for cls_u32 on ixgbe

This extends the setup_tc framework so it can support more than just
the mqprio offload and push other classifiers and qdiscs into the
hardware. The series here targets the u32 classifier and ixgbe
driver. I worked out the u32 classifier because it is protocol
oblivious and aligns with multiple hardware devices I have access
to. I did an initial implementation on ixgbe because (a) I have one
in my box (b) its a stable driver and (c) it is relatively simple
compared to the other devices I have here but still has enough
flexibility to exercise the features of cls_u32.

I intentionally limited the scope of this series to the basic
feature set. Specifically this uses a 'big hammer' feature bit
to do the offload or not. If the bit is set you get offloaded rules
if it is not then rules will not be offloaded. If we can agree on
this patch series there are some more patches on my queue we can
talk about to make the offload decision per rule using flags similar
to how we do l2 mac updates. Additionally the error strategy can
be improved to be hard aborting, log and continue, etc. I think
these are nice to have improvements but shouldn't block this series.

Also by adding get_parse_graph and set_parse_graph attributes as
in my previous flow_api work we can build programmable devices
and programmatically learn when rules can or can not be loaded
into the hardware. Again future work.

... v3 includes a couple style fixups suggested by Jiri and a
quick fix to ixgbe to check features flag and not dev_features
flag the latter being always set.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 547b9ca8 db956ae8
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1626,11 +1626,17 @@ static void xgbe_poll_controller(struct net_device *netdev)
}
#endif /* End CONFIG_NET_POLL_CONTROLLER */

static int xgbe_setup_tc(struct net_device *netdev, 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 || tc_to_netdev->type != TC_SETUP_MQPRIO)
		return -EINVAL;

	tc = tc_to_netdev->tc;

	if (tc && (tc != pdata->hw_feat.tc_cnt))
		return -EINVAL;
+8 −0
Original line number Diff line number Diff line
@@ -4272,6 +4272,14 @@ int bnx2x_setup_tc(struct net_device *dev, u8 num_tc)
	return 0;
}

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

/* called with rtnl_lock */
int bnx2x_change_mac_addr(struct net_device *dev, void *p)
{
+2 −0
Original line number Diff line number Diff line
@@ -486,6 +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, __be16 proto,
		     struct tc_to_netdev *tc);

int bnx2x_get_vf_config(struct net_device *dev, int vf,
			struct ifla_vf_info *ivi);
+1 −1
Original line number Diff line number Diff line
@@ -13061,7 +13061,7 @@ static const struct net_device_ops bnx2x_netdev_ops = {
#ifdef CONFIG_NET_POLL_CONTROLLER
	.ndo_poll_controller	= poll_bnx2x,
#endif
	.ndo_setup_tc		= bnx2x_setup_tc,
	.ndo_setup_tc		= __bnx2x_setup_tc,
#ifdef CONFIG_BNX2X_SRIOV
	.ndo_set_vf_mac		= bnx2x_set_vf_mac,
	.ndo_set_vf_vlan	= bnx2x_set_vf_vlan,
+8 −1
Original line number Diff line number Diff line
@@ -5370,9 +5370,16 @@ static int bnxt_change_mtu(struct net_device *dev, int new_mtu)
	return 0;
}

static int bnxt_setup_tc(struct net_device *dev, 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 || 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",
Loading