summaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe.h
diff options
context:
space:
mode:
authorAlexander Duyck2011-05-27 07:31:52 +0200
committerJeff Kirsher2011-06-25 09:06:51 +0200
commita535c30e9e98d201089503a0ffa0093cba16e796 (patch)
tree5e15e3c107edf07b3d6e2d4dc834a43cdf75b52e /drivers/net/ixgbe/ixgbe.h
parentixgbe: Add one function that handles most of context descriptor setup (diff)
downloadkernel-qcow2-linux-a535c30e9e98d201089503a0ffa0093cba16e796.tar.gz
kernel-qcow2-linux-a535c30e9e98d201089503a0ffa0093cba16e796.tar.xz
kernel-qcow2-linux-a535c30e9e98d201089503a0ffa0093cba16e796.zip
ixgbe: Update method used for determining descriptor count for an skb
This patch updates the current methods used for determining if we have enough space to transmit a given skb. The current method is quite wasteful as it has us go through and determine how each page is going to be broken up. That only needs to be done if pages are larger than our maximum data per TXD. As such I have wrapped that in a page size check. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe.h')
-rw-r--r--drivers/net/ixgbe/ixgbe.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index 393ceae7f3df..744b64108130 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -131,6 +131,13 @@ struct vf_macvlans {
u8 vf_macvlan[ETH_ALEN];
};
+#define IXGBE_MAX_TXD_PWR 14
+#define IXGBE_MAX_DATA_PER_TXD (1 << IXGBE_MAX_TXD_PWR)
+
+/* Tx Descriptors needed, worst case */
+#define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IXGBE_MAX_DATA_PER_TXD)
+#define DESC_NEEDED ((MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE)) + 4)
+
/* wrapper around a pointer to a socket buffer,
* so a DMA handle can be stored along with the buffer */
struct ixgbe_tx_buffer {