qede: Better utilize the qede_[rt]x_queue
[linux-2.6-block.git] / drivers / net / ethernet / qlogic / qede / qede.h
index 28c0e9f42c9e777611ab085249a2efc74201a6e6..ec372daeba6b81fde31c62dfde69bfa6372cce74 100644 (file)
@@ -127,10 +127,9 @@ struct qede_dev {
 
        const struct qed_eth_ops        *ops;
 
-       struct qed_dev_eth_info dev_info;
+       struct qed_dev_eth_info dev_info;
 #define QEDE_MAX_RSS_CNT(edev) ((edev)->dev_info.num_queues)
-#define QEDE_MAX_TSS_CNT(edev) ((edev)->dev_info.num_queues * \
-                                (edev)->dev_info.num_tc)
+#define QEDE_MAX_TSS_CNT(edev) ((edev)->dev_info.num_queues)
 
        struct qede_fastpath            *fp_array;
        u8                              req_num_tx;
@@ -139,17 +138,9 @@ struct qede_dev {
        u8                              fp_num_rx;
        u16                             req_queues;
        u16                             num_queues;
-       u8                              num_tc;
 #define QEDE_QUEUE_CNT(edev)   ((edev)->num_queues)
 #define QEDE_RSS_COUNT(edev)   ((edev)->num_queues - (edev)->fp_num_tx)
-#define QEDE_TSS_COUNT(edev)   (((edev)->num_queues - (edev)->fp_num_rx) * \
-                                (edev)->num_tc)
-#define QEDE_TX_IDX(edev, txqidx)      ((edev)->fp_num_rx + (txqidx) % \
-                                        QEDE_TSS_COUNT(edev))
-#define QEDE_TC_IDX(edev, txqidx)      ((txqidx) / QEDE_TSS_COUNT(edev))
-#define QEDE_TX_QUEUE(edev, txqidx)    \
-       (&(edev)->fp_array[QEDE_TX_IDX((edev), (txqidx))].txqs[QEDE_TC_IDX(\
-                                                       (edev), (txqidx))])
+#define QEDE_TSS_COUNT(edev)   ((edev)->num_queues - (edev)->fp_num_rx)
 
        struct qed_int_info             int_info;
        unsigned char                   primary_mac[ETH_ALEN];
@@ -193,6 +184,8 @@ struct qede_dev {
        u16                             vxlan_dst_port;
        u16                             geneve_dst_port;
 
+       bool wol_enabled;
+
        struct qede_rdma_dev            rdma_info;
 };
 
