Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp109540ybg; Mon, 8 Jun 2020 17:52:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYsX7glzJ9THX9HCjY3Sg4NfJ7cJbO531K1hSo0nHcHlqNn98NDZrtIHGAlqrR0HTlAUGH X-Received: by 2002:a05:6402:54d:: with SMTP id i13mr21778766edx.330.1591663932591; Mon, 08 Jun 2020 17:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591663932; cv=none; d=google.com; s=arc-20160816; b=VothAjbkiSCNVg1DUQULo7wHwu+Z+viI7M//SaBcmQcoxDqUYGuFeNp8t1mL6oJ6Wh Or3PBFm+Z4qO5Bt0VqhmKbz0nSgPCcSka0OJzTSHP1MCcvoIwx/3sX42Pa5hwDStFeim //QZ/zLMU2oZbOANx7x5OPt7b8vfjwllRT0GAzCH6oEDOk4RVYWvkLuN5WPCDFdET4p2 gZdPnIVs/gVyvrrcQPP60RvLaxI18gSMKKAF+FVtfcS+YihD8BmBK7JbgZqwQ3c31S4p ZlkmTuXKPDggiR+MvGKb4zGRBHn9aPZsyz+u08nB5JZs0Q4R4P0HyxxuyR/R3z2hC6Le Is2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sZhO0vpJU7ZrjxZNsbRlISpSpSLbYPK6zYMVG8khDWI=; b=k5rJFlz4eFx55jC/20q5R16/JG4MZ7sLIc0Djq5yZMKRsKpYFwEy4InpAgh1LMS+Sn koUx5QKDQ+81m1/9lLJ0W5k5a1xg05hLkykM78aH6b0rIFr9Ux5yW/1ts5PjquM9XBTm rv+g/YnhceYgrbWtO0atUd5ECeJeNA9WGkz1lt55LLX/kxnvk88xbtKTT1EJ6b9TuWJh fjobr1oDHPH+trz5gze2wX+3jiCJN69Oo8EY7cDQBXV9gdUxc7LHZ8RmkHL+pA9N0bg5 +MMqmFIWL8AvKHmZMYC37iGyc/Fo+oJK9FxavuH2umeiLX0Zs39fZzpX2lTusqurVfF6 mlmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TiEAsU6E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ks19si9294798ejb.409.2020.06.08.17.51.49; Mon, 08 Jun 2020 17:52:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TiEAsU6E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387617AbgFIAuC (ORCPT + 99 others); Mon, 8 Jun 2020 20:50:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:56812 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728721AbgFHXKj (ORCPT ); Mon, 8 Jun 2020 19:10:39 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 158CF20CC7; Mon, 8 Jun 2020 23:10:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657838; bh=+2pQ2hPrXJJgBbrILzKSDmiflemN4+VZ16ewRbpvJ9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TiEAsU6EWlcOKApywW0hH4Ep4hrWNg93gUv8q+iOgv1vD6iRM5Sl3B0pBhTCUurl9 2fGRMlUbj8nZmt/069jNKHXWOcYybtaWBx88jQdOBxkoGtvjWXfHJyNculOZpRfu6A 1v4t0Em8Y0tT5L5zN9HDE3WZfuhrZMcAAE7JyiMU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Erez Shitrit , Alex Vesker , Saeed Mahameed , Sasha Levin , netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 207/274] net/mlx5e: IPoIB, Drop multicast packets that this interface sent Date: Mon, 8 Jun 2020 19:05:00 -0400 Message-Id: <20200608230607.3361041-207-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Erez Shitrit [ Upstream commit 8b46d424a743ddfef8056d5167f13ee7ebd1dcad ] After enabled loopback packets for IPoIB, we need to drop these packets that this HCA has replicated and came back to the same interface that sent them. Fixes: 4c6c615e3f30 ("net/mlx5e: IPoIB, Add PKEY child interface nic profile") Signed-off-by: Erez Shitrit Reviewed-by: Alex Vesker Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index e2beb89c1832..b69957be653a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -1501,6 +1501,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) #ifdef CONFIG_MLX5_CORE_IPOIB +#define MLX5_IB_GRH_SGID_OFFSET 8 #define MLX5_IB_GRH_DGID_OFFSET 24 #define MLX5_GID_SIZE 16 @@ -1514,6 +1515,7 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq, struct net_device *netdev; struct mlx5e_priv *priv; char *pseudo_header; + u32 flags_rqpn; u32 qpn; u8 *dgid; u8 g; @@ -1535,7 +1537,8 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq, tstamp = &priv->tstamp; stats = &priv->channel_stats[rq->ix].rq; - g = (be32_to_cpu(cqe->flags_rqpn) >> 28) & 3; + flags_rqpn = be32_to_cpu(cqe->flags_rqpn); + g = (flags_rqpn >> 28) & 3; dgid = skb->data + MLX5_IB_GRH_DGID_OFFSET; if ((!g) || dgid[0] != 0xff) skb->pkt_type = PACKET_HOST; @@ -1544,9 +1547,15 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq, else skb->pkt_type = PACKET_MULTICAST; - /* TODO: IB/ipoib: Allow mcast packets from other VFs - * 68996a6e760e5c74654723eeb57bf65628ae87f4 + /* Drop packets that this interface sent, ie multicast packets + * that the HCA has replicated. */ + if (g && (qpn == (flags_rqpn & 0xffffff)) && + (memcmp(netdev->dev_addr + 4, skb->data + MLX5_IB_GRH_SGID_OFFSET, + MLX5_GID_SIZE) == 0)) { + skb->dev = NULL; + return; + } skb_pull(skb, MLX5_IB_GRH_BYTES); -- 2.25.1