Re: [PATCH 1/4] ibacm: Replace ioctl with netlink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 25 Jan 2019, at 19:31, Weiny, Ira <ira.weiny@xxxxxxxxx> wrote:
> 
>> 
>> Hi Ira,
>> 
>>> On 25 Jan 2019, at 19:02, Ira Weiny <ira.weiny@xxxxxxxxx> wrote:
>>> 
>>> On Thu, Jan 24, 2019 at 03:47:35PM +0100, Håkon Bugge wrote:
>>>> ibacm uses ioctl with SIOCGIFCONF to enumerate the interfaces. This
>>>> particular ioctl will only return interfaces that are "running".
>>>> 
>>>> This is a problem if, for example, ibacm is started before the
>>>> interfaces get plumbed, or when an interface gets resurrected.
>>>> 
>>>> By using netlink (nl), we avoid using the sysfs interface to read the
>>>> gid, as it is supplied directly by nl.
>>>> 
>>>> This commit does not change the existing functionality, but is made
>>>> to prepare for a fix where ibacm is unable to resurrect an interface.
>>>> 
>>>> Detailed logging added:
>>>> 
>>>> acm_if_iter: name: stib0 label:     stib0 index:  9
>>>> flags: broadcast,multicast,up,running,lowerup
>>>> addr: 192.168.200.200/24 pkey: 0x88b4 guid: 0x21280001a17c97
>>>> 
>>>> Change-Id: I6e428d1d6b2d345ccfbd74d482c69b56f8fe98da
>>>> Signed-off-by: Håkon Bugge <haakon.bugge@xxxxxxxxxx>
>>>> ---
>>> 
>>> [snip]
> 
> [snip]
> 
>>> 
>>>> +	af = nl_addr_get_family(a);
>>>> +	if (af != AF_INET && af != AF_INET6)
>>>> +		return;
>>>> +
>>>> +	label = rtnl_addr_get_label(addr);
>>>> +	if (!label)
>>>> +		return;
>>>> +
>>>> +	link_addr = rtnl_link_get_addr(link);
>>>> +	memcpy(sgid.raw, nl_addr_get_binary_addr(link_addr) + 4,
>> sizeof(sgid));
>>>> +	guid_ptr = (unsigned long *)&sgid.raw;
>>> 
>>> This does not look right to support both IPv4 and v6.
>> 
>> Me not understand. I am retrieving the L2 address here. It is not influenced
>> by the choice of L3 address, is it?
> 
> I guess a better question is where do you track the EPs based on IP?  The code you took out was specifically written to handle both and I'm not quite sure if  you are resolving only GIDs or IP's as well?

There shall be no change in that respect. I do:

+	if (!(a = rtnl_addr_get_local(addr)))
+		return;
[]
+	acm_log(2, "name: %5s label: %9s index: %2d flags: %s addr: %s pkey: 0x%04x guid: 0x%lx\n",
[]
+		nl_addr2str(a, ip_str, sizeof(ip_str)),	pkey,
[]
+	memcpy(&bin_addr, nl_addr_get_binary_addr(a), addr_len);
+	ctx_cb->cb(rtnl_link_get_name(link), &sgid, pkey, af2acm_addr_type(af), bin_addr, ip_str, ctx_cb->ctx);

which corresponds to the old:

-		cb(ifr[i].ifr_name, &sgid, pkey, addr_type, addr, ip_str, ctx);

For reasons unknown to me, both the binary and ASCII version of the L3 address is supplied. And both "delivery methods" are agnostic to IPv4/6.

But we need a real makeup here to make IBv6 work. But, first things first.


Thxs, Håkon



> Ira
> 
>> 
>>>> +
>>>> +	ret = acm_if_get_pkey(rtnl_link_get_name(link), &pkey);
>>>> +	if (ret)
>>>> +		return;
>>>> +
>>>> +	acm_log(2, "name: %5s label: %9s index: %2d flags: %s addr: %s
>> pkey: 0x%04x guid: 0x%lx\n",
>>>> +		rtnl_link_get_name(link), label,
>>>> +		rtnl_addr_get_ifindex(addr),
>>>> +		rtnl_link_flags2str(flags, flags_str, sizeof(flags_str)),
>>>> +		nl_addr2str(a, ip_str, sizeof(ip_str)),	pkey,
>>>> +		be64toh(*(guid_ptr + 1)));
>>> 
>>> Use sgid.global.interface_id to represent the guid.  That is what
>>> ibv_gid union is for...
>> 
>> Yes, thanks! Will fix.
>> 
>> Thanks for the review, Håkon





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux