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

2015-02-24 Thread Matan Barak



On 2/23/2015 6:59 PM, Devesh Sharma wrote:



-Original Message-
From: Matan Barak [mailto:mat...@mellanox.com]
Sent: Monday, February 23, 2015 3:47 PM
To: Devesh Sharma; Somnath Kotur; rol...@kernel.org
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH 09/30] IB/core: Modify ib_verbs and cma in order to use
roce_gid_cache



On 2/23/2015 7:25 AM, Devesh Sharma wrote:

Hi Matan,

Please find a comment inline below:

-Regards
Devesh

-Original Message-
From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
ow...@vger.kernel.org] On Behalf Of Somnath Kotur
Sent: Friday, February 20, 2015 3:32 AM
To: rol...@kernel.org
Cc: linux-rdma@vger.kernel.org; Matan Barak; Somnath Kotur
Subject: [PATCH 09/30] IB/core: Modify ib_verbs and cma in order to
use roce_gid_cache

From: Matan Barak 

Previously, we resolved the dmac and took the smac and vlan from the
resolved address. Changing that into finding a net device that
matches the IP and vlan of the network packet and querying the RoCE
GID cache for this net device, GID and GID type.

ocrdma driver changes were done by Somnath Kotur


Signed-off-by: Matan Barak 
Signed-off-by: Somnath Kotur 
---
   drivers/infiniband/core/addr.c   |3 +-
   drivers/infiniband/core/cm.c |   30 --
   drivers/infiniband/core/cma.c|9 --
   drivers/infiniband/core/core_priv.h  |4 +-
   drivers/infiniband/core/sa_query.c   |4 -
   drivers/infiniband/core/ucma.c   |1 -
   drivers/infiniband/core/uverbs_cmd.c |6 +-
   drivers/infiniband/core/verbs.c  |  159 +
   drivers/infiniband/hw/mlx4/ah.c  |   15 +++-
   drivers/infiniband/hw/mlx4/mad.c |   12 ++-
   drivers/infiniband/hw/mlx4/mcg.c |2 +-
   drivers/infiniband/hw/mlx4/mlx4_ib.h |2 +-
   drivers/infiniband/hw/mlx4/qp.c  |   42 ++--
   drivers/infiniband/hw/ocrdma/ocrdma.h|1 +
   drivers/infiniband/hw/ocrdma/ocrdma_ah.c |   20 +++--
   drivers/infiniband/hw/ocrdma/ocrdma_hw.c |   17 ++-
   include/rdma/ib_addr.h   |2 +-
   include/rdma/ib_sa.h |2 -
   include/rdma/ib_verbs.h  |7 +-
   19 files changed, 183 insertions(+), 155 deletions(-)

diff --git a/drivers/infiniband/core/addr.c
b/drivers/infiniband/core/addr.c index f80da50..43af7f5 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -458,7 +458,7 @@ static void resolve_cb(int status, struct
sockaddr *src_addr,  }

   int rdma_addr_find_dmac_by_grh(union ib_gid *sgid, union ib_gid
*dgid, u8 *dmac,
-  u16 *vlan_id)
+  u16 *vlan_id, int if_index)
   {
int ret = 0;
struct rdma_dev_addr dev_addr;
@@ -481,6 +481,7 @@ int rdma_addr_find_dmac_by_grh(union ib_gid
*sgid, union ib_gid *dgid, u8 *dmac,
return ret;

memset(&dev_addr, 0, sizeof(dev_addr));
+   dev_addr.bound_dev_if = if_index;

ctx.addr = &dev_addr;
init_completion(&ctx.comp);
diff --git a/drivers/infiniband/core/cm.c
b/drivers/infiniband/core/cm.c index
d88f2ae..7974e74 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -178,8 +178,6 @@ struct cm_av {
struct ib_ah_attr ah_attr;
u16 pkey_index;
u8 timeout;
-   u8  valid;
-   u8  smac[ETH_ALEN];
   };

   struct cm_work {
@@ -382,7 +380,6 @@ static int cm_init_av_by_path(struct
ib_sa_path_rec *path, struct cm_av *av)
 &av->ah_attr);
av->timeout = path->packet_life_time + 1;

-   av->valid = 1;
return 0;
   }

@@ -1563,7 +1560,6 @@ static int cm_req_handler(struct cm_work *work)
cm_format_paths_from_req(req_msg, &work->path[0], &work-

path[1]);


memcpy(work->path[0].dmac, cm_id_priv->av.ah_attr.dmac,

ETH_ALEN);

-   work->path[0].vlan_id = cm_id_priv->av.ah_attr.vlan_id;
ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av);
if (ret) {
ib_get_cached_gid(work->port->cm_dev->ib_device,
@@ -3511,32 +3507,6 @@ static int cm_init_qp_rtr_attr(struct
cm_id_private *cm_id_priv,
*qp_attr_mask = IB_QP_STATE | IB_QP_AV |

IB_QP_PATH_MTU |

IB_QP_DEST_QPN | IB_QP_RQ_PSN;
qp_attr->ah_attr = cm_id_priv->av.ah_attr;
-   if (!cm_id_priv->av.valid) {
-   spin_unlock_irqrestore(&cm_id_priv->lock, flags);
-   return -EINVAL;
-   }
-   if (cm_id_priv->av.ah_attr.vlan_id != 0x) {
-   qp_attr->vlan_id = cm_id_priv->av.ah_attr.vlan_id;
-   *qp_attr_mask |= IB_QP_VID;
-   }
-   if (!is_zero_ether_addr(cm_id_priv->av.smac)) {
- 

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

2015-02-23 Thread Devesh Sharma

> -Original Message-
> From: Matan Barak [mailto:mat...@mellanox.com]
> Sent: Monday, February 23, 2015 3:47 PM
> To: Devesh Sharma; Somnath Kotur; rol...@kernel.org
> Cc: linux-rdma@vger.kernel.org
> Subject: Re: [PATCH 09/30] IB/core: Modify ib_verbs and cma in order to use
> roce_gid_cache
> 
> 
> 
> On 2/23/2015 7:25 AM, Devesh Sharma wrote:
> > Hi Matan,
> >
> > Please find a comment inline below:
> >
> > -Regards
> > Devesh
> >> -Original Message-
> >> From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
> >> ow...@vger.kernel.org] On Behalf Of Somnath Kotur
> >> Sent: Friday, February 20, 2015 3:32 AM
> >> To: rol...@kernel.org
> >> Cc: linux-rdma@vger.kernel.org; Matan Barak; Somnath Kotur
> >> Subject: [PATCH 09/30] IB/core: Modify ib_verbs and cma in order to
> >> use roce_gid_cache
> >>
> >> From: Matan Barak 
> >>
> >> Previously, we resolved the dmac and took the smac and vlan from the
> >> resolved address. Changing that into finding a net device that
> >> matches the IP and vlan of the network packet and querying the RoCE
> >> GID cache for this net device, GID and GID type.
> >>
> >> ocrdma driver changes were done by Somnath Kotur
> >> 
> >>
> >> Signed-off-by: Matan Barak 
> >> Signed-off-by: Somnath Kotur 
> >> ---
> >>   drivers/infiniband/core/addr.c   |3 +-
> >>   drivers/infiniband/core/cm.c |   30 --
> >>   drivers/infiniband/core/cma.c|9 --
> >>   drivers/infiniband/core/core_priv.h  |4 +-
> >>   drivers/infiniband/core/sa_query.c   |4 -
> >>   drivers/infiniband/core/ucma.c   |1 -
> >>   drivers/infiniband/core/uverbs_cmd.c |6 +-
> >>   drivers/infiniband/core/verbs.c  |  159 
> >> +
> >>   drivers/infiniband/hw/mlx4/ah.c  |   15 +++-
> >>   drivers/infiniband/hw/mlx4/mad.c |   12 ++-
> >>   drivers/infiniband/hw/mlx4/mcg.c |2 +-
> >>   drivers/infiniband/hw/mlx4/mlx4_ib.h |2 +-
> >>   drivers/infiniband/hw/mlx4/qp.c  |   42 ++--
> >>   drivers/infiniband/hw/ocrdma/ocrdma.h|1 +
> >>   drivers/infiniband/hw/ocrdma/ocrdma_ah.c |   20 +++--
> >>   drivers/infiniband/hw/ocrdma/ocrdma_hw.c |   17 ++-
> >>   include/rdma/ib_addr.h   |2 +-
> >>   include/rdma/ib_sa.h |2 -
> >>   include/rdma/ib_verbs.h  |7 +-
> >>   19 files changed, 183 insertions(+), 155 deletions(-)
> >>
> >> diff --git a/drivers/infiniband/core/addr.c
> >> b/drivers/infiniband/core/addr.c index f80da50..43af7f5 100644
> >> --- a/drivers/infiniband/core/addr.c
> >> +++ b/drivers/infiniband/core/addr.c
> >> @@ -458,7 +458,7 @@ static void resolve_cb(int status, struct
> >> sockaddr *src_addr,  }
> >>
> >>   int rdma_addr_find_dmac_by_grh(union ib_gid *sgid, union ib_gid
> >> *dgid, u8 *dmac,
> >> - u16 *vlan_id)
> >> + u16 *vlan_id, int if_index)
> >>   {
> >>int ret = 0;
> >>struct rdma_dev_addr dev_addr;
> >> @@ -481,6 +481,7 @@ int rdma_addr_find_dmac_by_grh(union ib_gid
> >> *sgid, union ib_gid *dgid, u8 *dmac,
> >>return ret;
> >>
> >>memset(&dev_addr, 0, sizeof(dev_addr));
> >> +  dev_addr.bound_dev_if = if_index;
> >>
> >>ctx.addr = &dev_addr;
> >>init_completion(&ctx.comp);
> >> diff --git a/drivers/infiniband/core/cm.c
> >> b/drivers/infiniband/core/cm.c index
> >> d88f2ae..7974e74 100644
> >> --- a/drivers/infiniband/core/cm.c
> >> +++ b/drivers/infiniband/core/cm.c
> >> @@ -178,8 +178,6 @@ struct cm_av {
> >>struct ib_ah_attr ah_attr;
> >>u16 pkey_index;
> >>u8 timeout;
> >> -  u8  valid;
> >> -  u8  smac[ETH_ALEN];
> >>   };
> >>
> >>   struct cm_work {
> >> @@ -382,7 +380,6 @@ static int cm_init_av_by_path(struct
> >> ib_sa_path_rec *path, struct cm_av *av)
> >> &av->ah_attr);
> >>av->timeout = path->packet_life_time + 1;
> >>
> >> -  av->valid = 1;
> >>return 0;
> >>   }
> >>
> >> @@ -1563,7 +1560,6 @@ static int cm

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

2015-02-23 Thread Matan Barak



On 2/23/2015 12:32 PM, Somnath Kotur wrote:




-Original Message-
From: Matan Barak [mailto:mat...@mellanox.com]
Sent: Monday, February 23, 2015 3:47 PM
To: Devesh Sharma; Somnath Kotur; rol...@kernel.org
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH 09/30] IB/core: Modify ib_verbs and cma in order to use
roce_gid_cache



On 2/23/2015 7:25 AM, Devesh Sharma wrote:

Hi Matan,

Please find a comment inline below:

-Regards
Devesh

-Original Message-
From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
ow...@vger.kernel.org] On Behalf Of Somnath Kotur
Sent: Friday, February 20, 2015 3:32 AM
To: rol...@kernel.org
Cc: linux-rdma@vger.kernel.org; Matan Barak; Somnath Kotur
Subject: [PATCH 09/30] IB/core: Modify ib_verbs and cma in order to
use roce_gid_cache

From: Matan Barak 

Previously, we resolved the dmac and took the smac and vlan from the
resolved address. Changing that into finding a net device that
matches the IP and vlan of the network packet and querying the RoCE
GID cache for this net device, GID and GID type.

ocrdma driver changes were done by Somnath Kotur


Signed-off-by: Matan Barak 
Signed-off-by: Somnath Kotur 
---
   drivers/infiniband/core/addr.c   |3 +-
   drivers/infiniband/core/cm.c |   30 --
   drivers/infiniband/core/cma.c|9 --
   drivers/infiniband/core/core_priv.h  |4 +-
   drivers/infiniband/core/sa_query.c   |4 -
   drivers/infiniband/core/ucma.c   |1 -
   drivers/infiniband/core/uverbs_cmd.c |6 +-
   drivers/infiniband/core/verbs.c  |  159 +--

--

   drivers/infiniband/hw/mlx4/ah.c  |   15 +++-
   drivers/infiniband/hw/mlx4/mad.c |   12 ++-
   drivers/infiniband/hw/mlx4/mcg.c |2 +-
   drivers/infiniband/hw/mlx4/mlx4_ib.h |2 +-
   drivers/infiniband/hw/mlx4/qp.c  |   42 ++--
   drivers/infiniband/hw/ocrdma/ocrdma.h|1 +
   drivers/infiniband/hw/ocrdma/ocrdma_ah.c |   20 +++--
   drivers/infiniband/hw/ocrdma/ocrdma_hw.c |   17 ++-
   include/rdma/ib_addr.h   |2 +-
   include/rdma/ib_sa.h |2 -
   include/rdma/ib_verbs.h  |7 +-
   19 files changed, 183 insertions(+), 155 deletions(-)

diff --git a/drivers/infiniband/core/addr.c
b/drivers/infiniband/core/addr.c index f80da50..43af7f5 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -458,7 +458,7 @@ static void resolve_cb(int status, struct
sockaddr *src_addr,  }

   int rdma_addr_find_dmac_by_grh(union ib_gid *sgid, union ib_gid
*dgid, u8 *dmac,
-  u16 *vlan_id)
+  u16 *vlan_id, int if_index)
   {
int ret = 0;
struct rdma_dev_addr dev_addr;
@@ -481,6 +481,7 @@ int rdma_addr_find_dmac_by_grh(union ib_gid
*sgid, union ib_gid *dgid, u8 *dmac,
return ret;

memset(&dev_addr, 0, sizeof(dev_addr));
+   dev_addr.bound_dev_if = if_index;

ctx.addr = &dev_addr;
init_completion(&ctx.comp);
diff --git a/drivers/infiniband/core/cm.c
b/drivers/infiniband/core/cm.c index
d88f2ae..7974e74 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -178,8 +178,6 @@ struct cm_av {
struct ib_ah_attr ah_attr;
u16 pkey_index;
u8 timeout;
-   u8  valid;
-   u8  smac[ETH_ALEN];
   };

   struct cm_work {
@@ -382,7 +380,6 @@ static int cm_init_av_by_path(struct
ib_sa_path_rec *path, struct cm_av *av)
 &av->ah_attr);
av->timeout = path->packet_life_time + 1;

-   av->valid = 1;
return 0;
   }

@@ -1563,7 +1560,6 @@ static int cm_req_handler(struct cm_work

*work)

cm_format_paths_from_req(req_msg, &work->path[0], &work-

path[1]);


memcpy(work->path[0].dmac, cm_id_priv->av.ah_attr.dmac,

ETH_ALEN);

-   work->path[0].vlan_id = cm_id_priv->av.ah_attr.vlan_id;
ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av);
if (ret) {
ib_get_cached_gid(work->port->cm_dev->ib_device,
@@ -3511,32 +3507,6 @@ static int cm_init_qp_rtr_attr(struct
cm_id_private *cm_id_priv,
*qp_attr_mask = IB_QP_STATE | IB_QP_AV |

IB_QP_PATH_MTU |

IB_QP_DEST_QPN | IB_QP_RQ_PSN;
qp_attr->ah_attr = cm_id_priv->av.ah_attr;
-   if (!cm_id_priv->av.valid) {
-   spin_unlock_irqrestore(&cm_id_priv->lock, flags);
-   return -EINVAL;
-   }
-   if (cm_id_priv->av.ah_attr.vlan_id != 0x) {
-   qp_attr->vlan_id = cm_id_priv->av.ah_attr.vlan_id;
-   *qp_attr_mask |= IB_QP_VID;
-   }
-   if (!is_zero_ether_addr(cm_id_priv->av.smac)) {
- 

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

2015-02-23 Thread Matan Barak



On 2/23/2015 7:25 AM, Devesh Sharma wrote:

Hi Matan,

Please find a comment inline below:

-Regards
Devesh

-Original Message-
From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
ow...@vger.kernel.org] On Behalf Of Somnath Kotur
Sent: Friday, February 20, 2015 3:32 AM
To: rol...@kernel.org
Cc: linux-rdma@vger.kernel.org; Matan Barak; Somnath Kotur
Subject: [PATCH 09/30] IB/core: Modify ib_verbs and cma in order to use
roce_gid_cache

From: Matan Barak 

Previously, we resolved the dmac and took the smac and vlan from the resolved
address. Changing that into finding a net device that matches the IP and vlan of
the network packet and querying the RoCE GID cache for this net device, GID
and GID type.

ocrdma driver changes were done by Somnath Kotur


Signed-off-by: Matan Barak 
Signed-off-by: Somnath Kotur 
---
  drivers/infiniband/core/addr.c   |3 +-
  drivers/infiniband/core/cm.c |   30 --
  drivers/infiniband/core/cma.c|9 --
  drivers/infiniband/core/core_priv.h  |4 +-
  drivers/infiniband/core/sa_query.c   |4 -
  drivers/infiniband/core/ucma.c   |1 -
  drivers/infiniband/core/uverbs_cmd.c |6 +-
  drivers/infiniband/core/verbs.c  |  159 +
  drivers/infiniband/hw/mlx4/ah.c  |   15 +++-
  drivers/infiniband/hw/mlx4/mad.c |   12 ++-
  drivers/infiniband/hw/mlx4/mcg.c |2 +-
  drivers/infiniband/hw/mlx4/mlx4_ib.h |2 +-
  drivers/infiniband/hw/mlx4/qp.c  |   42 ++--
  drivers/infiniband/hw/ocrdma/ocrdma.h|1 +
  drivers/infiniband/hw/ocrdma/ocrdma_ah.c |   20 +++--
  drivers/infiniband/hw/ocrdma/ocrdma_hw.c |   17 ++-
  include/rdma/ib_addr.h   |2 +-
  include/rdma/ib_sa.h |2 -
  include/rdma/ib_verbs.h  |7 +-
  19 files changed, 183 insertions(+), 155 deletions(-)

diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index f80da50..43af7f5 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -458,7 +458,7 @@ static void resolve_cb(int status, struct sockaddr
*src_addr,  }

  int rdma_addr_find_dmac_by_grh(union ib_gid *sgid, union ib_gid *dgid, u8
*dmac,
-  u16 *vlan_id)
+  u16 *vlan_id, int if_index)
  {
int ret = 0;
struct rdma_dev_addr dev_addr;
@@ -481,6 +481,7 @@ int rdma_addr_find_dmac_by_grh(union ib_gid *sgid,
union ib_gid *dgid, u8 *dmac,
return ret;

memset(&dev_addr, 0, sizeof(dev_addr));
+   dev_addr.bound_dev_if = if_index;

ctx.addr = &dev_addr;
init_completion(&ctx.comp);
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index
d88f2ae..7974e74 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -178,8 +178,6 @@ struct cm_av {
struct ib_ah_attr ah_attr;
u16 pkey_index;
u8 timeout;
-   u8  valid;
-   u8  smac[ETH_ALEN];
  };

  struct cm_work {
@@ -382,7 +380,6 @@ static int cm_init_av_by_path(struct ib_sa_path_rec
*path, struct cm_av *av)
 &av->ah_attr);
av->timeout = path->packet_life_time + 1;

-   av->valid = 1;
return 0;
  }

@@ -1563,7 +1560,6 @@ static int cm_req_handler(struct cm_work *work)
cm_format_paths_from_req(req_msg, &work->path[0], &work-

path[1]);


memcpy(work->path[0].dmac, cm_id_priv->av.ah_attr.dmac,
ETH_ALEN);
-   work->path[0].vlan_id = cm_id_priv->av.ah_attr.vlan_id;
ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av);
if (ret) {
ib_get_cached_gid(work->port->cm_dev->ib_device,
@@ -3511,32 +3507,6 @@ static int cm_init_qp_rtr_attr(struct cm_id_private
*cm_id_priv,
*qp_attr_mask = IB_QP_STATE | IB_QP_AV |
IB_QP_PATH_MTU |
IB_QP_DEST_QPN | IB_QP_RQ_PSN;
qp_attr->ah_attr = cm_id_priv->av.ah_attr;
-   if (!cm_id_priv->av.valid) {
-   spin_unlock_irqrestore(&cm_id_priv->lock, flags);
-   return -EINVAL;
-   }
-   if (cm_id_priv->av.ah_attr.vlan_id != 0x) {
-   qp_attr->vlan_id = cm_id_priv->av.ah_attr.vlan_id;
-   *qp_attr_mask |= IB_QP_VID;
-   }
-   if (!is_zero_ether_addr(cm_id_priv->av.smac)) {
-   memcpy(qp_attr->smac, cm_id_priv->av.smac,
-  sizeof(qp_attr->smac));
-   *qp_attr_mask |= IB_QP_SMAC;
-   }
-   if (cm_id_priv->alt_av.valid) {
-   if (cm_id_priv->alt_av.ah_attr.vlan_id != 0x) {
-   qp_attr->alt_vlan_id =
-   cm_id_priv->alt_av.ah_attr.vlan_id;
-   *

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

2015-02-23 Thread Somnath Kotur


> -Original Message-
> From: Matan Barak [mailto:mat...@mellanox.com]
> Sent: Monday, February 23, 2015 3:47 PM
> To: Devesh Sharma; Somnath Kotur; rol...@kernel.org
> Cc: linux-rdma@vger.kernel.org
> Subject: Re: [PATCH 09/30] IB/core: Modify ib_verbs and cma in order to use
> roce_gid_cache
> 
> 
> 
> On 2/23/2015 7:25 AM, Devesh Sharma wrote:
> > Hi Matan,
> >
> > Please find a comment inline below:
> >
> > -Regards
> > Devesh
> >> -Original Message-
> >> From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
> >> ow...@vger.kernel.org] On Behalf Of Somnath Kotur
> >> Sent: Friday, February 20, 2015 3:32 AM
> >> To: rol...@kernel.org
> >> Cc: linux-rdma@vger.kernel.org; Matan Barak; Somnath Kotur
> >> Subject: [PATCH 09/30] IB/core: Modify ib_verbs and cma in order to
> >> use roce_gid_cache
> >>
> >> From: Matan Barak 
> >>
> >> Previously, we resolved the dmac and took the smac and vlan from the
> >> resolved address. Changing that into finding a net device that
> >> matches the IP and vlan of the network packet and querying the RoCE
> >> GID cache for this net device, GID and GID type.
> >>
> >> ocrdma driver changes were done by Somnath Kotur
> >> 
> >>
> >> Signed-off-by: Matan Barak 
> >> Signed-off-by: Somnath Kotur 
> >> ---
> >>   drivers/infiniband/core/addr.c   |3 +-
> >>   drivers/infiniband/core/cm.c |   30 --
> >>   drivers/infiniband/core/cma.c|9 --
> >>   drivers/infiniband/core/core_priv.h  |4 +-
> >>   drivers/infiniband/core/sa_query.c   |4 -
> >>   drivers/infiniband/core/ucma.c   |1 -
> >>   drivers/infiniband/core/uverbs_cmd.c |6 +-
> >>   drivers/infiniband/core/verbs.c  |  159 
> >> +--
> --
> >>   drivers/infiniband/hw/mlx4/ah.c  |   15 +++-
> >>   drivers/infiniband/hw/mlx4/mad.c |   12 ++-
> >>   drivers/infiniband/hw/mlx4/mcg.c |2 +-
> >>   drivers/infiniband/hw/mlx4/mlx4_ib.h |2 +-
> >>   drivers/infiniband/hw/mlx4/qp.c  |   42 ++--
> >>   drivers/infiniband/hw/ocrdma/ocrdma.h|1 +
> >>   drivers/infiniband/hw/ocrdma/ocrdma_ah.c |   20 +++--
> >>   drivers/infiniband/hw/ocrdma/ocrdma_hw.c |   17 ++-
> >>   include/rdma/ib_addr.h   |2 +-
> >>   include/rdma/ib_sa.h |2 -
> >>   include/rdma/ib_verbs.h  |7 +-
> >>   19 files changed, 183 insertions(+), 155 deletions(-)
> >>
> >> diff --git a/drivers/infiniband/core/addr.c
> >> b/drivers/infiniband/core/addr.c index f80da50..43af7f5 100644
> >> --- a/drivers/infiniband/core/addr.c
> >> +++ b/drivers/infiniband/core/addr.c
> >> @@ -458,7 +458,7 @@ static void resolve_cb(int status, struct
> >> sockaddr *src_addr,  }
> >>
> >>   int rdma_addr_find_dmac_by_grh(union ib_gid *sgid, union ib_gid
> >> *dgid, u8 *dmac,
> >> - u16 *vlan_id)
> >> + u16 *vlan_id, int if_index)
> >>   {
> >>int ret = 0;
> >>struct rdma_dev_addr dev_addr;
> >> @@ -481,6 +481,7 @@ int rdma_addr_find_dmac_by_grh(union ib_gid
> >> *sgid, union ib_gid *dgid, u8 *dmac,
> >>return ret;
> >>
> >>memset(&dev_addr, 0, sizeof(dev_addr));
> >> +  dev_addr.bound_dev_if = if_index;
> >>
> >>ctx.addr = &dev_addr;
> >>init_completion(&ctx.comp);
> >> diff --git a/drivers/infiniband/core/cm.c
> >> b/drivers/infiniband/core/cm.c index
> >> d88f2ae..7974e74 100644
> >> --- a/drivers/infiniband/core/cm.c
> >> +++ b/drivers/infiniband/core/cm.c
> >> @@ -178,8 +178,6 @@ struct cm_av {
> >>struct ib_ah_attr ah_attr;
> >>u16 pkey_index;
> >>u8 timeout;
> >> -  u8  valid;
> >> -  u8  smac[ETH_ALEN];
> >>   };
> >>
> >>   struct cm_work {
> >> @@ -382,7 +380,6 @@ static int cm_init_av_by_path(struct
> >> ib_sa_path_rec *path, struct cm_av *av)
> >> &av->ah_attr);
> >>av->timeout = path->packet_life_time + 1;
> >>
> >> -  av->valid = 1;
> >>return 0;
> >>   }
> >>
> >> @@ -1563,7 +1560,6 @@ static int c

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

2015-02-22 Thread Devesh Sharma
Hi Matan,

Please find a comment inline below:

-Regards
Devesh
> -Original Message-
> From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
> ow...@vger.kernel.org] On Behalf Of Somnath Kotur
> Sent: Friday, February 20, 2015 3:32 AM
> To: rol...@kernel.org
> Cc: linux-rdma@vger.kernel.org; Matan Barak; Somnath Kotur
> Subject: [PATCH 09/30] IB/core: Modify ib_verbs and cma in order to use
> roce_gid_cache
> 
> From: Matan Barak 
> 
> Previously, we resolved the dmac and took the smac and vlan from the resolved
> address. Changing that into finding a net device that matches the IP and vlan 
> of
> the network packet and querying the RoCE GID cache for this net device, GID
> and GID type.
> 
> ocrdma driver changes were done by Somnath Kotur
> 
> 
> Signed-off-by: Matan Barak 
> Signed-off-by: Somnath Kotur 
> ---
>  drivers/infiniband/core/addr.c   |3 +-
>  drivers/infiniband/core/cm.c |   30 --
>  drivers/infiniband/core/cma.c|9 --
>  drivers/infiniband/core/core_priv.h  |4 +-
>  drivers/infiniband/core/sa_query.c   |4 -
>  drivers/infiniband/core/ucma.c   |1 -
>  drivers/infiniband/core/uverbs_cmd.c |6 +-
>  drivers/infiniband/core/verbs.c  |  159 +
>  drivers/infiniband/hw/mlx4/ah.c  |   15 +++-
>  drivers/infiniband/hw/mlx4/mad.c |   12 ++-
>  drivers/infiniband/hw/mlx4/mcg.c |2 +-
>  drivers/infiniband/hw/mlx4/mlx4_ib.h |2 +-
>  drivers/infiniband/hw/mlx4/qp.c  |   42 ++--
>  drivers/infiniband/hw/ocrdma/ocrdma.h|1 +
>  drivers/infiniband/hw/ocrdma/ocrdma_ah.c |   20 +++--
>  drivers/infiniband/hw/ocrdma/ocrdma_hw.c |   17 ++-
>  include/rdma/ib_addr.h   |2 +-
>  include/rdma/ib_sa.h |2 -
>  include/rdma/ib_verbs.h  |7 +-
>  19 files changed, 183 insertions(+), 155 deletions(-)
> 
> diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
> index f80da50..43af7f5 100644
> --- a/drivers/infiniband/core/addr.c
> +++ b/drivers/infiniband/core/addr.c
> @@ -458,7 +458,7 @@ static void resolve_cb(int status, struct sockaddr
> *src_addr,  }
> 
>  int rdma_addr_find_dmac_by_grh(union ib_gid *sgid, union ib_gid *dgid, u8
> *dmac,
> -u16 *vlan_id)
> +u16 *vlan_id, int if_index)
>  {
>   int ret = 0;
>   struct rdma_dev_addr dev_addr;
> @@ -481,6 +481,7 @@ int rdma_addr_find_dmac_by_grh(union ib_gid *sgid,
> union ib_gid *dgid, u8 *dmac,
>   return ret;
> 
>   memset(&dev_addr, 0, sizeof(dev_addr));
> + dev_addr.bound_dev_if = if_index;
> 
>   ctx.addr = &dev_addr;
>   init_completion(&ctx.comp);
> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index
> d88f2ae..7974e74 100644
> --- a/drivers/infiniband/core/cm.c
> +++ b/drivers/infiniband/core/cm.c
> @@ -178,8 +178,6 @@ struct cm_av {
>   struct ib_ah_attr ah_attr;
>   u16 pkey_index;
>   u8 timeout;
> - u8  valid;
> - u8  smac[ETH_ALEN];
>  };
> 
>  struct cm_work {
> @@ -382,7 +380,6 @@ static int cm_init_av_by_path(struct ib_sa_path_rec
> *path, struct cm_av *av)
>&av->ah_attr);
>   av->timeout = path->packet_life_time + 1;
> 
> - av->valid = 1;
>   return 0;
>  }
> 
> @@ -1563,7 +1560,6 @@ static int cm_req_handler(struct cm_work *work)
>   cm_format_paths_from_req(req_msg, &work->path[0], &work-
> >path[1]);
> 
>   memcpy(work->path[0].dmac, cm_id_priv->av.ah_attr.dmac,
> ETH_ALEN);
> - work->path[0].vlan_id = cm_id_priv->av.ah_attr.vlan_id;
>   ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av);
>   if (ret) {
>   ib_get_cached_gid(work->port->cm_dev->ib_device,
> @@ -3511,32 +3507,6 @@ static int cm_init_qp_rtr_attr(struct cm_id_private
> *cm_id_priv,
>   *qp_attr_mask = IB_QP_STATE | IB_QP_AV |
> IB_QP_PATH_MTU |
>   IB_QP_DEST_QPN | IB_QP_RQ_PSN;
>   qp_attr->ah_attr = cm_id_priv->av.ah_attr;
> - if (!cm_id_priv->av.valid) {
> - spin_unlock_irqrestore(&cm_id_priv->lock, flags);
> - return -EINVAL;
> - }
> - if (cm_id_priv->av.ah_attr.vlan_id != 0x) {
> - qp_attr->vlan_id = cm_id_priv->av.ah_attr.vlan_id;
> - *qp_attr_mask |= IB_QP_VID;
> - }
> - if (!is_zero_ether_addr(cm_id_priv->av.smac)) {
> - memcpy(qp_attr->smac, cm_id_priv->av.smac,
> -sizeof(qp_attr->smac));
> - *qp_attr_mask |= IB_QP_SMAC;
> - }
> - if (cm_id_priv->alt_av.valid) {
> - if (cm_id_priv->alt_av.ah_attr.vlan_id != 0x) {
> - qp_attr->alt_vlan_id =
> -   

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

2015-02-21 Thread Haggai Eran
On 19/02/2015 17:31, Matan Barak wrote:
> On 2/19/2015 5:03 PM, Haggai Eran wrote:
>> On 20/02/2015 00:02, Somnath Kotur wrote:
>>> @@ -502,9 +547,7 @@ EXPORT_SYMBOL(ib_create_qp);
>>>   static const struct {
>>>   intvalid;
>>>   enum ib_qp_attr_maskreq_param[IB_QPT_MAX];
>>> -enum ib_qp_attr_maskreq_param_add_eth[IB_QPT_MAX];
>>>   enum ib_qp_attr_maskopt_param[IB_QPT_MAX];
>>> -enum ib_qp_attr_maskopt_param_add_eth[IB_QPT_MAX];
>>>   } qp_state_table[IB_QPS_ERR + 1][IB_QPS_ERR + 1] = {
>>>   [IB_QPS_RESET] = {
>>>   [IB_QPS_RESET] = { .valid = 1 },
>>> @@ -585,12 +628,6 @@ static const struct {
>>>   IB_QP_MAX_DEST_RD_ATOMIC|
>>>   IB_QP_MIN_RNR_TIMER),
>>>   },
>>> -.req_param_add_eth = {
>>> -[IB_QPT_RC]  = (IB_QP_SMAC),
>>> -[IB_QPT_UC]  = (IB_QP_SMAC),
>>> -[IB_QPT_XRC_INI]  = (IB_QP_SMAC),
>>> -[IB_QPT_XRC_TGT]  = (IB_QP_SMAC)
>>> -},
>>>   .opt_param = {
>>>[IB_QPT_UD]  = (IB_QP_PKEY_INDEX|
>>>IB_QP_QKEY),
>>> @@ -611,21 +648,7 @@ static const struct {
>>>[IB_QPT_GSI] = (IB_QP_PKEY_INDEX|
>>>IB_QP_QKEY),
>>>},
>>> -.opt_param_add_eth = {
>>> -[IB_QPT_RC]  = (IB_QP_ALT_SMAC|
>>> -IB_QP_VID|
>>> -IB_QP_ALT_VID),
>>> -[IB_QPT_UC]  = (IB_QP_ALT_SMAC|
>>> -IB_QP_VID|
>>> -IB_QP_ALT_VID),
>>> -[IB_QPT_XRC_INI]  = (IB_QP_ALT_SMAC|
>>> -IB_QP_VID|
>>> -IB_QP_ALT_VID),
>>> -[IB_QPT_XRC_TGT]  = (IB_QP_ALT_SMAC|
>>> -IB_QP_VID|
>>> -IB_QP_ALT_VID)
>>> -}
>>> -}
>>> +},
>>>   },
>>>   [IB_QPS_RTR]   = {
>>>   [IB_QPS_RESET] = { .valid = 1 },
>>> @@ -847,13 +870,6 @@ int ib_modify_qp_is_ok(enum ib_qp_state
>>> cur_state, enum ib_qp_state next_state,
>>>   req_param = qp_state_table[cur_state][next_state].req_param[type];
>>>   opt_param = qp_state_table[cur_state][next_state].opt_param[type];
>>>
>>> -if (ll == IB_LINK_LAYER_ETHERNET) {
>>> -req_param |= qp_state_table[cur_state][next_state].
>>> -req_param_add_eth[type];
>>> -opt_param |= qp_state_table[cur_state][next_state].
>>> -opt_param_add_eth[type];
>>> -}
>>> -
>>>   if ((mask & req_param) != req_param)
>>>   return 0;
>>
>> I understand this patch will remove any kernel reference to these
>> modify_qp attributes. However, what about user-space? Was it previously
>> allowed to pass in these parameters?
> 
> There was no libibverbs that declared those flags. It was filled by
> ib_resolve_eth_l2_attrs. If someone wrote a custom libibverbs that
> passed those flags, they would have just been ignored. We could replace
> them as reserved flags. What do you think?

I guess if there's no existing user space it's okay. Perhaps it would be
best to add some explicit input-checking to the ib_uverbs_modify_qp()
verb to prevent such dilemmas in the future.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-02-21 Thread Haggai Eran
On 19/02/2015 17:24, Matan Barak wrote:
> 
> 
> 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 : 0x;
>>> +
>>>   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 = 0x;
>>
>> Previously vlan_id would get set to 0x 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.
> 

Ah, okay. I missed that :)

Haggai

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-02-19 Thread Haggai Eran
On 20/02/2015 00:02, Somnath Kotur wrote:
> --- a/drivers/infiniband/core/addr.c
> +++ b/drivers/infiniband/core/addr.c
> @@ -458,7 +458,7 @@ static void resolve_cb(int status, struct sockaddr 
> *src_addr,
>  }
>  
>  int rdma_addr_find_dmac_by_grh(union ib_gid *sgid, union ib_gid *dgid, u8 
> *dmac,
> -u16 *vlan_id)
> +u16 *vlan_id, int if_index)
>  {
>   int ret = 0;
>   struct rdma_dev_addr dev_addr;
> @@ -481,6 +481,7 @@ int rdma_addr_find_dmac_by_grh(union ib_gid *sgid, union 
> ib_gid *dgid, u8 *dmac,
>   return ret;
>  
>   memset(&dev_addr, 0, sizeof(dev_addr));
> + dev_addr.bound_dev_if = if_index;

There's a call to rdma_resolve_ip later in this function. I think it
overrides the if_index you store here.

I would expect this function to somehow limit the address resolution
done by rdma_resolve_ip so that the result has to use if_index as a
source interface.

>  
>   ctx.addr = &dev_addr;
>   init_completion(&ctx.comp);

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-02-19 Thread Matan Barak



On 2/19/2015 5:18 PM, Haggai Eran wrote:

On 20/02/2015 00:02, Somnath Kotur wrote:

--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -458,7 +458,7 @@ static void resolve_cb(int status, struct sockaddr 
*src_addr,
  }

  int rdma_addr_find_dmac_by_grh(union ib_gid *sgid, union ib_gid *dgid, u8 
*dmac,
-  u16 *vlan_id)
+  u16 *vlan_id, int if_index)
  {
int ret = 0;
struct rdma_dev_addr dev_addr;
@@ -481,6 +481,7 @@ int rdma_addr_find_dmac_by_grh(union ib_gid *sgid, union 
ib_gid *dgid, u8 *dmac,
return ret;

memset(&dev_addr, 0, sizeof(dev_addr));
+   dev_addr.bound_dev_if = if_index;


There's a call to rdma_resolve_ip later in this function. I think it
overrides the if_index you store here.

I would expect this function to somehow limit the address resolution
done by rdma_resolve_ip so that the result has to use if_index as a
source interface.



I'm not sure that's correct:
static int addr4_resolve(struct sockaddr_in *src_in,
 struct sockaddr_in *dst_in,
 struct rdma_dev_addr *addr)
{
__be32 src_ip = src_in->sin_addr.s_addr;
__be32 dst_ip = dst_in->sin_addr.s_addr;
struct rtable *rt;
struct flowi4 fl4;
int ret;

memset(&fl4, 0, sizeof(fl4));
fl4.daddr = dst_ip;
fl4.saddr = src_ip;
fl4.flowi4_oif = addr->bound_dev_if;

static int addr6_resolve(struct sockaddr_in6 *src_in,
 struct sockaddr_in6 *dst_in,
 struct rdma_dev_addr *addr)
{
struct flowi6 fl6;
struct dst_entry *dst;
struct rt6_info *rt;
int ret;

memset(&fl6, 0, sizeof fl6);
fl6.daddr = dst_in->sin6_addr;
fl6.saddr = src_in->sin6_addr;
fl6.flowi6_oif = addr->bound_dev_if;


bound_dev_if is the if_index we would like to use.




ctx.addr = &dev_addr;
init_completion(&ctx.comp);



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-02-19 Thread Matan Barak



On 2/19/2015 5:03 PM, Haggai Eran wrote:

On 20/02/2015 00:02, Somnath Kotur wrote:

@@ -502,9 +547,7 @@ EXPORT_SYMBOL(ib_create_qp);
  static const struct {
int valid;
enum ib_qp_attr_maskreq_param[IB_QPT_MAX];
-   enum ib_qp_attr_maskreq_param_add_eth[IB_QPT_MAX];
enum ib_qp_attr_maskopt_param[IB_QPT_MAX];
-   enum ib_qp_attr_maskopt_param_add_eth[IB_QPT_MAX];
  } qp_state_table[IB_QPS_ERR + 1][IB_QPS_ERR + 1] = {
[IB_QPS_RESET] = {
[IB_QPS_RESET] = { .valid = 1 },
@@ -585,12 +628,6 @@ static const struct {
IB_QP_MAX_DEST_RD_ATOMIC
|
IB_QP_MIN_RNR_TIMER),
},
-   .req_param_add_eth = {
-   [IB_QPT_RC]  = (IB_QP_SMAC),
-   [IB_QPT_UC]  = (IB_QP_SMAC),
-   [IB_QPT_XRC_INI]  = (IB_QP_SMAC),
-   [IB_QPT_XRC_TGT]  = (IB_QP_SMAC)
-   },
.opt_param = {
 [IB_QPT_UD]  = (IB_QP_PKEY_INDEX   
|
 IB_QP_QKEY),
@@ -611,21 +648,7 @@ static const struct {
 [IB_QPT_GSI] = (IB_QP_PKEY_INDEX   
|
 IB_QP_QKEY),
 },
-   .opt_param_add_eth = {
-   [IB_QPT_RC]  = (IB_QP_ALT_SMAC  
|
-   IB_QP_VID   
|
-   IB_QP_ALT_VID),
-   [IB_QPT_UC]  = (IB_QP_ALT_SMAC  
|
-   IB_QP_VID   
|
-   IB_QP_ALT_VID),
-   [IB_QPT_XRC_INI]  = (IB_QP_ALT_SMAC 
|
-   IB_QP_VID   
|
-   IB_QP_ALT_VID),
-   [IB_QPT_XRC_TGT]  = (IB_QP_ALT_SMAC 
|
-   IB_QP_VID   
|
-   IB_QP_ALT_VID)
-   }
-   }
+   },
},
[IB_QPS_RTR]   = {
[IB_QPS_RESET] = { .valid = 1 },
@@ -847,13 +870,6 @@ int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum 
ib_qp_state next_state,
req_param = qp_state_table[cur_state][next_state].req_param[type];
opt_param = qp_state_table[cur_state][next_state].opt_param[type];

-   if (ll == IB_LINK_LAYER_ETHERNET) {
-   req_param |= qp_state_table[cur_state][next_state].
-   req_param_add_eth[type];
-   opt_param |= qp_state_table[cur_state][next_state].
-   opt_param_add_eth[type];
-   }
-
if ((mask & req_param) != req_param)
return 0;



I understand this patch will remove any kernel reference to these
modify_qp attributes. However, what about user-space? Was it previously
allowed to pass in these parameters?



There was no libibverbs that declared those flags. It was filled by 
ib_resolve_eth_l2_attrs. If someone wrote a custom libibverbs that 
passed those flags, they would have just been ignored. We could replace 
them as reserved flags. What do you think?


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-02-19 Thread Matan Barak



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 : 0x;
+
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 = 0x;


Previously vlan_id would get set to 0x 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-02-19 Thread Haggai Eran
On 20/02/2015 00:02, Somnath Kotur wrote:
> @@ -502,9 +547,7 @@ EXPORT_SYMBOL(ib_create_qp);
>  static const struct {
>   int valid;
>   enum ib_qp_attr_maskreq_param[IB_QPT_MAX];
> - enum ib_qp_attr_maskreq_param_add_eth[IB_QPT_MAX];
>   enum ib_qp_attr_maskopt_param[IB_QPT_MAX];
> - enum ib_qp_attr_maskopt_param_add_eth[IB_QPT_MAX];
>  } qp_state_table[IB_QPS_ERR + 1][IB_QPS_ERR + 1] = {
>   [IB_QPS_RESET] = {
>   [IB_QPS_RESET] = { .valid = 1 },
> @@ -585,12 +628,6 @@ static const struct {
>   IB_QP_MAX_DEST_RD_ATOMIC
> |
>   IB_QP_MIN_RNR_TIMER),
>   },
> - .req_param_add_eth = {
> - [IB_QPT_RC]  = (IB_QP_SMAC),
> - [IB_QPT_UC]  = (IB_QP_SMAC),
> - [IB_QPT_XRC_INI]  = (IB_QP_SMAC),
> - [IB_QPT_XRC_TGT]  = (IB_QP_SMAC)
> - },
>   .opt_param = {
>[IB_QPT_UD]  = (IB_QP_PKEY_INDEX   
> |
>IB_QP_QKEY),
> @@ -611,21 +648,7 @@ static const struct {
>[IB_QPT_GSI] = (IB_QP_PKEY_INDEX   
> |
>IB_QP_QKEY),
>},
> - .opt_param_add_eth = {
> - [IB_QPT_RC]  = (IB_QP_ALT_SMAC  
> |
> - IB_QP_VID   
> |
> - IB_QP_ALT_VID),
> - [IB_QPT_UC]  = (IB_QP_ALT_SMAC  
> |
> - IB_QP_VID   
> |
> - IB_QP_ALT_VID),
> - [IB_QPT_XRC_INI]  = (IB_QP_ALT_SMAC 
> |
> - IB_QP_VID   
> |
> - IB_QP_ALT_VID),
> - [IB_QPT_XRC_TGT]  = (IB_QP_ALT_SMAC 
> |
> - IB_QP_VID   
> |
> - IB_QP_ALT_VID)
> - }
> - }
> + },
>   },
>   [IB_QPS_RTR]   = {
>   [IB_QPS_RESET] = { .valid = 1 },
> @@ -847,13 +870,6 @@ int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum 
> ib_qp_state next_state,
>   req_param = qp_state_table[cur_state][next_state].req_param[type];
>   opt_param = qp_state_table[cur_state][next_state].opt_param[type];
>  
> - if (ll == IB_LINK_LAYER_ETHERNET) {
> - req_param |= qp_state_table[cur_state][next_state].
> - req_param_add_eth[type];
> - opt_param |= qp_state_table[cur_state][next_state].
> - opt_param_add_eth[type];
> - }
> -
>   if ((mask & req_param) != req_param)
>   return 0;
>  

I understand this patch will remove any kernel reference to these
modify_qp attributes. However, what about user-space? Was it previously
allowed to pass in these parameters?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-02-19 Thread Haggai Eran
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 : 0x;
> +
>   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 = 0x;

Previously vlan_id would get set to 0x 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-02-19 Thread Or Gerlitz
On Thu, Feb 19, 2015 at 3:22 PM, Matan Barak  wrote:
> On 2/19/2015 2:52 PM, Haggai Eran wrote:
>> On 20/02/2015 00:02, Somnath Kotur wrote:
>>> --- a/drivers/infiniband/core/uverbs_cmd.c
>>> +++ b/drivers/infiniband/core/uverbs_cmd.c
>>> @@ -2089,15 +2089,16 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file
>>> *file,
>>> attr->alt_ah_attr.port_num  = cmd.alt_dest.port_num;
>>>
>>> if (qp->real_qp == qp) {
>>> -   ret = ib_resolve_eth_l2_attrs(qp, attr, &cmd.attr_mask);
>>> +   ret = ib_resolve_eth_dmac(qp, attr, &cmd.attr_mask);
>>> if (ret)
>>> -   goto out;
>>> +   goto out_put;
>>> ret = qp->device->modify_qp(qp, attr,
>>> modify_qp_mask(qp->qp_type, cmd.attr_mask),
>>> &udata);
>>> } else {
>>> ret = ib_modify_qp(qp, attr, modify_qp_mask(qp->qp_type,
>>> cmd.attr_mask));
>>> }
>>>
>>> +out_put:
>>> put_qp_read(qp);
>>
>>
>> This seem to solve a leak of QP references when dmac resolution fails.
>> I'm not sure it belongs with the rest of the patch.
>
>
> I'll remove the fix from this patch.

we just pushed a fix to this leak

http://git.kernel.org/cgit/linux/kernel/git/roland/infiniband.git/commit/?id=0fb8bcf022f19a375d7c4bd79ac513da8ae6d78b
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-02-19 Thread Matan Barak



On 2/19/2015 2:52 PM, Haggai Eran wrote:

On 20/02/2015 00:02, Somnath Kotur wrote:

--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -2089,15 +2089,16 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
attr->alt_ah_attr.port_num   = cmd.alt_dest.port_num;

if (qp->real_qp == qp) {
-   ret = ib_resolve_eth_l2_attrs(qp, attr, &cmd.attr_mask);
+   ret = ib_resolve_eth_dmac(qp, attr, &cmd.attr_mask);
if (ret)
-   goto out;
+   goto out_put;
ret = qp->device->modify_qp(qp, attr,
modify_qp_mask(qp->qp_type, cmd.attr_mask), &udata);
} else {
ret = ib_modify_qp(qp, attr, modify_qp_mask(qp->qp_type, 
cmd.attr_mask));
}

+out_put:
put_qp_read(qp);


This seem to solve a leak of QP references when dmac resolution fails.
I'm not sure it belongs with the rest of the patch.


I'll remove the fix from this patch.

Thanks!


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-02-19 Thread Haggai Eran
On 20/02/2015 00:02, Somnath Kotur wrote:
> --- a/drivers/infiniband/core/uverbs_cmd.c
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -2089,15 +2089,16 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file 
> *file,
>   attr->alt_ah_attr.port_num  = cmd.alt_dest.port_num;
>  
>   if (qp->real_qp == qp) {
> - ret = ib_resolve_eth_l2_attrs(qp, attr, &cmd.attr_mask);
> + ret = ib_resolve_eth_dmac(qp, attr, &cmd.attr_mask);
>   if (ret)
> - goto out;
> + goto out_put;
>   ret = qp->device->modify_qp(qp, attr,
>   modify_qp_mask(qp->qp_type, cmd.attr_mask), &udata);
>   } else {
>   ret = ib_modify_qp(qp, attr, modify_qp_mask(qp->qp_type, 
> cmd.attr_mask));
>   }
>  
> +out_put:
>   put_qp_read(qp);

This seem to solve a leak of QP references when dmac resolution fails.
I'm not sure it belongs with the rest of the patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html