vmxnet3: add receive data ring support
[cascardo/linux.git] / drivers / net / vmxnet3 / vmxnet3_int.h
index c482539..c46bf09 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Linux driver for VMware's vmxnet3 ethernet NIC.
  *
- * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved.
+ * Copyright (C) 2008-2016, VMware, Inc. All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -20,7 +20,7 @@
  * The full GNU General Public License is included in this distribution in
  * the file called "COPYING".
  *
- * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com>
+ * Maintained by: pv-drivers@vmware.com
  *
  */
 
 /*
  * Version numbers
  */
-#define VMXNET3_DRIVER_VERSION_STRING   "1.4.7.0-k"
+#define VMXNET3_DRIVER_VERSION_STRING   "1.4.8.0-k"
 
 /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
-#define VMXNET3_DRIVER_VERSION_NUM      0x01040700
+#define VMXNET3_DRIVER_VERSION_NUM      0x01040800
 
 #if defined(CONFIG_PCI_MSI)
        /* RSS only makes sense if MSI-X is supported. */
        #define VMXNET3_RSS
 #endif
 
+#define VMXNET3_REV_3          2       /* Vmxnet3 Rev. 3 */
+#define VMXNET3_REV_2          1       /* Vmxnet3 Rev. 2 */
+#define VMXNET3_REV_1          0       /* Vmxnet3 Rev. 1 */
+
 /*
  * Capabilities
  */
@@ -237,6 +241,7 @@ struct vmxnet3_tx_queue {
        int                             num_stop;  /* # of times the queue is
                                                    * stopped */
        int                             qid;
+       u16                             txdata_desc_size;
 } __attribute__((__aligned__(SMP_CACHE_BYTES)));
 
 enum vmxnet3_rx_buf_type {
@@ -267,15 +272,23 @@ struct vmxnet3_rq_driver_stats {
        u64 rx_buf_alloc_failure;
 };
 
+struct vmxnet3_rx_data_ring {
+       Vmxnet3_RxDataDesc *base;
+       dma_addr_t basePA;
+       u16 desc_size;
+};
+
 struct vmxnet3_rx_queue {
        char                    name[IFNAMSIZ + 8]; /* To identify interrupt */
        struct vmxnet3_adapter    *adapter;
        struct napi_struct        napi;
        struct vmxnet3_cmd_ring   rx_ring[2];
+       struct vmxnet3_rx_data_ring data_ring;
        struct vmxnet3_comp_ring  comp_ring;
        struct vmxnet3_rx_ctx     rx_ctx;
        u32 qid;            /* rqID in RCD for buffer from 1st ring */
        u32 qid2;           /* rqID in RCD for buffer from 2nd ring */
+       u32 dataRingQid;    /* rqID in RCD for buffer from data ring */
        struct vmxnet3_rx_buf_info     *buf_info[2];
        dma_addr_t                      buf_info_pa;
        struct Vmxnet3_RxQueueCtrl            *shared;
@@ -359,6 +372,12 @@ struct vmxnet3_adapter {
        u32 rx_ring_size;
        u32 rx_ring2_size;
 
+       /* Size of buffer in the data ring */
+       u16 txdata_desc_size;
+       u16 rxdata_desc_size;
+
+       bool rxdataring_enabled;
+
        struct work_struct work;
 
        unsigned long  state;    /* VMXNET3_STATE_BIT_xxx */
@@ -387,14 +406,29 @@ struct vmxnet3_adapter {
 #define VMXNET3_GET_ADDR_LO(dma)   ((u32)(dma))
 #define VMXNET3_GET_ADDR_HI(dma)   ((u32)(((u64)(dma)) >> 32))
 
+#define VMXNET3_VERSION_GE_2(adapter) \
+       (adapter->version >= VMXNET3_REV_2 + 1)
+#define VMXNET3_VERSION_GE_3(adapter) \
+       (adapter->version >= VMXNET3_REV_3 + 1)
+
 /* must be a multiple of VMXNET3_RING_SIZE_ALIGN */
 #define VMXNET3_DEF_TX_RING_SIZE    512
 #define VMXNET3_DEF_RX_RING_SIZE    256
 #define VMXNET3_DEF_RX_RING2_SIZE   128
 
+#define VMXNET3_DEF_RXDATA_DESC_SIZE 128
+
 #define VMXNET3_MAX_ETH_HDR_SIZE    22
 #define VMXNET3_MAX_SKB_BUF_SIZE    (3*1024)
 
+#define VMXNET3_GET_RING_IDX(adapter, rqID)            \
+       ((rqID >= adapter->num_rx_queues &&             \
+        rqID < 2 * adapter->num_rx_queues) ? 1 : 0)    \
+
+#define VMXNET3_RX_DATA_RING(adapter, rqID)            \
+       (rqID >= 2 * adapter->num_rx_queues &&          \
+       rqID < 3 * adapter->num_rx_queues)              \
+
 int
 vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter);
 
@@ -418,7 +452,8 @@ vmxnet3_set_features(struct net_device *netdev, netdev_features_t features);
 
 int
 vmxnet3_create_queues(struct vmxnet3_adapter *adapter,
-                     u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size);
+                     u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size,
+                     u16 txdata_desc_size, u16 rxdata_desc_size);
 
 void vmxnet3_set_ethtool_ops(struct net_device *netdev);