aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorShlomo Pongratz <shlomop@mellanox.com>2012-04-29 10:04:25 -0400
committerRoland Dreier <roland@purestorage.com>2012-05-08 14:54:32 -0400
commitb3416f4476f39f76fd5ca238e8332ba9b8f059d9 (patch)
treeabe8502067df86eba56d32d37f75f6e434acda27 /drivers/net
parentc0c1d3d761c32ece93b1c99d200591415e3cbf7c (diff)
mlx4_core: Add second capabilities flags field
This patch adds a 64-bit flags2 features member to struct mlx4_dev to export further features of the hardware. The original flags field tracks features whose support bits are advertised by the firmware in offsets 0x40 and 0x44 of the query device capabilities command. flags2 will track features whose support bits are scattered at various offsets. RSS support is the first feature to be exported through flags2. RSS capabilities are located at offset 0x2e. The size of the RSS indirection table is also given in this offset. Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.c29
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c2
3 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index 2a02ba522e60..f7488dfef8eb 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -118,6 +118,20 @@ static void dump_dev_cap_flags(struct mlx4_dev *dev, u64 flags)
118 mlx4_dbg(dev, " %s\n", fname[i]); 118 mlx4_dbg(dev, " %s\n", fname[i]);
119} 119}
120 120
121static void dump_dev_cap_flags2(struct mlx4_dev *dev, u64 flags)
122{
123 static const char * const fname[] = {
124 [0] = "RSS support",
125 [1] = "RSS Toeplitz Hash Function support",
126 [2] = "RSS XOR Hash Function support"
127 };
128 int i;
129
130 for (i = 0; i < ARRAY_SIZE(fname); ++i)
131 if (fname[i] && (flags & (1LL << i)))
132 mlx4_dbg(dev, " %s\n", fname[i]);
133}
134
121int mlx4_MOD_STAT_CFG(struct mlx4_dev *dev, struct mlx4_mod_stat_cfg *cfg) 135int mlx4_MOD_STAT_CFG(struct mlx4_dev *dev, struct mlx4_mod_stat_cfg *cfg)
122{ 136{
123 struct mlx4_cmd_mailbox *mailbox; 137 struct mlx4_cmd_mailbox *mailbox;
@@ -346,6 +360,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
346#define QUERY_DEV_CAP_MAX_REQ_QP_OFFSET 0x29 360#define QUERY_DEV_CAP_MAX_REQ_QP_OFFSET 0x29
347#define QUERY_DEV_CAP_MAX_RES_QP_OFFSET 0x2b 361#define QUERY_DEV_CAP_MAX_RES_QP_OFFSET 0x2b
348#define QUERY_DEV_CAP_MAX_GSO_OFFSET 0x2d 362#define QUERY_DEV_CAP_MAX_GSO_OFFSET 0x2d
363#define QUERY_DEV_CAP_RSS_OFFSET 0x2e
349#define QUERY_DEV_CAP_MAX_RDMA_OFFSET 0x2f 364#define QUERY_DEV_CAP_MAX_RDMA_OFFSET 0x2f
350#define QUERY_DEV_CAP_RSZ_SRQ_OFFSET 0x33 365#define QUERY_DEV_CAP_RSZ_SRQ_OFFSET 0x33
351#define QUERY_DEV_CAP_ACK_DELAY_OFFSET 0x35 366#define QUERY_DEV_CAP_ACK_DELAY_OFFSET 0x35
@@ -390,6 +405,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
390#define QUERY_DEV_CAP_RSVD_LKEY_OFFSET 0x98 405#define QUERY_DEV_CAP_RSVD_LKEY_OFFSET 0x98
391#define QUERY_DEV_CAP_MAX_ICM_SZ_OFFSET 0xa0 406#define QUERY_DEV_CAP_MAX_ICM_SZ_OFFSET 0xa0
392 407
408 dev_cap->flags2 = 0;
393 mailbox = mlx4_alloc_cmd_mailbox(dev); 409 mailbox = mlx4_alloc_cmd_mailbox(dev);
394 if (IS_ERR(mailbox)) 410 if (IS_ERR(mailbox))
395 return PTR_ERR(mailbox); 411 return PTR_ERR(mailbox);
@@ -439,6 +455,17 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
439 else 455 else
440 dev_cap->max_gso_sz = 1 << field; 456 dev_cap->max_gso_sz = 1 << field;
441 457
458 MLX4_GET(field, outbox, QUERY_DEV_CAP_RSS_OFFSET);
459 if (field & 0x20)
460 dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_RSS_XOR;
461 if (field & 0x10)
462 dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_RSS_TOP;
463 field &= 0xf;
464 if (field) {
465 dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_RSS;
466 dev_cap->max_rss_tbl_sz = 1 << field;
467 } else
468 dev_cap->max_rss_tbl_sz = 0;
442 MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_RDMA_OFFSET); 469 MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_RDMA_OFFSET);
443 dev_cap->max_rdma_global = 1 << (field & 0x3f); 470 dev_cap->max_rdma_global = 1 << (field & 0x3f);
444 MLX4_GET(field, outbox, QUERY_DEV_CAP_ACK_DELAY_OFFSET); 471 MLX4_GET(field, outbox, QUERY_DEV_CAP_ACK_DELAY_OFFSET);
@@ -632,8 +659,10 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
632 dev_cap->max_rq_desc_sz, dev_cap->max_rq_sg); 659 dev_cap->max_rq_desc_sz, dev_cap->max_rq_sg);
633 mlx4_dbg(dev, "Max GSO size: %d\n", dev_cap->max_gso_sz); 660 mlx4_dbg(dev, "Max GSO size: %d\n", dev_cap->max_gso_sz);
634 mlx4_dbg(dev, "Max counters: %d\n", dev_cap->max_counters); 661 mlx4_dbg(dev, "Max counters: %d\n", dev_cap->max_counters);
662 mlx4_dbg(dev, "Max RSS Table size: %d\n", dev_cap->max_rss_tbl_sz);
635 663
636 dump_dev_cap_flags(dev, dev_cap->flags); 664 dump_dev_cap_flags(dev, dev_cap->flags);
665 dump_dev_cap_flags2(dev, dev_cap->flags2);
637 666
638out: 667out:
639 mlx4_free_cmd_mailbox(dev, mailbox); 668 mlx4_free_cmd_mailbox(dev, mailbox);
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.h b/drivers/net/ethernet/mellanox/mlx4/fw.h
index e1a5fa56bcbc..64c0399e4b78 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.h
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.h
@@ -79,6 +79,7 @@ struct mlx4_dev_cap {
79 u64 trans_code[MLX4_MAX_PORTS + 1]; 79 u64 trans_code[MLX4_MAX_PORTS + 1];
80 u16 stat_rate_support; 80 u16 stat_rate_support;
81 u64 flags; 81 u64 flags;
82 u64 flags2;
82 int reserved_uars; 83 int reserved_uars;
83 int uar_size; 84 int uar_size;
84 int min_page_sz; 85 int min_page_sz;
@@ -110,6 +111,7 @@ struct mlx4_dev_cap {
110 u32 reserved_lkey; 111 u32 reserved_lkey;
111 u64 max_icm_sz; 112 u64 max_icm_sz;
112 int max_gso_sz; 113 int max_gso_sz;
114 int max_rss_tbl_sz;
113 u8 supported_port_types[MLX4_MAX_PORTS + 1]; 115 u8 supported_port_types[MLX4_MAX_PORTS + 1];
114 u8 suggested_type[MLX4_MAX_PORTS + 1]; 116 u8 suggested_type[MLX4_MAX_PORTS + 1];
115 u8 default_sense[MLX4_MAX_PORTS + 1]; 117 u8 default_sense[MLX4_MAX_PORTS + 1];
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 8bb05b46db86..bb04a8208780 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -272,10 +272,12 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
272 dev->caps.max_msg_sz = dev_cap->max_msg_sz; 272 dev->caps.max_msg_sz = dev_cap->max_msg_sz;
273 dev->caps.page_size_cap = ~(u32) (dev_cap->min_page_sz - 1); 273 dev->caps.page_size_cap = ~(u32) (dev_cap->min_page_sz - 1);
274 dev->caps.flags = dev_cap->flags; 274 dev->caps.flags = dev_cap->flags;
275 dev->caps.flags2 = dev_cap->flags2;
275 dev->caps.bmme_flags = dev_cap->bmme_flags; 276 dev->caps.bmme_flags = dev_cap->bmme_flags;
276 dev->caps.reserved_lkey = dev_cap->reserved_lkey; 277 dev->caps.reserved_lkey = dev_cap->reserved_lkey;
277 dev->caps.stat_rate_support = dev_cap->stat_rate_support; 278 dev->caps.stat_rate_support = dev_cap->stat_rate_support;
278 dev->caps.max_gso_sz = dev_cap->max_gso_sz; 279 dev->caps.max_gso_sz = dev_cap->max_gso_sz;
280 dev->caps.max_rss_tbl_sz = dev_cap->max_rss_tbl_sz;
279 281
280 /* Sense port always allowed on supported devices for ConnectX1 and 2 */ 282 /* Sense port always allowed on supported devices for ConnectX1 and 2 */
281 if (dev->pdev->device != 0x1003) 283 if (dev->pdev->device != 0x1003)