[PATCH for-next 2/2] iw_cxgb4: Adds support for T6 adapter

2015-09-23 Thread Hariprasad Shenai
Signed-off-by: Hariprasad Shenai 
---
 drivers/infiniband/hw/cxgb4/cm.c   | 317 -
 drivers/infiniband/hw/cxgb4/device.c   |  10 +-
 drivers/infiniband/hw/cxgb4/provider.c |   2 +-
 drivers/infiniband/hw/cxgb4/qp.c   |  16 +-
 drivers/infiniband/hw/cxgb4/t4.h   |   5 +-
 5 files changed, 204 insertions(+), 146 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 6c02211..c9cffce 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -632,22 +632,18 @@ static void best_mtu(const unsigned short *mtus, unsigned 
short mtu,
 
 static int send_connect(struct c4iw_ep *ep)
 {
-   struct cpl_act_open_req *req;
-   struct cpl_t5_act_open_req *t5_req;
-   struct cpl_act_open_req6 *req6;
-   struct cpl_t5_act_open_req6 *t5_req6;
+   struct cpl_act_open_req *req = NULL;
+   struct cpl_t5_act_open_req *t5req = NULL;
+   struct cpl_t6_act_open_req *t6req = NULL;
+   struct cpl_act_open_req6 *req6 = NULL;
+   struct cpl_t5_act_open_req6 *t5req6 = NULL;
+   struct cpl_t6_act_open_req6 *t6req6 = NULL;
struct sk_buff *skb;
u64 opt0;
u32 opt2;
unsigned int mtu_idx;
int wscale;
-   int wrlen;
-   int sizev4 = is_t4(ep->com.dev->rdev.lldi.adapter_type) ?
-   sizeof(struct cpl_act_open_req) :
-   sizeof(struct cpl_t5_act_open_req);
-   int sizev6 = is_t4(ep->com.dev->rdev.lldi.adapter_type) ?
-   sizeof(struct cpl_act_open_req6) :
-   sizeof(struct cpl_t5_act_open_req6);
+   int win, sizev4, sizev6, wrlen;
struct sockaddr_in *la = (struct sockaddr_in *)
 >com.mapped_local_addr;
struct sockaddr_in *ra = (struct sockaddr_in *)
@@ -656,8 +652,28 @@ static int send_connect(struct c4iw_ep *ep)
   >com.mapped_local_addr;
struct sockaddr_in6 *ra6 = (struct sockaddr_in6 *)
   >com.mapped_remote_addr;
-   int win;
int ret;
+   enum chip_type adapter_type = ep->com.dev->rdev.lldi.adapter_type;
+   u32 isn = (prandom_u32() & ~7UL) - 1;
+
+   switch (CHELSIO_CHIP_VERSION(adapter_type)) {
+   case CHELSIO_T4:
+   sizev4 = sizeof(struct cpl_act_open_req);
+   sizev6 = sizeof(struct cpl_act_open_req6);
+   break;
+   case CHELSIO_T5:
+   sizev4 = sizeof(struct cpl_t5_act_open_req);
+   sizev6 = sizeof(struct cpl_t5_act_open_req6);
+   break;
+   case CHELSIO_T6:
+   sizev4 = sizeof(struct cpl_t6_act_open_req);
+   sizev6 = sizeof(struct cpl_t6_act_open_req6);
+   break;
+   default:
+   pr_err("T%d Chip is not supported\n",
+  CHELSIO_CHIP_VERSION(adapter_type));
+   return -EINVAL;
+   }
 
wrlen = (ep->com.remote_addr.ss_family == AF_INET) ?
roundup(sizev4, 16) :
@@ -706,7 +722,10 @@ static int send_connect(struct c4iw_ep *ep)
opt2 |= SACK_EN_F;
if (wscale && enable_tcp_window_scaling)
opt2 |= WND_SCALE_EN_F;
-   if (is_t5(ep->com.dev->rdev.lldi.adapter_type)) {
+   if (CHELSIO_CHIP_VERSION(adapter_type) > CHELSIO_T4) {
+   if (peer2peer)
+   isn += 4;
+
opt2 |= T5_OPT_2_VALID_F;
opt2 |= CONG_CNTRL_V(CONG_ALG_TAHOE);
opt2 |= T5_ISS_F;
@@ -718,102 +737,109 @@ static int send_connect(struct c4iw_ep *ep)
 
t4_set_arp_err_handler(skb, ep, act_open_req_arp_failure);
 
-   if (is_t4(ep->com.dev->rdev.lldi.adapter_type)) {
-   if (ep->com.remote_addr.ss_family == AF_INET) {
-   req = (struct cpl_act_open_req *) skb_put(skb, wrlen);
+   if (ep->com.remote_addr.ss_family == AF_INET) {
+   switch (CHELSIO_CHIP_VERSION(adapter_type)) {
+   case CHELSIO_T4:
+   req = (struct cpl_act_open_req *)skb_put(skb, wrlen);
INIT_TP_WR(req, 0);
-   OPCODE_TID(req) = cpu_to_be32(
-   MK_OPCODE_TID(CPL_ACT_OPEN_REQ,
-   ((ep->rss_qid << 14) | ep->atid)));
-   req->local_port = la->sin_port;
-   req->peer_port = ra->sin_port;
-   req->local_ip = la->sin_addr.s_addr;
-   req->peer_ip = ra->sin_addr.s_addr;
-   req->opt0 = cpu_to_be64(opt0);
+   break;
+   case CHELSIO_T5:
+   t5req = (struct cpl_t5_act_open_req *)skb_put(skb,
+   wrlen);
+   

[PATCH for-next 0/2] RDMA/cxgb4: Add iWARP support for T6 adapter

2015-09-23 Thread Hariprasad Shenai
Hi,

PATCH 1/2 adds changes like new register, structure and functions in cxgb4
driver for iw_cxgb4 driver, and PATCH 2/2 adds iw_cxgb4 specific code to
support T6 adapter.

This patch series has been created against Doug's linux tree and includes
patches on cxgb4 and iw_cxgb4 driver.

We have included all the maintainers of respective drivers. Kindly review
the change and let us know in case of any review comments.

Thanks

Hariprasad Shenai (2):
  cxgb4: T6 adapter lld support for iw_cxgb4 driver
  iw_cxgb4: Adds support for T6 adapter

 drivers/infiniband/hw/cxgb4/cm.c  | 317 +-
 drivers/infiniband/hw/cxgb4/device.c  |  10 +-
 drivers/infiniband/hw/cxgb4/provider.c|   2 +-
 drivers/infiniband/hw/cxgb4/qp.c  |  16 +-
 drivers/infiniband/hw/cxgb4/t4.h  |   5 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h|  41 +--
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c   |  22 ++
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h|   2 +
 drivers/net/ethernet/chelsio/cxgb4/t4_chip_type.h |  85 ++
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h   |  48 
 10 files changed, 362 insertions(+), 186 deletions(-)
 create mode 100644 drivers/net/ethernet/chelsio/cxgb4/t4_chip_type.h

-- 
2.3.4

--
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


[PATCH for-next 1/2] cxgb4: T6 adapter lld support for iw_cxgb4 driver

2015-09-23 Thread Hariprasad Shenai
Signed-off-by: Hariprasad Shenai 
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h| 41 +--
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c   | 22 ++
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h|  2 +
 drivers/net/ethernet/chelsio/cxgb4/t4_chip_type.h | 85 +++
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h   | 48 +
 5 files changed, 158 insertions(+), 40 deletions(-)
 create mode 100644 drivers/net/ethernet/chelsio/cxgb4/t4_chip_type.h

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h 
b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index fa0c7b5..11045ec 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include "t4_chip_type.h"
 #include "cxgb4_uld.h"
 
 #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)
@@ -290,31 +291,6 @@ struct pci_params {
unsigned char width;
 };
 
-#define CHELSIO_CHIP_CODE(version, revision) (((version) << 4) | (revision))
-#define CHELSIO_CHIP_FPGA  0x100
-#define CHELSIO_CHIP_VERSION(code) (((code) >> 4) & 0xf)
-#define CHELSIO_CHIP_RELEASE(code) ((code) & 0xf)
-
-#define CHELSIO_T4 0x4
-#define CHELSIO_T5 0x5
-#define CHELSIO_T6 0x6
-
-enum chip_type {
-   T4_A1 = CHELSIO_CHIP_CODE(CHELSIO_T4, 1),
-   T4_A2 = CHELSIO_CHIP_CODE(CHELSIO_T4, 2),
-   T4_FIRST_REV= T4_A1,
-   T4_LAST_REV = T4_A2,
-
-   T5_A0 = CHELSIO_CHIP_CODE(CHELSIO_T5, 0),
-   T5_A1 = CHELSIO_CHIP_CODE(CHELSIO_T5, 1),
-   T5_FIRST_REV= T5_A0,
-   T5_LAST_REV = T5_A1,
-
-   T6_A0 = CHELSIO_CHIP_CODE(CHELSIO_T6, 0),
-   T6_FIRST_REV= T6_A0,
-   T6_LAST_REV = T6_A0,
-};
-
 struct devlog_params {
u32 memtype;/* which memory (EDC0, EDC1, MC) */
u32 start;  /* start of log in firmware memory */
@@ -905,21 +881,6 @@ static inline int is_offload(const struct adapter *adap)
return adap->params.offload;
 }
 
-static inline int is_t6(enum chip_type chip)
-{
-   return CHELSIO_CHIP_VERSION(chip) == CHELSIO_T6;
-}
-
-static inline int is_t5(enum chip_type chip)
-{
-   return CHELSIO_CHIP_VERSION(chip) == CHELSIO_T5;
-}
-
-static inline int is_t4(enum chip_type chip)
-{
-   return CHELSIO_CHIP_VERSION(chip) == CHELSIO_T4;
-}
-
 static inline u32 t4_read_reg(struct adapter *adap, u32 reg_addr)
 {
return readl(adap->regs + reg_addr);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c 
b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index f5dcde2..aeeb21f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -1936,6 +1936,28 @@ unsigned int cxgb4_best_aligned_mtu(const unsigned short 
*mtus,
 EXPORT_SYMBOL(cxgb4_best_aligned_mtu);
 
 /**
+ * cxgb4_tp_smt_idx - Get the Source Mac Table index for this VI
+ * @chip: chip type
+ * @viid: VI id of the given port
+ *
+ * Return the SMT index for this VI.
+ */
+unsigned int cxgb4_tp_smt_idx(enum chip_type chip, unsigned int viid)
+{
+   /* In T4/T5, SMT contains 256 SMAC entries organized in
+* 128 rows of 2 entries each.
+* In T6, SMT contains 256 SMAC entries in 256 rows.
+* TODO: The below code needs to be updated when we add support
+* for 256 VFs.
+*/
+   if (CHELSIO_CHIP_VERSION(chip) <= CHELSIO_T5)
+   return ((viid & 0x7f) << 1);
+   else
+   return (viid & 0x7f);
+}
+EXPORT_SYMBOL(cxgb4_tp_smt_idx);
+
+/**
  * cxgb4_port_chan - get the HW channel of a port
  * @dev: the net device for the port
  *
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h 
b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
index c3a8be5..cf711d5 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include "cxgb4.h"
 
 /* CPL message priority levels */
 enum {
@@ -290,6 +291,7 @@ int cxgb4_ofld_send(struct net_device *dev, struct sk_buff 
*skb);
 unsigned int cxgb4_dbfifo_count(const struct net_device *dev, int lpfifo);
 unsigned int cxgb4_port_chan(const struct net_device *dev);
 unsigned int cxgb4_port_viid(const struct net_device *dev);
+unsigned int cxgb4_tp_smt_idx(enum chip_type chip, unsigned int viid);
 unsigned int cxgb4_port_idx(const struct net_device *dev);
 unsigned int cxgb4_best_mtu(const unsigned short *mtus, unsigned short mtu,
unsigned int *idx);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_chip_type.h 
b/drivers/net/ethernet/chelsio/cxgb4/t4_chip_type.h
new file mode 100644
index 000..54b7181
--- /dev/null
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_chip_type.h
@@ -0,0 +1,85 @@
+/*
+ * This file is part of the Chelsio T4 Ethernet driver 

Re: [v1 0/2] Checksum offload capability report

2015-09-23 Thread Doug Ledford
On 09/22/2015 04:18 PM, wbd2...@gmail.com wrote:
> From: Bodong Wang 
> 
> This series adds kernel support for checksum offload cap report. The first 
> patch
> adds reporting for RAW and RC QPs. Patch 2 sets the capability according to
> hardware.
> 
> Changes from v1:
>   * The cap is reported through existing device_cap_flags. Only new enum 
> members
> are added rather than to use an extra structure. IB_DEVICE_UD_IP_CSUM is
> already defined there.
>   * Note: although there is no link layer info indicated here, normally UD and
> RC QPs are only available through IB, RAW QP is only available over
> Ethernet.
> 
> Bodong Wang (2):
>   IB/core: Add support of checksum capability reporting for RC and RAW
>   IB/mlx4: Report checksum offload cap for RAW QP when query device
> 
>  drivers/infiniband/hw/mlx4/main.c | 2 ++
>  include/rdma/ib_verbs.h   | 3 ++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 

Thanks.  I'm happy with this.  Picked up for next.

-- 
Doug Ledford 
  GPG KeyID: 0E572FDD




signature.asc
Description: OpenPGP digital signature


RE: message size, was Re: merge struct ib_device_attr into struct ib_device

2015-09-23 Thread Steve Wise


> -Original Message-
> From: David Miller [mailto:da...@davemloft.net]
> Sent: Tuesday, September 22, 2015 6:08 PM
> 
> > How do we change the message size limits?  Reviewing w/o it being
> > inline is painful for the (many) reviewers...
> 
> I've increased it.

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


Re: [v1] libibverbs: Add support for checksum offload

2015-09-23 Thread Doug Ledford
On 09/22/2015 04:20 PM, wbd2...@gmail.com wrote:
> From: Bodong Wang 
> 
> Changes from v1:
>  * Use the CSUM caps from device_cap_flags rather than defining new fileds
> 
> Bodong Wang (1):
>   libibverbs: Report checksum offload capabilities
> 
>  include/infiniband/verbs.h | 14 --
>  man/ibv_poll_cq.3  |  5 +
>  man/ibv_post_send.3|  4 
>  3 files changed, 21 insertions(+), 2 deletions(-)
> 

Thanks, applied.

-- 
Doug Ledford 
  GPG KeyID: 0E572FDD




signature.asc
Description: OpenPGP digital signature


libibverbs-1.2.0-rc1 release

2015-09-23 Thread Doug Ledford
I have done a pre-release of the upcoming libibverbs-1.2.0 release.  The
code has been pushed to the official git repo and also an -rc1 tarball
uploaded to the https://ww.openfabrics.org/downloads/verbs download
area.  From the tag message:

tag libibverbs-1.2.0-rc1
Tagger: Doug Ledford 
Date:   Wed Sep 23 12:47:04 2015 -0400

Ininitial roundup of 1.2.0 release items

- Add support for RoCE
- Add support for On Demand Paging
- No longer assume that no driver for a verbs device should be considered
  an error condition (usnic devices in particular are moving to libfabric
  drivers only, so we will emit a useless warning/error in the presence
  of usnic enabled machines)
- Harden some of the argument processing in example programs
- Add support for s390x
- Fix the broken create/destroy flow API
- First release under new management (hence the decision to update to
  version 1.2.0 instead of 1.1.9)

In particular, as this release fixes the create/destroy flow API, there
is a need for an updated libmlx4 sources in order to compile against the
fixed API (binary compatibility was maintained, but source compatibility
was not, so you will need the new libmlx4 to compile against the new
libibverbs).  Yishai, please post an updated libmlx4 head of repo and
preferably also a source tarball for libmlx4 when it's ready.
Preferably it would include an embedded check for the proper flow API in
your configure scripts.

-- 
Doug Ledford 
  GPG KeyID: 0E572FDD




signature.asc
Description: OpenPGP digital signature


[PATCH] IB: merge struct ib_device_attr into struct ib_device

2015-09-23 Thread Christoph Hellwig
Avoid the need to query for device attributes and store them in a
separate structure by merging struct ib_device_attr into struct
ib_device.  This matches how the device structures are used in most
Linux subsystems.

Signed-off-by: Christoph Hellwig 
---
 drivers/infiniband/core/cm.c   |  12 +-
 drivers/infiniband/core/cma.c  |   8 -
 drivers/infiniband/core/device.c   |  20 ---
 drivers/infiniband/core/fmr_pool.c |  20 +--
 drivers/infiniband/core/sysfs.c|  14 +-
 drivers/infiniband/core/uverbs_cmd.c   | 128 +++-
 drivers/infiniband/core/verbs.c|   8 +-
 drivers/infiniband/hw/cxgb3/iwch_provider.c|  60 +++-
 drivers/infiniband/hw/cxgb4/provider.c |  64 +++-
 drivers/infiniband/hw/mlx4/main.c  | 167 -
 drivers/infiniband/hw/mlx5/main.c  | 116 ++
 drivers/infiniband/hw/mthca/mthca_provider.c   |  77 +-
 drivers/infiniband/hw/nes/nes_verbs.c  |  94 +---
 drivers/infiniband/hw/ocrdma/ocrdma_main.c |  40 -
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c|  49 --
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.h|   2 -
 drivers/infiniband/hw/qib/qib_verbs.c  |  86 +--
 drivers/infiniband/hw/usnic/usnic_ib_main.c|   3 +-
 drivers/infiniband/hw/usnic/usnic_ib_verbs.c   |  50 ++
 drivers/infiniband/hw/usnic/usnic_ib_verbs.h   |   4 +-
 drivers/infiniband/ulp/ipoib/ipoib_cm.c|  19 +--
 drivers/infiniband/ulp/ipoib/ipoib_ethtool.c   |  14 +-
 drivers/infiniband/ulp/ipoib/ipoib_main.c  |  21 +--
 drivers/infiniband/ulp/iser/iscsi_iser.c   |   4 +-
 drivers/infiniband/ulp/iser/iscsi_iser.h   |   2 -
 drivers/infiniband/ulp/iser/iser_memory.c  |   9 +-
 drivers/infiniband/ulp/iser/iser_verbs.c   |  38 ++---
 drivers/infiniband/ulp/isert/ib_isert.c|  43 ++
 drivers/infiniband/ulp/isert/ib_isert.h|   1 -
 drivers/infiniband/ulp/srp/ib_srp.c|  32 ++--
 drivers/infiniband/ulp/srpt/ib_srpt.c  |  15 +-
 drivers/infiniband/ulp/srpt/ib_srpt.h  |   3 -
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c|  21 +--
 drivers/staging/rdma/amso1100/c2.h |   3 -
 drivers/staging/rdma/amso1100/c2_pd.c  |   6 +-
 drivers/staging/rdma/amso1100/c2_provider.c|  23 +--
 drivers/staging/rdma/amso1100/c2_rnic.c|  63 +++-
 drivers/staging/rdma/ehca/ehca_hca.c   |  78 +-
 drivers/staging/rdma/ehca/ehca_iverbs.h|   3 +-
 drivers/staging/rdma/ehca/ehca_main.c  |   3 +-
 drivers/staging/rdma/hfi1/verbs.c  |  89 +--
 drivers/staging/rdma/ipath/ipath_verbs.c   |  90 +--
 include/rdma/ib_verbs.h|  98 ++--
 net/rds/ib.c   |  28 +---
 net/rds/iw.c   |  23 +--
 net/sunrpc/xprtrdma/frwr_ops.c |   7 +-
 net/sunrpc/xprtrdma/svc_rdma_transport.c   |  48 +++---
 net/sunrpc/xprtrdma/verbs.c|  23 +--
 net/sunrpc/xprtrdma/xprt_rdma.h|   1 -
 49 files changed, 723 insertions(+), 1107 deletions(-)

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index ea4db9c..56c7a70 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3749,16 +3749,6 @@ int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
 }
 EXPORT_SYMBOL(ib_cm_init_qp_attr);
 
-static void cm_get_ack_delay(struct cm_device *cm_dev)
-{
-   struct ib_device_attr attr;
-
-   if (ib_query_device(cm_dev->ib_device, ))
-   cm_dev->ack_delay = 0; /* acks will rely on packet life time */
-   else
-   cm_dev->ack_delay = attr.local_ca_ack_delay;
-}
-
 static ssize_t cm_show_counter(struct kobject *obj, struct attribute *attr,
   char *buf)
 {
@@ -3870,7 +3860,7 @@ static void cm_add_one(struct ib_device *ib_device)
return;
 
cm_dev->ib_device = ib_device;
-   cm_get_ack_delay(cm_dev);
+   cm_dev->ack_delay = ib_device->local_ca_ack_delay;
cm_dev->going_down = 0;
cm_dev->device = device_create(_class, _device->dev,
   MKDEV(0, 0), NULL,
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index b1ab13f..077c4e2 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1847,7 +1847,6 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id,
struct rdma_id_private *listen_id, *conn_id;
struct rdma_cm_event event;
int ret;
-   struct ib_device_attr attr;
struct sockaddr *laddr = (struct 

Re: [v1 0/2] libmlx4: Add support for checksum offload

2015-09-23 Thread Doug Ledford
On 09/22/2015 04:22 PM, wbd2...@gmail.com wrote:
> From: Bodong Wang 
> 
> Changes from v1:
>  * Update patches to use the device_cap_flags to get the checksum offload caps
>
> Bodong Wang (2):
>   libmlx4: Update ibv_create_flow/ibv_destroy_flow according to change
> of libibverbs
>   libmlx4: Add support for TX/RX checksum offload
> 
>  src/cq.c|  6 ++
>  src/mlx4.c  |  4 ++--
>  src/mlx4.h  | 19 ++-
>  src/qp.c| 19 +++
>  src/verbs.c | 24 
>  src/wqe.h   |  8 +---
>  6 files changed, 74 insertions(+), 6 deletions(-)
> 

For the series:

Reviewed-by: Doug Ledford 

-- 
Doug Ledford 
  GPG KeyID: 0E572FDD




signature.asc
Description: OpenPGP digital signature


Re: [PATCH] IB: merge struct ib_device_attr into struct ib_device

2015-09-23 Thread Chuck Lever
Hey Christoph-


> On Sep 23, 2015, at 8:52 AM, Christoph Hellwig  wrote:
> 
> Avoid the need to query for device attributes and store them in a
> separate structure by merging struct ib_device_attr into struct
> ib_device.  This matches how the device structures are used in most
> Linux subsystems.

Getting rid of ib_query_device() makes sense. Moving the device
attributes into ib_device is nice. Getting rid of ib_device_attr
is of questionable value. Why do we need to go there?

IB core API changes generate merge conflicts with feature work
in the ULPs. It’s a pain for maintainers. In this particular
case, keeping ib_device_attr would greatly reduce ULP churn.


> Signed-off-by: Christoph Hellwig 
> ---
> drivers/infiniband/core/cm.c   |  12 +-
> drivers/infiniband/core/cma.c  |   8 -
> drivers/infiniband/core/device.c   |  20 ---
> drivers/infiniband/core/fmr_pool.c |  20 +--
> drivers/infiniband/core/sysfs.c|  14 +-
> drivers/infiniband/core/uverbs_cmd.c   | 128 +++-
> drivers/infiniband/core/verbs.c|   8 +-
> drivers/infiniband/hw/cxgb3/iwch_provider.c|  60 +++-
> drivers/infiniband/hw/cxgb4/provider.c |  64 +++-
> drivers/infiniband/hw/mlx4/main.c  | 167 -
> drivers/infiniband/hw/mlx5/main.c  | 116 ++
> drivers/infiniband/hw/mthca/mthca_provider.c   |  77 +-
> drivers/infiniband/hw/nes/nes_verbs.c  |  94 +---
> drivers/infiniband/hw/ocrdma/ocrdma_main.c |  40 -
> drivers/infiniband/hw/ocrdma/ocrdma_verbs.c|  49 --
> drivers/infiniband/hw/ocrdma/ocrdma_verbs.h|   2 -
> drivers/infiniband/hw/qib/qib_verbs.c  |  86 +--
> drivers/infiniband/hw/usnic/usnic_ib_main.c|   3 +-
> drivers/infiniband/hw/usnic/usnic_ib_verbs.c   |  50 ++
> drivers/infiniband/hw/usnic/usnic_ib_verbs.h   |   4 +-
> drivers/infiniband/ulp/ipoib/ipoib_cm.c|  19 +--
> drivers/infiniband/ulp/ipoib/ipoib_ethtool.c   |  14 +-
> drivers/infiniband/ulp/ipoib/ipoib_main.c  |  21 +--
> drivers/infiniband/ulp/iser/iscsi_iser.c   |   4 +-
> drivers/infiniband/ulp/iser/iscsi_iser.h   |   2 -
> drivers/infiniband/ulp/iser/iser_memory.c  |   9 +-
> drivers/infiniband/ulp/iser/iser_verbs.c   |  38 ++---
> drivers/infiniband/ulp/isert/ib_isert.c|  43 ++
> drivers/infiniband/ulp/isert/ib_isert.h|   1 -
> drivers/infiniband/ulp/srp/ib_srp.c|  32 ++--
> drivers/infiniband/ulp/srpt/ib_srpt.c  |  15 +-
> drivers/infiniband/ulp/srpt/ib_srpt.h  |   3 -
> .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c|  21 +--
> drivers/staging/rdma/amso1100/c2.h |   3 -
> drivers/staging/rdma/amso1100/c2_pd.c  |   6 +-
> drivers/staging/rdma/amso1100/c2_provider.c|  23 +--
> drivers/staging/rdma/amso1100/c2_rnic.c|  63 +++-
> drivers/staging/rdma/ehca/ehca_hca.c   |  78 +-
> drivers/staging/rdma/ehca/ehca_iverbs.h|   3 +-
> drivers/staging/rdma/ehca/ehca_main.c  |   3 +-
> drivers/staging/rdma/hfi1/verbs.c  |  89 +--
> drivers/staging/rdma/ipath/ipath_verbs.c   |  90 +--
> include/rdma/ib_verbs.h|  98 ++--
> net/rds/ib.c   |  28 +---
> net/rds/iw.c   |  23 +--
> net/sunrpc/xprtrdma/frwr_ops.c |   7 +-
> net/sunrpc/xprtrdma/svc_rdma_transport.c   |  48 +++---
> net/sunrpc/xprtrdma/verbs.c|  23 +--
> net/sunrpc/xprtrdma/xprt_rdma.h|   1 -
> 49 files changed, 723 insertions(+), 1107 deletions(-)
> 
> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
> index ea4db9c..56c7a70 100644
> --- a/drivers/infiniband/core/cm.c
> +++ b/drivers/infiniband/core/cm.c
> @@ -3749,16 +3749,6 @@ int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
> }
> EXPORT_SYMBOL(ib_cm_init_qp_attr);
> 
> -static void cm_get_ack_delay(struct cm_device *cm_dev)
> -{
> - struct ib_device_attr attr;
> -
> - if (ib_query_device(cm_dev->ib_device, ))
> - cm_dev->ack_delay = 0; /* acks will rely on packet life time */
> - else
> - cm_dev->ack_delay = attr.local_ca_ack_delay;
> -}
> -
> static ssize_t cm_show_counter(struct kobject *obj, struct attribute *attr,
>  char *buf)
> {
> @@ -3870,7 +3860,7 @@ static void cm_add_one(struct ib_device *ib_device)
>   return;
> 
>   cm_dev->ib_device = ib_device;
> - cm_get_ack_delay(cm_dev);
> + cm_dev->ack_delay = ib_device->local_ca_ack_delay;
>   cm_dev->going_down = 0;
>  

Re: [PATCH] IB: merge struct ib_device_attr into struct ib_device

2015-09-23 Thread Christoph Hellwig
On Wed, Sep 23, 2015 at 10:23:15AM -0700, Chuck Lever wrote:
> Getting rid of ib_query_device() makes sense. Moving the device
> attributes into ib_device is nice. Getting rid of ib_device_attr
> is of questionable value. Why do we need to go there?
> 
> IB core API changes generate merge conflicts with feature work
> in the ULPs. It’s a pain for maintainers. In this particular
> case, keeping ib_device_attr would greatly reduce ULP churn.

But it will keep a totally nonsenical structure around in the future.

Note that the whole in-kernel Verbs API is a bit of a nightmare, so
there will be all kinds of larger changes.  Better get it right as long
as we have as few ULPs as we have now.
--
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: message size, was Re: merge struct ib_device_attr into struct ib_device

2015-09-23 Thread Yann Droneaud
Hi,

Le mardi 22 septembre 2015 à 23:55 +0200, 'Christoph Hellwig' a écrit :
> On Tue, Sep 22, 2015 at 04:06:17PM -0500, Steve Wise wrote:
> > Can you create a series of smaller patches that will fit on the
> > list?
> > That would make it easier for everyone to review/comment. 
> 
> I don't see how that is possible, as it's a flag day change.
> 

Perhaps you could change ib_query_device() to use the ib_device_attr
from struct ib_device so that ulp doesn't have to be modified at the
same time the drivers. Then further patches can update the users of
ib_query_device(), one at a time. And the last patch would remove
ib_query_device().

Regards.

-- 
Yann Droneaud

--
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


[PATCH] mlx4: vmalloc for mlx4_ib_wq.wrid and mlx4_ib_srq.wrid

2015-09-23 Thread Wengang Wang
Use __vmalloc to allocate memory for mlx4_ib_wq.wrid and mlx4_ib_srq.wrid.

Several hits that the kmalloc for wrid failed with the following like
call back stack:

kworker/u:4: page allocation failure: order:4, mode:0x2000d0
Pid: 16388, comm: kworker/u:4 Not tainted
Call Trace:
 [] warn_alloc_failed+0xf3/0x160
 [] ? __alloc_pages_direct_compact+0x1fa/0x200
 [] __alloc_pages_slowpath+0x4a6/0x7b0
 [] __alloc_pages_nodemask+0x2fb/0x320
 [] kmem_getpages+0x67/0x1c0
 [] fallback_alloc+0x187/0x250
 [] cache_alloc_node+0x9a/0x150
 [] __kmalloc+0x18b/0x340
 [] ? create_qp_common+0x431/0x8e0 [mlx4_ib]
 [] create_qp_common+0x431/0x8e0 [mlx4_ib]
 [] ? kzalloc.clone.1+0xe/0x10 [mlx4_ib]
 [] mlx4_ib_create_qp+0x207/0x310 [mlx4_ib]
 [] ib_create_qp+0x41/0x1c0 [ib_core]
 [] ipoib_cm_create_tx_qp+0xc8/0x130 [ib_ipoib]
 [] ? __vmalloc_node+0x35/0x40
 [] ipoib_cm_tx_init+0x65/0x380 [ib_ipoib]
 [] ? sched_clock_cpu+0xcd/0x110
 [] ? xen_mc_flush+0xb0/0x1b0
 [] ipoib_cm_tx_start+0x230/0x3d0 [ib_ipoib]
 [] process_one_work+0x180/0x420
 [] worker_thread+0x12e/0x390
 [] ? manage_workers+0x180/0x180
 [] kthread+0xce/0xe0
 [] ? xen_end_context_switch+0x1e/0x30
 [] ? kthread_freezable_should_stop+0x70/0x70
 [] ret_from_fork+0x7c/0xb0
 [] ? kthread_freezable_should_stop+0x70/0x70

It needs 16 contigous pages and failed. At the time there actually is
100MB+ free memory:

Node 0 Normal: 10268*4kB (UM) 7443*8kB (UEM) 1647*16kB (UM) 35*32kB (UR)
1*64kB (R) 4*128kB (R) 1*256kB (R) 0*512kB 1*1024kB (R) 0*2048kB 0*4096kB =
129944kB

I also hit same errors order 3.

Signed-off-by: Wengang Wang 
---
 drivers/infiniband/hw/mlx4/qp.c  | 15 +--
 drivers/infiniband/hw/mlx4/srq.c |  6 --
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 4ad9be3..754ceb9 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -786,8 +787,10 @@ static int create_qp_common(struct mlx4_ib_dev *dev, 
struct ib_pd *pd,
if (err)
goto err_mtt;
 
-   qp->sq.wrid  = kmalloc(qp->sq.wqe_cnt * sizeof (u64), gfp);
-   qp->rq.wrid  = kmalloc(qp->rq.wqe_cnt * sizeof (u64), gfp);
+   qp->sq.wrid  = __vmalloc(qp->sq.wqe_cnt * sizeof(u64), gfp,
+PAGE_KERNEL);
+   qp->rq.wrid  = __vmalloc(qp->rq.wqe_cnt * sizeof(u64), gfp,
+PAGE_KERNEL);
if (!qp->sq.wrid || !qp->rq.wrid) {
err = -ENOMEM;
goto err_wrid;
@@ -874,8 +877,8 @@ err_wrid:
if (qp_has_rq(init_attr))

mlx4_ib_db_unmap_user(to_mucontext(pd->uobject->context), >db);
} else {
-   kfree(qp->sq.wrid);
-   kfree(qp->rq.wrid);
+   vfree(qp->sq.wrid);
+   vfree(qp->rq.wrid);
}
 
 err_mtt:
@@ -1050,8 +1053,8 @@ static void destroy_qp_common(struct mlx4_ib_dev *dev, 
struct mlx4_ib_qp *qp,
  >db);
ib_umem_release(qp->umem);
} else {
-   kfree(qp->sq.wrid);
-   kfree(qp->rq.wrid);
+   vfree(qp->sq.wrid);
+   vfree(qp->rq.wrid);
if (qp->mlx4_ib_qp_type & (MLX4_IB_QPT_PROXY_SMI_OWNER |
MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI))
free_proxy_bufs(>ib_dev, qp);
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
index dce5dfe..6d21bb2 100644
--- a/drivers/infiniband/hw/mlx4/srq.c
+++ b/drivers/infiniband/hw/mlx4/srq.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "mlx4_ib.h"
 #include "user.h"
@@ -170,7 +171,8 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
if (err)
goto err_mtt;
 
-   srq->wrid = kmalloc(srq->msrq.max * sizeof (u64), GFP_KERNEL);
+   srq->wrid = __vmalloc(srq->msrq.max * sizeof(u64), GFP_KERNEL,
+ PAGE_KERNEL);
if (!srq->wrid) {
err = -ENOMEM;
goto err_mtt;
@@ -204,7 +206,7 @@ err_wrid:
if (pd->uobject)
mlx4_ib_db_unmap_user(to_mucontext(pd->uobject->context), 
>db);
else
-   kfree(srq->wrid);
+   vfree(srq->wrid);
 
 err_mtt:
mlx4_mtt_cleanup(dev->dev, >mtt);
-- 
2.1.0

--
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] mlx4: vmalloc for mlx4_ib_wq.wrid and mlx4_ib_srq.wrid

2015-09-23 Thread Or Gerlitz

On 9/24/2015 5:10 AM, Wengang Wang wrote:

Use __vmalloc to allocate memory for mlx4_ib_wq.wrid and mlx4_ib_srq.wrid.

Several hits that the kmalloc for wrid failed with the following like
call back stack:


Using vmalloc and friends should be done with care, specifically, we'd like
to go there only when needed (namely when kmalloc fails), else we can 
get into

another set of troubles.

Please use the practice introduced in commit 89dd86d "mlx4_core: Allow 
large mlx4_buddy bitmaps"
to go the vmalloc way only when needed, note you can just call kvfree 
later, no need to branch
when freeing things (as was fixed later in commit 914efb0 "mlx4: don't 
duplicate kvfree()")


And have the patch title to be

IB/mlx4: Use vmalloc  for WR buffers when needed

I don't think the OOM oops in the change log helps, skip it.

Or.

--
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] IB: merge struct ib_device_attr into struct ib_device

2015-09-23 Thread Or Gerlitz

On 9/23/2015 9:41 PM, Christoph Hellwig wrote:

On Wed, Sep 23, 2015 at 10:23:15AM -0700, Chuck Lever wrote:

Getting rid of ib_query_device() makes sense. Moving the device
attributes into ib_device is nice. Getting rid of ib_device_attr
is of questionable value. Why do we need to go there?

IB core API changes generate merge conflicts with feature work
in the ULPs. It’s a pain for maintainers. In this particular
case, keeping ib_device_attr would greatly reduce ULP churn.

But it will keep a totally nonsenical structure around in the future.

Note that the whole in-kernel Verbs API is a bit of a nightmare, so
there will be all kinds of larger changes.  Better get it right as long
as we have as few ULPs as we have now.



Christoph,

We had a smaller volume move to cache the device attributes on the IB 
device structure, and I just
realized it was dropped on the floor. Ira, that was a reviewer comment 
you got when worked on OPA
and I missed the fact it didn't reach to acceptance 
http://marc.info/?t=14230931066=1=2

I vote for 1st and most doing this and taking things from there.

Or.
--
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