]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/ixgbe/ixgbe.h
ixgbe: add a netdev pointer to the ring structure
[net-next-2.6.git] / drivers / net / ixgbe / ixgbe.h
index 9e15eb93860eb4686ad79ca5058de708ff2bda72..dc4b97e5777f7d9a43a70f32fbbad4e1e12cea4f 100644 (file)
 #ifndef _IXGBE_H_
 #define _IXGBE_H_
 
+#include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/pci.h>
 #include <linux/netdevice.h>
+#include <linux/cpumask.h>
 #include <linux/aer.h>
+#include <linux/if_vlan.h>
 
 #include "ixgbe_type.h"
 #include "ixgbe_common.h"
 #define IXGBE_MIN_RXD                       64
 
 /* flow control */
-#define IXGBE_DEFAULT_FCRTL            0x10000
 #define IXGBE_MIN_FCRTL                           0x40
 #define IXGBE_MAX_FCRTL                        0x7FF80
-#define IXGBE_DEFAULT_FCRTH            0x20000
 #define IXGBE_MIN_FCRTH                          0x600
 #define IXGBE_MAX_FCRTH                        0x7FFF0
 #define IXGBE_DEFAULT_FCPAUSE           0xFFFF
 #define IXGBE_MAX_FCPAUSE               0xFFFF
 
 /* Supported Rx Buffer Sizes */
-#define IXGBE_RXBUFFER_64    64     /* Used for packet split */
-#define IXGBE_RXBUFFER_128   128    /* Used for packet split */
-#define IXGBE_RXBUFFER_256   256    /* Used for packet split */
+#define IXGBE_RXBUFFER_512   512    /* Used for packet split */
 #define IXGBE_RXBUFFER_2048  2048
 #define IXGBE_RXBUFFER_4096  4096
 #define IXGBE_RXBUFFER_8192  8192
 #define IXGBE_MAX_RXBUFFER   16384  /* largest size for a single descriptor */
 
-#define IXGBE_RX_HDR_SIZE IXGBE_RXBUFFER_256
+/*
+ * NOTE: netdev_alloc_skb reserves up to 64 bytes, NET_IP_ALIGN mans we
+ * reserve 2 more, and skb_shared_info adds an additional 384 bytes more,
+ * this adds up to 512 bytes of extra data meaning the smallest allocation
+ * we could have is 1K.
+ * i.e. RXBUFFER_512 --> size-1024 slab
+ */
+#define IXGBE_RX_HDR_SIZE IXGBE_RXBUFFER_512
 
 #define MAXIMUM_ETHERNET_VLAN_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)
 
