The branch main has been updated by hselasky:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=30416d4e827341be32c3e415f16c73f252a68d85

commit 30416d4e827341be32c3e415f16c73f252a68d85
Author:     Hans Petter Selasky <[email protected]>
AuthorDate: 2021-06-16 13:01:58 +0000
Commit:     Hans Petter Selasky <[email protected]>
CommitDate: 2021-07-12 12:22:34 +0000

    mlx4ib and mlx5ib: Set slid to zero in Ethernet completion struct
    
    IB spec says that a lid should be ignored when link layer is Ethernet,
    for example when building or parsing a CM request message (CA17-34).
    However, since ib_lid_be16() and ib_lid_cpu16()  validates the slid,
    not only when link layer is IB, we set the slid to zero to prevent
    false warnings in the kernel log.
    
    Linux commit:
    65389322b28f81cc137b60a41044c2d958a7b950
    
    MFC after:      1 week
    Reviewed by:    kib
    Sponsored by:   Mellanox Technologies // NVIDIA Networking
---
 sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c | 4 +++-
 sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c 
b/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c
index d9f3a719e030..215c428e7af7 100644
--- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c
+++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c
@@ -593,6 +593,7 @@ static void use_tunnel_data(struct mlx4_ib_qp *qp, struct 
mlx4_ib_cq *cq, struct
        wc->dlid_path_bits = 0;
 
        if (is_eth) {
+               wc->slid = 0;
                wc->vlan_id = be16_to_cpu(hdr->tun.sl_vid);
                memcpy(&(wc->smac[0]), (char *)&hdr->tun.mac_31_0, 4);
                memcpy(&(wc->smac[4]), (char *)&hdr->tun.slid_mac_47_32, 2);
@@ -841,7 +842,6 @@ repoll:
                        }
                }
 
-               wc->slid           = be16_to_cpu(cqe->rlid);
                g_mlpath_rqpn      = be32_to_cpu(cqe->g_mlpath_rqpn);
                wc->src_qp         = g_mlpath_rqpn & 0xffffff;
                wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f;
@@ -850,6 +850,7 @@ repoll:
                wc->wc_flags      |= mlx4_ib_ipoib_csum_ok(cqe->status,
                                        cqe->checksum) ? IB_WC_IP_CSUM_OK : 0;
                if (is_eth) {
+                       wc->slid = 0;
                        wc->sl  = be16_to_cpu(cqe->sl_vid) >> 13;
                        if (be32_to_cpu(cqe->vlan_my_qpn) &
                                        MLX4_CQE_CVLAN_PRESENT_MASK) {
@@ -861,6 +862,7 @@ repoll:
                        memcpy(wc->smac, cqe->smac, ETH_ALEN);
                        wc->wc_flags |= (IB_WC_WITH_VLAN | IB_WC_WITH_SMAC);
                } else {
+                       wc->slid = be16_to_cpu(cqe->rlid);
                        wc->sl  = be16_to_cpu(cqe->sl_vid) >> 12;
                        wc->vlan_id = 0xffff;
                }
diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c 
b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
index 3c37df82199f..495aabb01bfe 100644
--- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
+++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
@@ -219,7 +219,6 @@ static void handle_responder(struct ib_wc *wc, struct 
mlx5_cqe64 *cqe,
                wc->ex.invalidate_rkey = be32_to_cpu(cqe->imm_inval_pkey);
                break;
        }
-       wc->slid           = be16_to_cpu(cqe->slid);
        wc->src_qp         = be32_to_cpu(cqe->flags_rqpn) & 0xffffff;
        wc->dlid_path_bits = cqe->ml_path;
        g = (be32_to_cpu(cqe->flags_rqpn) >> 28) & 3;
@@ -234,10 +233,12 @@ static void handle_responder(struct ib_wc *wc, struct 
mlx5_cqe64 *cqe,
        }
 
        if (ll != IB_LINK_LAYER_ETHERNET) {
+               wc->slid = be16_to_cpu(cqe->slid);
                wc->sl = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0xf;
                return;
        }
 
+       wc->slid = 0;
        vlan_present = cqe_has_vlan(cqe);
        roce_packet_type   = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0x3;
        if (vlan_present) {
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to