[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DB6PR0502MB2999ABEFF47AEBF944F8B65BD1EA0@DB6PR0502MB2999.eurprd05.prod.outlook.com>
Date: Thu, 4 May 2017 21:52:43 +0000
From: Parav Pandit <parav@...lanox.com>
To: "Gustavo A. R. Silva" <garsilva@...eddedor.com>,
Doug Ledford <dledford@...hat.com>,
Sean Hefty <sean.hefty@...el.com>,
Hal Rosenstock <hal.rosenstock@...il.com>,
Sagi Grimberg <sagi@...berg.me>,
Bart Van Assche <bart.vanassche@...disk.com>,
Steve Wise <swise@...ngridcomputing.com>,
"Leon Romanovsky" <leonro@...lanox.com>,
Yishai Hadas <yishaih@...lanox.com>,
"Moni Shoua" <monis@...lanox.com>
CC: "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [infiniband-core] question about arguments position
Hi,
> -----Original Message-----
> From: linux-rdma-owner@...r.kernel.org [mailto:linux-rdma-
> owner@...r.kernel.org] On Behalf Of Gustavo A. R. Silva
> Sent: Thursday, May 4, 2017 12:42 PM
> To: Doug Ledford <dledford@...hat.com>; Sean Hefty
> <sean.hefty@...el.com>; Hal Rosenstock <hal.rosenstock@...il.com>; Sagi
> Grimberg <sagi@...berg.me>; Bart Van Assche
> <bart.vanassche@...disk.com>; Steve Wise <swise@...ngridcomputing.com>;
> Leon Romanovsky <leonro@...lanox.com>; Yishai Hadas
> <yishaih@...lanox.com>; Moni Shoua <monis@...lanox.com>
> Cc: linux-rdma@...r.kernel.org; linux-kernel@...r.kernel.org
> Subject: [infiniband-core] question about arguments position
>
>
> Hello everybody,
>
> While looking into Coverity ID 1351047 I ran into the following piece of code at
> drivers/infiniband/core/verbs.c:496:
>
> ret = rdma_addr_find_l2_eth_by_grh(&dgid, &sgid,
> ah_attr->dmac,
> wc->wc_flags & IB_WC_WITH_VLAN ?
> NULL : &vlan_id,
> &if_index, &hoplimit);
>
>
> The issue here is that the position of arguments in the call to
> rdma_addr_find_l2_eth_by_grh() function do not match the order of the
> parameters:
>
> &dgid is passed to sgid
> &sgid is passed to dgid
>
> This is the function prototype:
>
> int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
> const union ib_gid *dgid,
> u8 *dmac, u16 *vlan_id, int *if_index,
> int *hoplimit)
>
> My question here is if this is intentional?
>
Yes. ib_init_ah_from_wc() creates ah from the incoming packet.
Incoming packet has dgid of the receiver node on which this code is getting executed
And sgid contains the GID of the sender.
When resolving mac address of destination, you use arrived dgid as sgid.
And use sgid as dgid because sgid contains destinations GID whom to respond to.
Powered by blists - more mailing lists