Re: [PATCH 09/30] IB/core: Modify ib_verbs and cma in order to use roce_gid_cache

Matan Barak
2015-02-19T15:24:15Z

On 2/19/2015 4:37 PM, Haggai Eran wrote:
> On 20/02/2015 00:02, Somnath Kotur wrote:
>> @@ -203,21 +235,30 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, struct ib_wc *wc,
>>
>> memset(ah_attr, 0, sizeof *ah_attr);
>> if (is_eth) {
>> + u16 vlan_id = wc->wc_flags & IB_WC_WITH_VLAN ?
>> + wc->vlan_id : 0xffff;
>> +
>> if (!(wc->wc_flags & IB_WC_GRH))
>> return -EPROTOTYPE;
>>
>> - if (wc->wc_flags & IB_WC_WITH_SMAC &&
>> - wc->wc_flags & IB_WC_WITH_VLAN) {
>> - memcpy(ah_attr->dmac, wc->smac, ETH_ALEN);
>> - ah_attr->vlan_id = wc->vlan_id;
>> - } else {
>> + if (!(wc->wc_flags & IB_WC_WITH_SMAC) ||
>> + !(wc->wc_flags & IB_WC_WITH_VLAN)) {
>> ret = rdma_addr_find_dmac_by_grh(&grh->dgid, &grh->sgid,
>> - ah_attr->dmac, &ah_attr->vlan_id);
>> + ah_attr->dmac,
>> + wc->wc_flags & IB_WC_WITH_VLAN ?
>> + NULL : &vlan_id,
>> + 0);
>> if (ret)
>> return ret;
>> }
>> - } else {
>> - ah_attr->vlan_id = 0xffff;
>
> Previously vlan_id would get set to 0xffff on non-Ethernet link-layer,
> and now it is left as zero. Wouldn't that break things for non-Ethernet
> protocols?

On non-Ethernet link-later, vlan_id was ignored. This field was deleted
in this patchset.

>
>> +
>> + ret = get_sgid_index_from_eth(device, port_num, vlan_id,
>> + &grh->dgid, &gid_index);
>> + if (ret)
>> + return ret;
>> +
>> + if (wc->wc_flags & IB_WC_WITH_SMAC)
>> + memcpy(ah_attr->dmac, wc->smac, ETH_ALEN);
>> }
>>
>> ah_attr->dlid = wc->slid;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>