Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[linux-2.6-microblaze.git] / drivers / net / ethernet / hisilicon / hns3 / hns3_enet.h
index 5d468ed..9d47abd 100644 (file)
@@ -76,7 +76,7 @@ enum hns3_nic_state {
 #define HNS3_RING_NAME_LEN                     16
 #define HNS3_BUFFER_SIZE_2048                  2048
 #define HNS3_RING_MAX_PENDING                  32760
-#define HNS3_RING_MIN_PENDING                  24
+#define HNS3_RING_MIN_PENDING                  72
 #define HNS3_RING_BD_MULTIPLE                  8
 /* max frame size of mac */
 #define HNS3_MAC_MAX_FRAME                     9728
@@ -186,7 +186,7 @@ enum hns3_nic_state {
 #define HNS3_TXD_MSS_S                         0
 #define HNS3_TXD_MSS_M                         (0x3fff << HNS3_TXD_MSS_S)
 
-#define HNS3_TX_LAST_SIZE_M                    0xffff
+#define HNS3_TX_LAST_SIZE_M                    0xffff
 
 #define HNS3_VECTOR_TX_IRQ                     BIT_ULL(0)
 #define HNS3_VECTOR_RX_IRQ                     BIT_ULL(1)
@@ -195,9 +195,13 @@ enum hns3_nic_state {
 #define HNS3_VECTOR_INITED                     1
 
 #define HNS3_MAX_BD_SIZE                       65535
-#define HNS3_MAX_BD_NUM_NORMAL                 8
-#define HNS3_MAX_BD_NUM_TSO                    63
-#define HNS3_MAX_BD_PER_PKT                    MAX_SKB_FRAGS
+#define HNS3_MAX_NON_TSO_BD_NUM                        8U
+#define HNS3_MAX_TSO_BD_NUM                    63U
+#define HNS3_MAX_TSO_SIZE \
+       (HNS3_MAX_BD_SIZE * HNS3_MAX_TSO_BD_NUM)
+
+#define HNS3_MAX_NON_TSO_SIZE \
+       (HNS3_MAX_BD_SIZE * HNS3_MAX_NON_TSO_BD_NUM)
 
 #define HNS3_VECTOR_GL0_OFFSET                 0x100
 #define HNS3_VECTOR_GL1_OFFSET                 0x200
@@ -309,7 +313,7 @@ struct hns3_desc_cb {
 
        u16 reuse_flag;
 
-       /* desc type, used by the ring user to mark the type of the priv data */
+       /* desc type, used by the ring user to mark the type of the priv data */
        u16 type;
 };
 
@@ -405,6 +409,7 @@ struct hns3_enet_ring {
        struct hns3_enet_ring *next;
        struct hns3_enet_tqp_vector *tqp_vector;
        struct hnae3_queue *tqp;
+       int queue_index;
        struct device *dev; /* will be used for DMA mapping of descriptors */
 
        /* statistic */
@@ -430,18 +435,7 @@ struct hns3_enet_ring {
        int pending_buf;
        struct sk_buff *skb;
        struct sk_buff *tail_skb;
-};
-
-struct hns_queue;
-
-struct hns3_nic_ring_data {
-       struct hns3_enet_ring *ring;
-       struct napi_struct napi;
-       int queue_index;
-       int (*poll_one)(struct hns3_nic_ring_data *, int, void *);
-       void (*ex_process)(struct hns3_nic_ring_data *, struct sk_buff *);
-       void (*fini_process)(struct hns3_nic_ring_data *);
-};
+} ____cacheline_internodealigned_in_smp;
 
 enum hns3_flow_level_range {
        HNS3_FLOW_LOW = 0,
@@ -518,7 +512,7 @@ struct hns3_nic_priv {
         * the cb for nic to manage the ring buffer, the first half of the
         * array is for tx_ring and vice versa for the second half
         */
-       struct hns3_nic_ring_data *ring_data;
+       struct hns3_enet_ring *ring;
        struct hns3_enet_tqp_vector *tqp_vector;
        u16 vector_num;
 
@@ -613,11 +607,11 @@ static inline bool hns3_nic_resetting(struct net_device *netdev)
 
 #define ring_to_dev(ring) ((ring)->dev)
 
+#define ring_to_netdev(ring)   ((ring)->tqp_vector->napi.dev)
+
 #define ring_to_dma_dir(ring) (HNAE3_IS_TX_RING(ring) ? \
        DMA_TO_DEVICE : DMA_FROM_DEVICE)
 
-#define tx_ring_data(priv, idx) ((priv)->ring_data[idx])
-
 #define hns3_buf_size(_ring) ((_ring)->buf_size)
 
 static inline unsigned int hns3_page_order(struct hns3_enet_ring *ring)