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?

> +
> +             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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to