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

Commit 99932d4f authored by Daniel Borkmann's avatar Daniel Borkmann Committed by David S. Miller
Browse files

netdevice: add queue selection fallback handler for ndo_select_queue



Add a new argument for ndo_select_queue() callback that passes a
fallback handler. This gets invoked through netdev_pick_tx();
fallback handler is currently __netdev_pick_tx() as most drivers
invoke this function within their customized implementation in
case for skbs that don't need any special handling. This fallback
handler can then be replaced on other call-sites with different
queue selection methods (e.g. in packet sockets, pktgen etc).

This also has the nice side-effect that __netdev_pick_tx() is
then only invoked from netdev_pick_tx() and export of that
function to modules can be undone.

Suggested-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarDaniel Borkmann <dborkman@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c321f7d7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3707,7 +3707,7 @@ static inline int bond_slave_override(struct bonding *bond,


static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb,
			     void *accel_priv)
			     void *accel_priv, select_queue_fallback_t fallback)
{
	/*
	 * This helper function exists to help dev_pick_tx get the correct
+2 −2
Original line number Diff line number Diff line
@@ -1873,7 +1873,7 @@ void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw)
}

u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb,
		       void *accel_priv)
		       void *accel_priv, select_queue_fallback_t fallback)
{
	struct bnx2x *bp = netdev_priv(dev);

@@ -1895,7 +1895,7 @@ u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb,
	}

	/* select a non-FCoE queue */
	return __netdev_pick_tx(dev, skb) % BNX2X_NUM_ETH_QUEUES(bp);
	return fallback(dev, skb) % BNX2X_NUM_ETH_QUEUES(bp);
}

void bnx2x_set_num_queues(struct bnx2x *bp)
+1 −1
Original line number Diff line number Diff line
@@ -496,7 +496,7 @@ int bnx2x_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos);

/* select_queue callback */
u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb,
		       void *accel_priv);
		       void *accel_priv, select_queue_fallback_t fallback);

static inline void bnx2x_update_rx_prod(struct bnx2x *bp,
					struct bnx2x_fastpath *fp,
+3 −3
Original line number Diff line number Diff line
@@ -6881,7 +6881,7 @@ static inline int ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, u16 size)
}

static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb,
			      void *accel_priv)
			      void *accel_priv, select_queue_fallback_t fallback)
{
	struct ixgbe_fwd_adapter *fwd_adapter = accel_priv;
#ifdef IXGBE_FCOE
@@ -6907,7 +6907,7 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb,
		if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
			break;
	default:
		return __netdev_pick_tx(dev, skb);
		return fallback(dev, skb);
	}

	f = &adapter->ring_feature[RING_F_FCOE];
@@ -6920,7 +6920,7 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb,

	return txq + f->offset;
#else
	return __netdev_pick_tx(dev, skb);
	return fallback(dev, skb);
#endif
}

+1 −1
Original line number Diff line number Diff line
@@ -619,7 +619,7 @@ ltq_etop_set_multicast_list(struct net_device *dev)

static u16
ltq_etop_select_queue(struct net_device *dev, struct sk_buff *skb,
		      void *accel_priv)
		      void *accel_priv, select_queue_fallback_t fallback)
{
	/* we are currently only using the first queue */
	return 0;
Loading