linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] IB/mlx4: Take source mac from AH instead from the port
Date: Tue, 19 Jan 2016 15:58:02 -0500	[thread overview]
Message-ID: <569EA35A.3010605@redhat.com> (raw)
In-Reply-To: <1452786458-30341-1-git-send-email-monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2546 bytes --]

On 01/14/2016 10:47 AM, Moni Shoua wrote:
> In commit dbf727de7440 ("IB/core: Use GID table in AH creation and dmac
> resolution") we copy source mac to mlx4_ah from the attributes of
> gid at ib_ah_attr.grh.sgid_index. Now we can use it.
> 
> Signed-off-by: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/infiniband/hw/mlx4/qp.c | 24 ++----------------------
>  1 file changed, 2 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
> index 24ed03c..bb30a0f 100644
> --- a/drivers/infiniband/hw/mlx4/qp.c
> +++ b/drivers/infiniband/hw/mlx4/qp.c
> @@ -32,6 +32,7 @@
>   */
>  
>  #include <linux/log2.h>
> +#include <linux/etherdevice.h>
>  #include <linux/slab.h>
>  #include <linux/netdevice.h>
>  #include <linux/vmalloc.h>
> @@ -2256,16 +2257,6 @@ static int build_sriov_qp0_header(struct mlx4_ib_sqp *sqp,
>  	return 0;
>  }
>  
> -static void mlx4_u64_to_smac(u8 *dst_mac, u64 src_mac)
> -{
> -	int i;
> -
> -	for (i = ETH_ALEN; i; i--) {
> -		dst_mac[i - 1] = src_mac & 0xff;
> -		src_mac >>= 8;
> -	}
> -}
> -
>  static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr,
>  			    void *wqe, unsigned *mlx_seg_len)
>  {
> @@ -2387,27 +2378,16 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr,
>  
>  	if (is_eth) {
>  		struct in6_addr in6;
> -
>  		u16 pcp = (be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 29) << 13;
>  
>  		mlx->sched_prio = cpu_to_be16(pcp);
>  
> +		ether_addr_copy(sqp->ud_header.eth.smac_h, ah->av.eth.s_mac);
>  		memcpy(sqp->ud_header.eth.dmac_h, ah->av.eth.mac, 6);
> -		/* FIXME: cache smac value? */
>  		memcpy(&ctrl->srcrb_flags16[0], ah->av.eth.mac, 2);
>  		memcpy(&ctrl->imm, ah->av.eth.mac + 2, 4);
>  		memcpy(&in6, sgid.raw, sizeof(in6));
>  
> -		if (!mlx4_is_mfunc(to_mdev(ib_dev)->dev)) {
> -			u64 mac = atomic64_read(&to_mdev(ib_dev)->iboe.mac[sqp->qp.port - 1]);
> -			u8 smac[ETH_ALEN];
> -
> -			mlx4_u64_to_smac(smac, mac);
> -			memcpy(sqp->ud_header.eth.smac_h, smac, ETH_ALEN);
> -		} else {
> -			/* use the src mac of the tunnel */
> -			memcpy(sqp->ud_header.eth.smac_h, ah->av.eth.s_mac, ETH_ALEN);
> -		}
>  
>  		if (!memcmp(sqp->ud_header.eth.smac_h, sqp->ud_header.eth.dmac_h, 6))
>  			mlx->flags |= cpu_to_be32(MLX4_WQE_CTRL_FORCE_LOOPBACK);
> 

Thanks, applied.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

      parent reply	other threads:[~2016-01-19 20:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-14 15:47 [PATCH] IB/mlx4: Take source mac from AH instead from the port Moni Shoua
     [not found] ` <1452786458-30341-1-git-send-email-monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-01-19 20:58   ` Doug Ledford [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=569EA35A.3010605@redhat.com \
    --to=dledford-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).