]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ixgbe: Modify setup of descriptor flags to avoid conditional jumps
authorAlexander Duyck <alexander.h.duyck@intel.com>
Wed, 8 Feb 2012 07:50:45 +0000 (07:50 +0000)
committerJoe Jin <joe.jin@oracle.com>
Thu, 17 May 2012 15:12:17 +0000 (23:12 +0800)
This change makes it more likely that the descriptor flags setup will use
cmov instructions instead of conditional jumps when setting up the flags.
The advantage to this is that the code should just flow a bit more
smoothly.

To do this it is necessary to set the TX_FLAGS_CSUM bit in tx_flags when
doing TSO so that we also do the checksum in addition to the segmentation
offload.

(cherry picked from commit 93f5b3c1f148f2cca247a2c5afdd3ba7a123a6f1)
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/ixgbe/ixgbe_main.c

index f4d6baf9feea91b0c318b9c49ee82f993161135b..60f0969d5362b842941de659d973dbcc161ba978 100644 (file)
@@ -6646,7 +6646,7 @@ static __le32 ixgbe_tx_cmd_type(u32 tx_flags)
 
        /* set segmentation enable bits for TSO/FSO */
 #ifdef IXGBE_FCOE
-       if ((tx_flags & IXGBE_TX_FLAGS_TSO) || (tx_flags & IXGBE_TX_FLAGS_FSO))
+       if (tx_flags & (IXGBE_TX_FLAGS_TSO | IXGBE_TX_FLAGS_FSO))
 #else
        if (tx_flags & IXGBE_TX_FLAGS_TSO)
 #endif
@@ -6657,33 +6657,33 @@ static __le32 ixgbe_tx_cmd_type(u32 tx_flags)
 
 static __le32 ixgbe_tx_olinfo_status(u32 tx_flags, unsigned int paylen)
 {
-       __le32 olinfo_status =
-               cpu_to_le32(paylen << IXGBE_ADVTXD_PAYLEN_SHIFT);
-
-       if (tx_flags & IXGBE_TX_FLAGS_TSO) {
-               olinfo_status |= cpu_to_le32(IXGBE_ADVTXD_POPTS_TXSM |
-                                           (1 << IXGBE_ADVTXD_IDX_SHIFT));
-               /* enble IPv4 checksum for TSO */
-               if (tx_flags & IXGBE_TX_FLAGS_IPV4)
-                       olinfo_status |= cpu_to_le32(IXGBE_ADVTXD_POPTS_IXSM);
-       }
+       __le32 olinfo_status = cpu_to_le32(paylen << IXGBE_ADVTXD_PAYLEN_SHIFT);
 
        /* enable L4 checksum for TSO and TX checksum offload */
        if (tx_flags & IXGBE_TX_FLAGS_CSUM)
                olinfo_status |= cpu_to_le32(IXGBE_ADVTXD_POPTS_TXSM);
 
-#ifdef IXGBE_FCOE
-       /* use index 1 context for FCOE/FSO */
-       if (tx_flags & IXGBE_TX_FLAGS_FCOE)
-               olinfo_status |= cpu_to_le32(IXGBE_ADVTXD_CC |
-                                           (1 << IXGBE_ADVTXD_IDX_SHIFT));
+       /* enble IPv4 checksum for TSO */
+       if (tx_flags & IXGBE_TX_FLAGS_IPV4)
+               olinfo_status |= cpu_to_le32(IXGBE_ADVTXD_POPTS_IXSM);
 
+       /* use index 1 context for TSO/FSO/FCOE */
+#ifdef IXGBE_FCOE
+       if (tx_flags & (IXGBE_TX_FLAGS_TSO | IXGBE_TX_FLAGS_FCOE))
+#else
+       if (tx_flags & IXGBE_TX_FLAGS_TSO)
 #endif
+               olinfo_status |= cpu_to_le32(1 << IXGBE_ADVTXD_IDX_SHIFT);
+
        /*
         * Check Context must be set if Tx switch is enabled, which it
         * always is for case where virtual functions are running
         */
+#ifdef IXGBE_FCOE
+       if (tx_flags & (IXGBE_TX_FLAGS_TXSW | IXGBE_TX_FLAGS_FCOE))
+#else
        if (tx_flags & IXGBE_TX_FLAGS_TXSW)
+#endif
                olinfo_status |= cpu_to_le32(IXGBE_ADVTXD_CC);
 
        return olinfo_status;
@@ -7093,7 +7093,7 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
        if (tso < 0)
                goto out_drop;
        else if (tso)
-               tx_flags |= IXGBE_TX_FLAGS_TSO;
+               tx_flags |= IXGBE_TX_FLAGS_TSO | IXGBE_TX_FLAGS_CSUM;
        else if (ixgbe_tx_csum(tx_ring, skb, tx_flags, protocol))
                tx_flags |= IXGBE_TX_FLAGS_CSUM;