net/mlx4_en: Add support for setting rxvlan offload OFF/ON
[cascardo/linux.git] / drivers / net / ethernet / mellanox / mlx4 / mlx4_en.h
index 3de41be..6beb4d3 100644 (file)
@@ -216,13 +216,16 @@ enum cq_type {
 
 struct mlx4_en_tx_info {
        struct sk_buff *skb;
-       u32 nr_txbb;
-       u32 nr_bytes;
-       u8 linear;
-       u8 data_offset;
-       u8 inl;
-       u8 ts_requested;
-};
+       dma_addr_t      map0_dma;
+       u32             map0_byte_count;
+       u32             nr_txbb;
+       u32             nr_bytes;
+       u8              linear;
+       u8              data_offset;
+       u8              inl;
+       u8              ts_requested;
+       u8              nr_maps;
+} ____cacheline_aligned_in_smp;
 
 
 #define MLX4_EN_BIT_DESC_OWN   0x80000000
@@ -253,39 +256,46 @@ struct mlx4_en_rx_alloc {
 };
 
 struct mlx4_en_tx_ring {
+       /* cache line used and dirtied in tx completion
+        * (mlx4_en_free_tx_buf())
+        */
+       u32                     last_nr_txbb;
+       u32                     cons;
+       unsigned long           wake_queue;
+
+       /* cache line used and dirtied in mlx4_en_xmit() */
+       u32                     prod ____cacheline_aligned_in_smp;
+       unsigned long           bytes;
+       unsigned long           packets;
+       unsigned long           tx_csum;
+       unsigned long           tso_packets;
+       unsigned long           xmit_more;
+       struct mlx4_bf          bf;
+       unsigned long           queue_stopped;
+
+       /* Following part should be mostly read */
+       cpumask_t               affinity_mask;
+       struct mlx4_qp          qp;
        struct mlx4_hwq_resources wqres;
-       u32 size ; /* number of TXBBs */
-       u32 size_mask;
-       u16 stride;
-       u16 cqn;        /* index of port CQ associated with this ring */
-       u32 prod;
-       u32 cons;
-       u32 buf_size;
-       u32 doorbell_qpn;
-       void *buf;
-       u16 poll_cnt;
-       struct mlx4_en_tx_info *tx_info;
-       u8 *bounce_buf;
-       u8 queue_index;
-       cpumask_t affinity_mask;
-       u32 last_nr_txbb;
-       struct mlx4_qp qp;
-       struct mlx4_qp_context context;
-       int qpn;
-       enum mlx4_qp_state qp_state;
-       struct mlx4_srq dummy;
-       unsigned long bytes;
-       unsigned long packets;
-       unsigned long tx_csum;
-       unsigned long queue_stopped;
-       unsigned long wake_queue;
-       struct mlx4_bf bf;
-       bool bf_enabled;
-       bool bf_alloced;
-       struct netdev_queue *tx_queue;
-       int hwtstamp_tx_type;
-       int inline_thold;
-};
+       u32                     size; /* number of TXBBs */
+       u32                     size_mask;
+       u16                     stride;
+       u16                     cqn;    /* index of port CQ associated with this ring */
+       u32                     buf_size;
+       __be32                  doorbell_qpn;
+       __be32                  mr_key;
+       void                    *buf;
+       struct mlx4_en_tx_info  *tx_info;
+       u8                      *bounce_buf;
+       struct mlx4_qp_context  context;
+       int                     qpn;
+       enum mlx4_qp_state      qp_state;
+       u8                      queue_index;
+       bool                    bf_enabled;
+       bool                    bf_alloced;
+       struct netdev_queue     *tx_queue;
+       int                     hwtstamp_tx_type;
+} ____cacheline_aligned_in_smp;
 
 struct mlx4_en_rx_desc {
        /* actual number of entries depends on rx ring stride */
@@ -411,10 +421,16 @@ struct mlx4_en_rss_map {
        enum mlx4_qp_state indir_state;
 };
 
+enum mlx4_en_port_flag {
+       MLX4_EN_PORT_ANC = 1<<0, /* Auto-negotiation complete */
+       MLX4_EN_PORT_ANE = 1<<1, /* Auto-negotiation enabled */
+};
+
 struct mlx4_en_port_state {
        int link_state;
        int link_speed;
-       int transciver;
+       int transceiver;
+       u32 flags;
 };
 
 struct mlx4_en_pkt_stats {
@@ -426,6 +442,7 @@ struct mlx4_en_pkt_stats {
 
 struct mlx4_en_port_stats {
        unsigned long tso_packets;
+       unsigned long xmit_more;
        unsigned long queue_stopped;
        unsigned long wake_queue;
        unsigned long tx_timeout;
@@ -433,7 +450,7 @@ struct mlx4_en_port_stats {
        unsigned long rx_chksum_good;
        unsigned long rx_chksum_none;
        unsigned long tx_chksum_offload;
-#define NUM_PORT_STATS         8
+#define NUM_PORT_STATS         9
 };
 
 struct mlx4_en_perf_stats {
@@ -542,6 +559,7 @@ struct mlx4_en_priv {
        unsigned max_mtu;
        int base_qpn;
        int cqe_factor;
+       int cqe_size;
 
        struct mlx4_en_rss_map rss_map;
        __be32 ctrl_flags;
@@ -612,6 +630,11 @@ struct mlx4_mac_entry {
        struct rcu_head rcu;
 };
 
+static inline struct mlx4_cqe *mlx4_en_get_cqe(void *buf, int idx, int cqe_sz)
+{
+       return buf + idx * cqe_sz;
+}
+
 #ifdef CONFIG_NET_RX_BUSY_POLL
 static inline void mlx4_en_cq_init_lock(struct mlx4_en_cq *cq)
 {
@@ -812,6 +835,13 @@ void mlx4_en_cleanup_filters(struct mlx4_en_priv *priv);
 void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf);
 void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev);
 
+#define DEV_FEATURE_CHANGED(dev, new_features, feature) \
+       ((dev->features & feature) ^ (new_features & feature))
+
+int mlx4_en_reset_config(struct net_device *dev,
+                        struct hwtstamp_config ts_config,
+                        netdev_features_t new_features);
+
 /*
  * Functions for time stamping
  */
@@ -821,9 +851,6 @@ void mlx4_en_fill_hwtstamps(struct mlx4_en_dev *mdev,
                            u64 timestamp);
 void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev);
 void mlx4_en_remove_timestamp(struct mlx4_en_dev *mdev);
-int mlx4_en_timestamp_config(struct net_device *dev,
-                            int tx_type,
-                            int rx_filter);
 
 /* Globals
  */
@@ -836,8 +863,8 @@ extern const struct ethtool_ops mlx4_en_ethtool_ops;
  */
 
 __printf(3, 4)
-int en_print(const char *level, const struct mlx4_en_priv *priv,
-            const char *format, ...);
+void en_print(const char *level, const struct mlx4_en_priv *priv,
+             const char *format, ...);
 
 #define en_dbg(mlevel, priv, format, ...)                              \
 do {                                                                   \