Thread (9 messages) 9 messages, 4 authors, 2010-02-04

Re: [RFC] [PATCH] net: Add support for ndo_select_queue() functions to cache the queue mapping

From: Ben Hutchings <hidden>
Date: 2010-01-28 18:41:04

On Fri, 2010-01-29 at 00:11 +0530, Krishna Kumar2 wrote:
quoted
Ben Hutchings [off-list ref]

On Thu, 2010-01-28 at 23:39 +0530, Krishna Kumar2 wrote:
[...]
quoted
quoted
Other than that, I saw netif_sk_tx_queue_set is not called.
And dev_pick_tx has already capped automatically, you probably
don't need another here?
Only the return value of ndo_select_queue() is capped; the cached value
is assumed to be valid.
+void netif_sk_tx_queue_set(struct net_device *dev, struct sock *sk,
+                             u16 queue_index)
+{
+     sk_tx_queue_set(sk, dev_cap_txqueue(dev, queue_index));
+}

I guess I didn't understand this then, who calls this function?
[...]

The driver's ndo_select_queue() implementation calls it before
returning, if and only if sk_may_set_tx_queue() is true and its
selection is dependent only on the flow id.

As an example, ixgbe's selection function:

        static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb)
        {
        	struct ixgbe_adapter *adapter = netdev_priv(dev);
        	int txq = smp_processor_id();
        
        	if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)
        		return txq;
        
        #ifdef IXGBE_FCOE
        	if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) &&
        	    (skb->protocol == htons(ETH_P_FCOE))) {
        		txq &= (adapter->ring_feature[RING_F_FCOE].indices - 1);
        		txq += adapter->ring_feature[RING_F_FCOE].mask;
        		return txq;
        	}
        #endif
        	if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
        		return (skb->vlan_tci & IXGBE_TX_FLAGS_VLAN_PRIO_MASK) >> 13;
        
        	return skb_tx_hash(dev, skb);
        }
        
would not call netif_sk_tx_queue_set() in the first two cases, but could
do so in the last two cases if sk_may_set_tx_queue(skb->sk) is true.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help