@@ -122,7 +128,9 @@ struct ixgbe_tx_buffer {
        unsigned long time_stamp;
        u16 length;
        u16 next_to_watch;
-       u16 mapped_as_page;
+       unsigned int bytecount;
+       u16 gso_segs;
+       u8 mapped_as_page;
 };
 
 struct ixgbe_rx_buffer {
@@ -138,8 +146,23 @@ struct ixgbe_queue_stats {
        u64 bytes;
 };
 
+struct ixgbe_tx_queue_stats {
+       u64 restart_queue;
+       u64 tx_busy;
+};
+
+struct ixgbe_rx_queue_stats {
+       u64 rsc_count;
+       u64 rsc_flush;
+       u64 non_eop_descs;
+       u64 alloc_rx_page_failed;
+       u64 alloc_rx_buff_failed;
+};
+
 struct ixgbe_ring {
        void *desc;                     /* descriptor ring memory */
+       struct device *dev;             /* device for DMA mapping */
+       struct net_device *netdev;      /* netdev ring belongs to */
        union {
                struct ixgbe_tx_buffer *tx_buffer_info;
                struct ixgbe_rx_buffer *rx_buffer_info;
@@ -155,8 +178,7 @@ struct ixgbe_ring {
 
 #define IXGBE_RING_RX_PS_ENABLED                (u8)(1)
        u8 flags;                       /* per ring feature flags */
-       u16 head;
-       u16 tail;
+       u8 __iomem *tail;
 
        unsigned int total_bytes;
        unsigned int total_packets;
@@ -174,15 +196,16 @@ struct ixgbe_ring {
                                         */
 
        struct ixgbe_queue_stats stats;
+       struct u64_stats_sync syncp;
+       union {
+               struct ixgbe_tx_queue_stats tx_stats;
+               struct ixgbe_rx_queue_stats rx_stats;
+       };
        unsigned long reinit_state;
        int numa_node;
-       u64 rsc_count;                  /* stat for coalesced packets */
-       u64 rsc_flush;                  /* stats for flushed packets */
-       u32 restart_queue;              /* track tx queue restarts */
-       u32 non_eop_descs;              /* track hardware descriptor chaining */
-
        unsigned int size;              /* length in bytes */
        dma_addr_t dma;                 /* phys. address of descriptor ring */
+       struct rcu_head rcu;
 } ____cacheline_internodealigned_in_smp;
 
 enum ixgbe_ring_f_enum {
@@ -236,6 +259,7 @@ struct ixgbe_q_vector {
        u8 tx_itr;
        u8 rx_itr;
        u32 eitr;
+       cpumask_var_t affinity_mask;
 };
 
 /* Helper macros to switch between ints/sec and what the register uses.
@@ -251,11 +275,11 @@ struct ixgbe_q_vector {
        (R)->next_to_clean - (R)->next_to_use - 1)
 
 #define IXGBE_RX_DESC_ADV(R, i)            \
-       (&(((union ixgbe_adv_rx_desc *)((R).desc))[i]))
+       (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i]))
 #define IXGBE_TX_DESC_ADV(R, i)            \
-       (&(((union ixgbe_adv_tx_desc *)((R).desc))[i]))
+       (&(((union ixgbe_adv_tx_desc *)((R)->desc))[i]))
 #define IXGBE_TX_CTXTDESC_ADV(R, i)        \
-       (&(((struct ixgbe_adv_tx_context_desc *)((R).desc))[i]))
+       (&(((struct ixgbe_adv_tx_context_desc *)((R)->desc))[i]))
 
 #define IXGBE_MAX_JUMBO_FRAME_SIZE        16128
 #ifdef IXGBE_FCOE
@@ -280,7 +304,7 @@ struct ixgbe_q_vector {
 /* board specific private data structure */
 struct ixgbe_adapter {
        struct timer_list watchdog_timer;
-       struct vlan_group *vlgrp;
+       unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
        u16 bd_number;
        struct work_struct reset_task;
        struct ixgbe_q_vector *q_vector[MAX_MSIX_Q_VECTORS];
@@ -444,13 +468,21 @@ extern void ixgbe_down(struct ixgbe_adapter *adapter);
 extern void ixgbe_reinit_locked(struct ixgbe_adapter *adapter);
 extern void ixgbe_reset(struct ixgbe_adapter *adapter);
 extern void ixgbe_set_ethtool_ops(struct net_device *netdev);
-extern int ixgbe_setup_rx_resources(struct ixgbe_adapter *, struct ixgbe_ring *);
-extern int ixgbe_setup_tx_resources(struct ixgbe_adapter *, struct ixgbe_ring *);
-extern void ixgbe_free_rx_resources(struct ixgbe_adapter *, struct ixgbe_ring *);
-extern void ixgbe_free_tx_resources(struct ixgbe_adapter *, struct ixgbe_ring *);
+extern int ixgbe_setup_rx_resources(struct ixgbe_ring *);
+extern int ixgbe_setup_tx_resources(struct ixgbe_ring *);
+extern void ixgbe_free_rx_resources(struct ixgbe_ring *);
+extern void ixgbe_free_tx_resources(struct ixgbe_ring *);
+extern void ixgbe_configure_rx_ring(struct ixgbe_adapter *,struct ixgbe_ring *);
+extern void ixgbe_configure_tx_ring(struct ixgbe_adapter *,struct ixgbe_ring *);
 extern void ixgbe_update_stats(struct ixgbe_adapter *adapter);
 extern int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter);
 extern void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter);
+extern netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *,
+                                        struct ixgbe_adapter *,
+                                        struct ixgbe_ring *);
+extern void ixgbe_unmap_and_free_tx_resource(struct ixgbe_ring *,
+                                             struct ixgbe_tx_buffer *);
+extern void ixgbe_alloc_rx_buffers(struct ixgbe_ring *, u16);
 extern void ixgbe_write_eitr(struct ixgbe_q_vector *);
 extern int ethtool_ioctl(struct ifreq *ifr);
 extern s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw);