Skip to contentSkip to conversation

cnic: Fix mmap regression.

PATCH Applied Michael Chan 2 participants 5 messages Jun 29, 2012 – Jul 5, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cnic: Fix mmap regression.

commit 1f85d58cdf15354a7120fc9ccc9bb9c45b53af88
cnic: Remove uio mem[0].

introduced a regression as older versions of userspace app still rely on this mmap. Restore the mmap functionality and get the base address from pci_resource_start() as the nedev->base_addr has been deprecated for PCI devices.

Update version to 2.5.12.

---
 drivers/net/ethernet/broadcom/cnic.c    |    8 +++++++-
 drivers/net/ethernet/broadcom/cnic_if.h |    4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/cnic.c +7 -1
index f897306..22ad7b6 100644
@@ -1063,9 +1063,13 @@ static int cnic_init_uio(struct cnic_dev *dev)
 
 	uinfo = &udev->cnic_uinfo;
 
-	uinfo->mem[0].memtype = UIO_MEM_NONE;
+	uinfo->mem[0].addr = pci_resource_start(dev->pcidev, 0);
+	uinfo->mem[0].internal_addr = dev->regview;
+	uinfo->mem[0].memtype = UIO_MEM_PHYS;
 
 	if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) {
+		uinfo->mem[0].size = MB_GET_CID_ADDR(TX_TSS_CID +
+						     TX_MAX_TSS_RINGS + 1);
 		uinfo->mem[1].addr = (unsigned long) cp->status_blk.gen &
 					PAGE_MASK;
 		if (cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX)
@@ -1075,6 +1079,8 @@ static int cnic_init_uio(struct cnic_dev *dev)
 
 		uinfo->name = "bnx2_cnic";
 	} else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) {
+		uinfo->mem[0].size = pci_resource_len(dev->pcidev, 0);
+
 		uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk &
 			PAGE_MASK;
 		uinfo->mem[1].size = sizeof(*cp->bnx2x_def_status_blk);
drivers/net/ethernet/broadcom/cnic_if.h +2 -2
index 54f68f0..5cb8888 100644
@@ -14,8 +14,8 @@
 
 #include "bnx2x/bnx2x_mfw_req.h"
 
-#define CNIC_MODULE_VERSION	"2.5.11"
-#define CNIC_MODULE_RELDATE	"June 27, 2012"
+#define CNIC_MODULE_VERSION	"2.5.12"
+#define CNIC_MODULE_RELDATE	"June 29, 2012"
 
 #define CNIC_ULP_RDMA		0
 #define CNIC_ULP_ISCSI		1
Signature · 1 line
1.7.1
maintainer Applied
#1 lore raw

From: "Michael Chan" <[email protected]>
Date: Fri, 29 Jun 2012 12:32:45 -0700

Quoted 11 lines

commit 1f85d58cdf15354a7120fc9ccc9bb9c45b53af88
cnic: Remove uio mem[0].

introduced a regression as older versions of userspace app still rely on this mmap. Restore the mmap functionality and get the base address from pci_resource_start() as the nedev->base_addr has been deprecated for PCI devices.

Update version to 2.5.12.

I really couldn't believe what you guys were doing in the original commit, but I decided to let you do stupid things and find out the hard way that removing any user visible interface is basically impossible.

Applied, thanks.

#2 lore raw
Quoted 13 lines · David Miller

From: "Michael Chan" <[email protected]>
Date: Fri, 29 Jun 2012 12:32:45 -0700

Quoted 10 lines

commit 1f85d58cdf15354a7120fc9ccc9bb9c45b53af88
cnic: Remove uio mem[0].

introduced a regression as older versions of userspace app still rely on this mmap. Restore the mmap functionality and get the base address from pci_resource_start() as the nedev->base_addr has been deprecated for PCI devices.

Update version to 2.5.12.

Quoted 9 lines
Quoted 1 line

I really couldn't believe what you guys were doing in the original commit, but I decided to let you do stupid things and find out the hard way that removing any user visible interface is basically impossible.

Applied, thanks.

David, this patch plus the earlier commit are also needed for the net tree because netdev->base_addr was removed there. Can you apply these directly to the net tree? Or you want me to send you the equivalent patches for net. Thanks.

maintainer
#3 lore raw

From: "Michael Chan" <[email protected]>
Date: Thu, 5 Jul 2012 14:59:46 -0700

Quoted 1 line

Or you want me to send you the equivalent patches for net.

Please do so.

#4 lore raw
Quoted 7 lines · David Miller

From: "Michael Chan" <[email protected]>
Date: Thu, 5 Jul 2012 14:59:46 -0700

Quoted 1 line

Or you want me to send you the equivalent patches for net.

Please do so.

OK. I'll send you one patch to fix it in net, instead of one that causes regression, and another one to fix it.