[ewg] [PATCH] IB/ipath - fix for bugs 951 and 874

Tziporet Koren tziporet at dev.mellanox.co.il
Sun Feb 24 03:57:11 PST 2008


approved
Tziporet

Ralph Campbell wrote:
> Vlad, you can pull the following two patches from
> git://git.openfabrics.org/~ralphc/linux-2.6/.git
>
>
>   
> ------------------------------------------------------------------------
>
> commit 2fe8a2701da5cd024eeb47d8096ab8cf5e8878f3
> Author: Ralph Campbell (QLogic) <ralphc at hosting.openfabrics.org>
> Date:   Thu Feb 21 17:48:51 2008 -0800
>
>     IB/ipath - reset retry counter if a good response is seen
>     
>     An RDMA read response is also a valid ACK up to that point so it should
>     reset the retry counter.  This fixes bug 874.
>     
>     Signed-off-by: Ralph Campbell <ralph.campbell at qlogic.com>
>
> diff --git a/kernel_patches/fixes/ipath_0430_dapl_rdma_read.patch b/kernel_patches/fixes/ipath_0430_dapl_rdma_read.patch
> new file mode 100644
> index 0000000..3605d14
> --- /dev/null
> +++ b/kernel_patches/fixes/ipath_0430_dapl_rdma_read.patch
> @@ -0,0 +1,21 @@
> +IB/ipath - reset retry counter if a good response is seen
> +
> +An RDMA read response is also a valid ACK up to that point so it should
> +reset the retry counter.  This fixes bug 874.
> +
> +Signed-off-by: Ralph Campbell <ralph.campbell at qlogic.com>
> +
> +diff -up a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c
> +--- a/drivers/infiniband/hw/ipath/ipath_rc.c	2008-02-21 17:28:20.000000000 -0800
> ++++ b/drivers/infiniband/hw/ipath/ipath_rc.c	2008-02-21 17:32:15.000000000 -0800
> +@@ -1226,6 +1226,10 @@ static inline void ipath_rc_rcv_resp(str
> + 			list_move_tail(&qp->timerwait,
> + 				       &dev->pending[dev->pending_index]);
> + 		spin_unlock(&dev->pending_lock);
> ++
> ++		if (opcode == OP(RDMA_READ_RESPONSE_MIDDLE))
> ++			qp->s_retry = qp->s_retry_cnt;
> ++
> + 		/*
> + 		 * Update the RDMA receive state but do the copy w/o
> + 		 * holding the locks and blocking interrupts.
>   
> ------------------------------------------------------------------------
>
> commit 6780c7436219055063dd7942a1bb4426116b57b4
> Author: Ralph Campbell (QLogic) <ralphc at hosting.openfabrics.org>
> Date:   Thu Feb 21 17:24:35 2008 -0800
>
>     IB/ipath - fix 4k MTU with IPoIB
>     
>     This patch fixes a problem with using 4K MTUs on the QLE7140 QLogic HCA.
>     The fix is to make sure a 4K send buffer is used.
>     This fixes bug 951.
>     
>     Signed-off-by: Ralph Campbell <ralph.campbell at qlogic.com>
>
> diff --git a/kernel_patches/fixes/ipath_0420_ipoib_4k_mtu.patch b/kernel_patches/fixes/ipath_0420_ipoib_4k_mtu.patch
> new file mode 100644
> index 0000000..dd5496c
> --- /dev/null
> +++ b/kernel_patches/fixes/ipath_0420_ipoib_4k_mtu.patch
> @@ -0,0 +1,193 @@
> +IB/ipath - fix 4k MTU with IPoIB
> +
> +This patch fixes a problem with using 4K MTUs on the QLE7140 QLogic HCA.
> +The fix is to make sure a 4K send buffer is used.
> +
> +Signed-off-by: Ralph Campbell <ralph.campbell at qlogic.com>
> +
> +diff -up a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
> +--- a/drivers/infiniband/hw/ipath/ipath_diag.c	2008-02-21 10:17:02.000000000 -0800
> ++++ b/drivers/infiniband/hw/ipath/ipath_diag.c	2008-02-21 14:36:28.000000000 -0800
> +@@ -444,7 +444,9 @@ static ssize_t ipath_diagpkt_write(struc
> + 		goto bail;
> + 	}
> + 
> +-	piobuf = ipath_getpiobuf(dd, &pbufn);
> ++	plen >>= 2;		/* in dwords */
> ++
> ++	piobuf = ipath_getpiobuf(dd, plen, &pbufn);
> + 	if (!piobuf) {
> + 		ipath_cdbg(VERBOSE, "No PIO buffers avail unit for %u\n",
> + 			   dd->ipath_unit);
> +@@ -454,9 +456,6 @@ static ssize_t ipath_diagpkt_write(struc
> + 	/* disarm it just to be extra sure */
> + 	ipath_disarm_piobufs(dd, pbufn, 1);
> + 
> +-
> +-	plen >>= 2;		/* in dwords */
> +-
> + 	if (ipath_debug & __IPATH_PKTDBG)
> + 		ipath_cdbg(VERBOSE, "unit %u 0x%x+1w pio%d\n",
> + 			   dd->ipath_unit, plen - 1, pbufn);
> +diff -up a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
> +--- a/drivers/infiniband/hw/ipath/ipath_driver.c	2008-02-21 10:17:02.000000000 -0800
> ++++ b/drivers/infiniband/hw/ipath/ipath_driver.c	2008-02-21 14:48:02.000000000 -0800
> +@@ -340,7 +340,7 @@ static void ipath_verify_pioperf(struct 
> + 	u32 *addr;
> + 	u64 msecs, emsecs;
> + 
> +-	piobuf = ipath_getpiobuf(dd, &pbnum);
> ++	piobuf = ipath_getpiobuf(dd, 0, &pbnum);
> + 	if (!piobuf) {
> + 		dev_info(&dd->pcidev->dev,
> + 			"No PIObufs for checking perf, skipping\n");
> +@@ -1620,24 +1620,35 @@ rescan:
> + /**
> +  * ipath_getpiobuf - find an available pio buffer
> +  * @dd: the infinipath device
> ++ * @plen: the size of the PIO buffer needed in 32-bit words
> +  * @pbufnum: the buffer number is placed here
> +  * Searches the allocated driver range.
> +  */
> +-u32 __iomem *ipath_getpiobuf(struct ipath_devdata *dd, u32 *pbufnum)
> ++u32 __iomem *ipath_getpiobuf(struct ipath_devdata *dd, u32 plen, u32 *pbufnum)
> + {
> + 	u32 __iomem *buf;
> + 	u32 pnum, nbufs;
> ++	u32 first, lasti;
> + 
> ++	if (plen + 1 >= IPATH_SMALLBUF_DWORDS) {
> ++		first = dd->ipath_piobcnt2k;
> ++		lasti = dd->ipath_lastpioindexl;
> ++	} else {
> ++		first = 0;
> ++		lasti = dd->ipath_lastpioindex;
> ++	}
> + 	nbufs = dd->ipath_piobcnt2k + dd->ipath_piobcnt4k;
> +-	buf = ipath_getpiobuf_range(dd, &pnum, 0, nbufs,
> +-				    dd->ipath_lastpioindex);
> ++	buf = ipath_getpiobuf_range(dd, &pnum, first, nbufs, lasti);
> + 
> + 	if (buf) {
> + 		/*
> + 		 * Set next starting place.  It's just an optimization,
> + 		 * it doesn't matter who wins on this, so no locking
> + 		 */
> +-		dd->ipath_lastpioindex = pnum + 1;
> ++		if (plen >= IPATH_SMALLBUF_DWORDS)
> ++			dd->ipath_lastpioindexl = pnum + 1;
> ++		else
> ++			dd->ipath_lastpioindex = pnum + 1;
> + 		if (dd->ipath_upd_pio_shadow)
> + 			dd->ipath_upd_pio_shadow = 0;
> + 		if (dd->ipath_consec_nopiobuf)
> +diff -up a/drivers/infiniband/hw/ipath/ipath_iba6120.c b/drivers/infiniband/hw/ipath/ipath_iba6120.c
> +--- a/drivers/infiniband/hw/ipath/ipath_iba6120.c	2008-02-21 10:17:02.000000000 -0800
> ++++ b/drivers/infiniband/hw/ipath/ipath_iba6120.c	2008-02-21 14:53:06.000000000 -0800
> +@@ -1497,17 +1497,13 @@ static int ipath_pe_early_init(struct ip
> + 	dd->ipath_egrtidbase = (u64 __iomem *)
> + 		((char __iomem *) dd->ipath_kregbase + dd->ipath_rcvegrbase);
> + 
> +-	/*
> +-	 * To truly support a 4KB MTU (for usermode), we need to
> +-	 * bump this to a larger value.  For now, we use them for
> +-	 * the kernel only.
> +-	 */
> +-	dd->ipath_rcvegrbufsize = 2048;
> ++	dd->ipath_rcvegrbufsize = ipath_mtu4096 ? 4096 : 2048;
> + 	/*
> + 	 * the min() check here is currently a nop, but it may not always
> + 	 * be, depending on just how we do ipath_rcvegrbufsize
> + 	 */
> +-	dd->ipath_ibmaxlen = min(dd->ipath_piosize2k,
> ++	dd->ipath_ibmaxlen = min(ipath_mtu4096 ? dd->ipath_piosize4k :
> ++				 dd->ipath_piosize2k,
> + 				 dd->ipath_rcvegrbufsize +
> + 				 (dd->ipath_rcvhdrentsize << 2));
> + 	dd->ipath_init_ibmaxlen = dd->ipath_ibmaxlen;
> +diff -up a/drivers/infiniband/hw/ipath/ipath_iba7220.c b/drivers/infiniband/hw/ipath/ipath_iba7220.c
> +--- a/drivers/infiniband/hw/ipath/ipath_iba7220.c	2008-02-21 10:17:02.000000000 -0800
> ++++ b/drivers/infiniband/hw/ipath/ipath_iba7220.c	2008-02-21 14:55:02.000000000 -0800
> +@@ -2204,14 +2204,14 @@ static void autoneg_send(struct ipath_de
> + 	u32 pnum;
> + 
> + 	i = 0;
> +-	while (!(piobuf = ipath_getpiobuf(dd, &pnum))) {
> ++	cnt = 7 + dcnt + 1; /* 7 dword header, dword data, icrc */
> ++	while (!(piobuf = ipath_getpiobuf(dd, cnt, &pnum))) {
> + 		if (i++ > 15) {
> + 			ipath_dbg("Couldn't get pio buffer for send\n");
> + 			return;
> + 		}
> + 		udelay(2);
> + 	}
> +-	cnt = 7 + dcnt + 1; /* 7 dword header, dword data, icrc */
> + 	if (dd->ipath_flags&IPATH_HAS_PBC_CNT)
> + 		cnt |= 0x80000000UL<<32; /* mark as VL15 */
> + 	writeq(cnt, piobuf);
> +diff -up a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
> +--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c	2008-02-21 10:17:02.000000000 -0800
> ++++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c	2008-02-21 14:55:12.000000000 -0800
> +@@ -794,7 +794,8 @@ int ipath_init_chip(struct ipath_devdata
> + 		ipath_dbg("%u pbufs/port leaves %u unused, add to kernel\n",
> + 			  dd->ipath_pbufsport, val32);
> + 	}
> +-	dd->ipath_lastpioindex = dd->ipath_lastport_piobuf;
> ++	dd->ipath_lastpioindex = 0;
> ++	dd->ipath_lastpioindexl = dd->ipath_lastport_piobuf;
> + 	ipath_chg_pioavailkernel(dd, 0, piobufs, 1);
> + 	ipath_cdbg(VERBOSE, "%d PIO bufs for kernel out of %d total %u "
> + 		   "each for %u user ports\n", kpiobufs,
> +diff -up a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
> +--- a/drivers/infiniband/hw/ipath/ipath_kernel.h	2008-02-21 10:17:02.000000000 -0800
> ++++ b/drivers/infiniband/hw/ipath/ipath_kernel.h	2008-02-21 14:56:22.000000000 -0800
> +@@ -406,6 +406,7 @@ struct ipath_devdata {
> + 	 * get to multiple devices
> + 	 */
> + 	u32 ipath_lastpioindex;
> ++	u32 ipath_lastpioindexl;
> + 	/* max length of freezemsg */
> + 	u32 ipath_freezelen;
> + 	/*
> +@@ -993,7 +994,7 @@ void ipath_hol_event(unsigned long);
> + 
> + /* free up any allocated data at closes */
> + void ipath_free_data(struct ipath_portdata *dd);
> +-u32 __iomem *ipath_getpiobuf(struct ipath_devdata *, u32 *);
> ++u32 __iomem *ipath_getpiobuf(struct ipath_devdata *, u32, u32 *);
> + void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start,
> + 				unsigned len, int avail);
> + void ipath_init_iba7220_funcs(struct ipath_devdata *);
> +diff -up a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c
> +--- a/drivers/infiniband/hw/ipath/ipath_rc.c	2008-02-21 10:17:02.000000000 -0800
> ++++ b/drivers/infiniband/hw/ipath/ipath_rc.c	2008-02-21 15:01:19.000000000 -0800
> +@@ -608,7 +608,7 @@ static void send_rc_ack(struct ipath_qp 
> + 	spin_unlock_irqrestore(&qp->s_lock, flags);
> + 
> + 	dd = dev->dd;
> +-	piobuf = ipath_getpiobuf(dd, &pbufn);
> ++	piobuf = ipath_getpiobuf(dd, 0, &pbufn);
> + 	if (!piobuf) {
> + 		/*
> + 		 * We are out of PIO buffers at the moment.
> +diff -up a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
> +--- a/drivers/infiniband/hw/ipath/ipath_verbs.c	2008-02-21 10:17:02.000000000 -0800
> ++++ b/drivers/infiniband/hw/ipath/ipath_verbs.c	2008-02-21 15:03:15.000000000 -0800
> +@@ -175,7 +175,7 @@ void ipath_copy_sge(struct ipath_sge_sta
> + 		if (len > sge->sge_length)
> + 			len = sge->sge_length;
> + 		BUG_ON(len == 0);
> +-		memcpy(sge->vaddr, data, len);
> ++		memcpy_cachebypass(sge->vaddr, data, len);
> + 		sge->vaddr += len;
> + 		sge->length -= len;
> + 		sge->sge_length -= len;
> +@@ -1186,7 +1186,7 @@ static int ipath_verbs_send_pio(struct i
> + 	u32 control;
> + 	int ret;
> + 
> +-	piobuf = ipath_getpiobuf(dd, NULL);
> ++	piobuf = ipath_getpiobuf(dd, plen, NULL);
> + 	if (unlikely(piobuf == NULL)) {
> + 		ret = -EBUSY;
> + 		goto bail;
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> ewg mailing list
> ewg at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg




More information about the ewg mailing list