From: Alexander Duyck Date: Thu, 7 Feb 2013 08:55:46 +0000 (+0000) Subject: igb: Pull adapter out of main path in igb_xmit_frame_ring X-Git-Tag: v3.10-rc1~66^2~98^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b646c22edef1c350d26237a6f60d3a890ceedf6e;p=platform%2Fkernel%2Flinux-stable.git igb: Pull adapter out of main path in igb_xmit_frame_ring We only need the adapter pointer in the case of ptp. As such we can pull the adapter out of the main path and place it inside the if statement to avoid the temptation of accessing the adapter pointer in the fast path. Signed-off-by: Alexander Duyck Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher --- diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 2f3dab0..d27eb4e 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -4593,7 +4593,6 @@ static inline int igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size) netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, struct igb_ring *tx_ring) { - struct igb_adapter *adapter = netdev_priv(tx_ring->netdev); struct igb_tx_buffer *first; int tso; u32 tx_flags = 0; @@ -4628,15 +4627,18 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, skb_tx_timestamp(skb); - if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && - !(adapter->ptp_tx_skb))) { - skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; - tx_flags |= IGB_TX_FLAGS_TSTAMP; + if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { + struct igb_adapter *adapter = netdev_priv(tx_ring->netdev); - adapter->ptp_tx_skb = skb_get(skb); - adapter->ptp_tx_start = jiffies; - if (adapter->hw.mac.type == e1000_82576) - schedule_work(&adapter->ptp_tx_work); + if (!(adapter->ptp_tx_skb)) { + skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; + tx_flags |= IGB_TX_FLAGS_TSTAMP; + + adapter->ptp_tx_skb = skb_get(skb); + adapter->ptp_tx_start = jiffies; + if (adapter->hw.mac.type == e1000_82576) + schedule_work(&adapter->ptp_tx_work); + } } if (vlan_tx_tag_present(skb)) {