Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Zhu Yanjun <zyjzyj2000@gmail.com>
To: Bob Pearson <rpearsonhpe@gmail.com>,
	jgg@nvidia.com, linux-rdma@vger.kernel.org
Cc: Bob Pearson <rpearson@hpe.com>
Subject: Re: [PATCH for-next v2] rdma_rxe: fix bug rejecting multicast packets
Date: Fri, 9 Oct 2020 23:23:31 +0800	[thread overview]
Message-ID: <0e89cd73-e3ea-81fc-c5eb-be7521b10415@gmail.com> (raw)
In-Reply-To: <20201008212753.265249-1-rpearson@hpe.com>

On 10/9/2020 5:27 AM, Bob Pearson wrote:
>    - Fix a bug in rxe_rcv that causes all multicast packets to be
>      dropped. Currently rxe_match_dgid is called for each packet
>      to verify that the destination IP address matches one of the
>      entries in the port source GID table. This is incorrect for
>      IP multicast addresses since they do not appear in the GID table.
>    - Add code to detect multicast addresses.
>    - Change function name to rxe_chk_dgid which is clearer.
>
> Signed-off-by: Bob Pearson <rpearson@hpe.com>
> ---
>   drivers/infiniband/sw/rxe/rxe_recv.c | 19 ++++++++++++++++---
>   1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
> index a3eed4da1540..b6fee61b2aee 100644
> --- a/drivers/infiniband/sw/rxe/rxe_recv.c
> +++ b/drivers/infiniband/sw/rxe/rxe_recv.c
> @@ -280,7 +280,17 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
>   	kfree_skb(skb);
>   }
>   
> -static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)
> +/**
> + * rxe_chk_dgid - validate destination IP address
> + * @rxe: rxe device that received packet
> + * @skb: the received packet buffer
> + *
> + * Accept any loopback packets

About loopback packets, will rdma_find_gid_by_port return correct value?

In my tests, to loopback packets, sometimes rdma_find_gid_by_port return 
incorrect value.

Then the packets will be freed.

Zhu Yanjun

> + * Extract IP address from packet and
> + * Accept if multicast packet
> + * Accept if matches an SGID table entry
> + */
> +static int rxe_chk_dgid(struct rxe_dev *rxe, struct sk_buff *skb)
>   {
>   	struct rxe_pkt_info *pkt = SKB_TO_PKT(skb);
>   	const struct ib_gid_attr *gid_attr;
> @@ -298,6 +308,9 @@ static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)
>   		pdgid = (union ib_gid *)&ipv6_hdr(skb)->daddr;
>   	}
>   
> +	if (rdma_is_multicast_addr((struct in6_addr *)pdgid))
> +		return 0;
> +
>   	gid_attr = rdma_find_gid_by_port(&rxe->ib_dev, pdgid,
>   					 IB_GID_TYPE_ROCE_UDP_ENCAP,
>   					 1, skb->dev);
> @@ -322,8 +335,8 @@ void rxe_rcv(struct sk_buff *skb)
>   	if (unlikely(skb->len < pkt->offset + RXE_BTH_BYTES))
>   		goto drop;
>   
> -	if (rxe_match_dgid(rxe, skb) < 0) {
> -		pr_warn_ratelimited("failed matching dgid\n");
> +	if (rxe_chk_dgid(rxe, skb) < 0) {
> +		pr_warn_ratelimited("failed checking dgid\n");
>   		goto drop;
>   	}
>   



  parent reply	other threads:[~2020-10-09 15:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 21:27 [PATCH for-next v2] rdma_rxe: fix bug rejecting multicast packets Bob Pearson
2020-10-08 23:33 ` Jason Gunthorpe
2020-10-09 15:23 ` Zhu Yanjun [this message]
2020-10-09 15:28   ` Jason Gunthorpe
2020-10-09 17:18     ` Bob Pearson
2020-10-10  3:54       ` Zhu Yanjun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e89cd73-e3ea-81fc-c5eb-be7521b10415@gmail.com \
    --to=zyjzyj2000@gmail.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearson@hpe.com \
    --cc=rpearsonhpe@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox