diff mbox

[V1,for-next,2/2] IB/mlx5: Report mlx5 LSO capabilities when querying device

Message ID 1461765892-1285-3-git-send-email-matanb@mellanox.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Matan Barak April 27, 2016, 2:04 p.m. UTC
From: Bodong Wang <bodong@mellanox.com>

mlx5 based hardware supports LSO for Raw Ethernet QPs.
LSO (large segment offload) applied here is mainly used
for TCP (also known as TSO).

Signed-off-by: Bodong Wang <bodong@mellanox.com>
Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
---
 drivers/infiniband/hw/mlx5/main.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 5acf346..3716001e 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -454,6 +454,7 @@  static int mlx5_ib_query_device(struct ib_device *ibdev,
 	int max_rq_sg;
 	int max_sq_sg;
 	u64 min_page_size = 1ull << MLX5_CAP_GEN(mdev, log_pg_sz);
+	u64 max_lso;
 
 	if (uhw->inlen || uhw->outlen)
 		return -EINVAL;
@@ -508,10 +509,18 @@  static int mlx5_ib_query_device(struct ib_device *ibdev,
 	if (MLX5_CAP_GEN(mdev, block_lb_mc))
 		props->device_cap_flags |= IB_DEVICE_BLOCK_MULTICAST_LOOPBACK;
 
-	if (MLX5_CAP_GEN(dev->mdev, eth_net_offloads) &&
-	    (MLX5_CAP_ETH(dev->mdev, csum_cap)))
+	if (MLX5_CAP_GEN(dev->mdev, eth_net_offloads)) {
+		if (MLX5_CAP_ETH(mdev, csum_cap))
 			props->device_cap_flags |= IB_DEVICE_RAW_IP_CSUM;
 
+		max_lso = MLX5_CAP_ETH(mdev, max_lso_cap);
+		if (max_lso) {
+			props->lso_caps.max_lso = 1 << max_lso;
+			props->lso_caps.supported_qpts |=
+				1 << IB_QPT_RAW_PACKET;
+		}
+	}
+
 	if (MLX5_CAP_GEN(mdev, ipoib_basic_offloads)) {
 		props->device_cap_flags |= IB_DEVICE_UD_IP_CSUM;
 		props->device_cap_flags |= IB_DEVICE_UD_TSO;