@@ -223,39 +216,62 @@ enum qede_agg_state {
 };
 
 struct qede_agg_info {
-       struct sw_rx_data replace_buf;
-       dma_addr_t replace_buf_mapping;
-       struct sw_rx_data start_buf;
-       dma_addr_t start_buf_mapping;
-       struct eth_fast_path_rx_tpa_start_cqe start_cqe;
-       enum qede_agg_state agg_state;
+       /* rx_buf is a data buffer that can be placed / consumed from rx bd
+        * chain. It has two purposes: We will preallocate the data buffer
+        * for each aggregation when we open the interface and will place this
+        * buffer on the rx-bd-ring when we receive TPA_START. We don't want
+        * to be in a state where allocation fails, as we can't reuse the
+        * consumer buffer in the rx-chain since FW may still be writing to it
+        * (since header needs to be modified for TPA).
+        * The second purpose is to keep a pointer to the bd buffer during
+        * aggregation.
+        */
+       struct sw_rx_data buffer;
+       dma_addr_t buffer_mapping;
+
        struct sk_buff *skb;
-       int frag_id;
+
+       /* We need some structs from the start cookie until termination */
        u16 vlan_tag;
+       u16 start_cqe_bd_len;
+       u8 start_cqe_placement_offset;
+
+       u8 state;
+       u8 frag_id;
+
+       u8 tunnel_type;
 };
 
 struct qede_rx_queue {
-       __le16                  *hw_cons_ptr;
-       struct sw_rx_data       *sw_rx_ring;
-       u16                     sw_rx_cons;
-       u16                     sw_rx_prod;
-       struct qed_chain        rx_bd_ring;
-       struct qed_chain        rx_comp_ring;
-       void __iomem            *hw_rxq_prod_addr;
+       __le16 *hw_cons_ptr;
+       void __iomem *hw_rxq_prod_addr;
 
-       /* GRO */
-       struct qede_agg_info    tpa_info[ETH_TPA_MAX_AGGS_NUM];
+       /* Required for the allocation of replacement buffers */
+       struct device *dev;
+
+       u16 sw_rx_cons;
+       u16 sw_rx_prod;
+
+       u16 num_rx_buffers; /* Slowpath */
+       u8 rxq_id;
+
+       u32 rx_buf_size;
+       u32 rx_buf_seg_size;
 
-       int                     rx_buf_size;
-       unsigned int            rx_buf_seg_size;
+       u64 rcv_pkts;
 
-       u16                     num_rx_buffers;
-       u16                     rxq_id;
+       struct sw_rx_data *sw_rx_ring;
+       struct qed_chain rx_bd_ring;
+       struct qed_chain rx_comp_ring ____cacheline_aligned;
 
-       u64                     rcv_pkts;
-       u64                     rx_hw_errors;
-       u64                     rx_alloc_errors;
-       u64                     rx_ip_frags;
+       /* GRO */
+       struct qede_agg_info tpa_info[ETH_TPA_MAX_AGGS_NUM];
+
+       u64 rx_hw_errors;
+       u64 rx_alloc_errors;
+       u64 rx_ip_frags;
+
+       void *handle;
 };
 
 union db_prod {
@@ -271,20 +287,28 @@ struct sw_tx_bd {
 };
 
 struct qede_tx_queue {
-       int                     index; /* Queue index */
-       __le16                  *hw_cons_ptr;
-       struct sw_tx_bd         *sw_tx_ring;
-       u16                     sw_tx_cons;
-       u16                     sw_tx_prod;
-       struct qed_chain        tx_pbl;
-       void __iomem            *doorbell_addr;
-       union db_prod           tx_db;
-
-       u16                     num_tx_buffers;
-       u64                     xmit_pkts;
-       u64                     stopped_cnt;
-
-       bool                    is_legacy;
+       bool is_legacy;
+       u16 sw_tx_cons;
+       u16 sw_tx_prod;
+       u16 num_tx_buffers; /* Slowpath only */
+
+       u64 xmit_pkts;
+       u64 stopped_cnt;
+
+       __le16 *hw_cons_ptr;
+
+       /* Needed for the mapping of packets */
+       struct device *dev;
+
+       void __iomem *doorbell_addr;
+       union db_prod tx_db;
+       int index; /* Slowpath only */
+
+       struct sw_tx_bd *sw_tx_ring;
+       struct qed_chain tx_pbl;
+
+       /* Slowpath; Should be kept in end [unless missing padding] */
+       void *handle;
 };
 
 #define BD_UNMAP_ADDR(bd)              HILO_U64(le32_to_cpu((bd)->addr.hi), \
@@ -307,7 +331,7 @@ struct qede_fastpath {
        struct napi_struct      napi;
        struct qed_sb_info      *sb_info;
        struct qede_rx_queue    *rxq;
-       struct qede_tx_queue    *txqs;
+       struct qede_tx_queue    *txq;
 
 #define VEC_NAME_SIZE  (sizeof(((struct net_device *)0)->name) + 8)
        char    name[VEC_NAME_SIZE];
@@ -320,6 +344,7 @@ struct qede_fastpath {
 #define XMIT_L4_CSUM           BIT(0)
 #define XMIT_LSO               BIT(1)
 #define XMIT_ENC               BIT(2)
+#define XMIT_ENC_GSO_L4_CSUM   BIT(3)
 
 #define QEDE_CSUM_ERROR                        BIT(0)
 #define QEDE_CSUM_UNNECESSARY          BIT(1)
@@ -329,8 +354,12 @@ struct qede_fastpath {
 #define QEDE_SP_VXLAN_PORT_CONFIG      2
 #define QEDE_SP_GENEVE_PORT_CONFIG     3
 
-union qede_reload_args {
-       u16 mtu;
+struct qede_reload_args {
+       void (*func)(struct qede_dev *edev, struct qede_reload_args *args);
+       union {
+               netdev_features_t features;
+               u16 mtu;
+       } u;
 };
 
 #ifdef CONFIG_DCB
@@ -339,21 +368,21 @@ void qede_set_dcbnl_ops(struct net_device *ndev);
 void qede_config_debug(uint debug, u32 *p_dp_module, u8 *p_dp_level);
 void qede_set_ethtool_ops(struct net_device *netdev);
 void qede_reload(struct qede_dev *edev,
-                void (*func)(struct qede_dev *edev,
-                             union qede_reload_args *args),
-                union qede_reload_args *args);
+                struct qede_reload_args *args, bool is_locked);
 int qede_change_mtu(struct net_device *dev, int new_mtu);
 void qede_fill_by_demand_stats(struct qede_dev *edev);
+void __qede_lock(struct qede_dev *edev);
+void __qede_unlock(struct qede_dev *edev);
 bool qede_has_rx_work(struct qede_rx_queue *rxq);
 int qede_txq_has_work(struct qede_tx_queue *txq);
-void qede_recycle_rx_bd_ring(struct qede_rx_queue *rxq, struct qede_dev *edev,
-                            u8 count);
+void qede_recycle_rx_bd_ring(struct qede_rx_queue *rxq, u8 count);
+void qede_update_rx_prod(struct qede_dev *edev, struct qede_rx_queue *rxq);
 
 #define RX_RING_SIZE_POW       13
 #define RX_RING_SIZE           ((u16)BIT(RX_RING_SIZE_POW))
 #define NUM_RX_BDS_MAX         (RX_RING_SIZE - 1)
 #define NUM_RX_BDS_MIN         128
-#define NUM_RX_BDS_DEF         NUM_RX_BDS_MAX
+#define NUM_RX_BDS_DEF         ((u16)BIT(10) - 1)
 
 #define TX_RING_SIZE_POW       13
 #define TX_RING_SIZE           ((u16)BIT(TX_RING_SIZE_POW))
@@ -361,8 +390,9 @@ void qede_recycle_rx_bd_ring(struct qede_rx_queue *rxq, struct qede_dev *edev,
 #define NUM_TX_BDS_MIN         128
 #define NUM_TX_BDS_DEF         NUM_TX_BDS_MAX
 
-#define QEDE_MIN_PKT_LEN       64
-#define QEDE_RX_HDR_SIZE       256
+#define QEDE_MIN_PKT_LEN               64
+#define QEDE_RX_HDR_SIZE               256
+#define QEDE_MAX_JUMBO_PACKET_SIZE     9600
 #define        for_each_queue(i) for (i = 0; i < edev->num_queues; i++)
 
 #endif /* _QEDE_H_ */