Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1636059
| From | Parav Pandit <parav@mellanox.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [infiniband-core] question about arguments position |
| Date | 2017-05-05 00:00 +0200 |
| Message-ID | <tDwWZ-MC-1@gated-at.bofh.it> (permalink) |
| References | <tDt34-6JH-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi, > -----Original Message----- > From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma- > owner@vger.kernel.org] On Behalf Of Gustavo A. R. Silva > Sent: Thursday, May 4, 2017 12:42 PM > To: Doug Ledford <dledford@redhat.com>; Sean Hefty > <sean.hefty@intel.com>; Hal Rosenstock <hal.rosenstock@gmail.com>; Sagi > Grimberg <sagi@rimberg.me>; Bart Van Assche > <bart.vanassche@sandisk.com>; Steve Wise <swise@opengridcomputing.com>; > Leon Romanovsky <leonro@mellanox.com>; Yishai Hadas > <yishaih@mellanox.com>; Moni Shoua <monis@mellanox.com> > Cc: linux-rdma@vger.kernel.org; linux-kernel@vger.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.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[infiniband-core] question about arguments position "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-05-04 19:50 +0200
RE: [infiniband-core] question about arguments position Parav Pandit <parav@mellanox.com> - 2017-05-05 00:00 +0200
Re: [infiniband-core] question about arguments position Doug Ledford <dledford@redhat.com> - 2017-05-05 01:50 +0200
Re: [infiniband-core] question about arguments position "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-05-05 03:40 +0200
csiph-web