Commit 9308f96c authored by Roland Dreier's avatar Roland Dreier

Merge branches 'cxgb3', 'ipoib', 'mthca', 'mlx4' and 'nes' into for-linus

...@@ -157,13 +157,15 @@ enum { ...@@ -157,13 +157,15 @@ enum {
enum { enum {
CMD_TIME_CLASS_A = (HZ + 999) / 1000 + 1, CMD_TIME_CLASS_A = (HZ + 999) / 1000 + 1,
CMD_TIME_CLASS_B = (HZ + 99) / 100 + 1, CMD_TIME_CLASS_B = (HZ + 99) / 100 + 1,
CMD_TIME_CLASS_C = (HZ + 9) / 10 + 1 CMD_TIME_CLASS_C = (HZ + 9) / 10 + 1,
CMD_TIME_CLASS_D = 60 * HZ
}; };
#else #else
enum { enum {
CMD_TIME_CLASS_A = 60 * HZ, CMD_TIME_CLASS_A = 60 * HZ,
CMD_TIME_CLASS_B = 60 * HZ, CMD_TIME_CLASS_B = 60 * HZ,
CMD_TIME_CLASS_C = 60 * HZ CMD_TIME_CLASS_C = 60 * HZ,
CMD_TIME_CLASS_D = 60 * HZ
}; };
#endif #endif
...@@ -598,7 +600,7 @@ int mthca_SYS_EN(struct mthca_dev *dev, u8 *status) ...@@ -598,7 +600,7 @@ int mthca_SYS_EN(struct mthca_dev *dev, u8 *status)
u64 out; u64 out;
int ret; int ret;
ret = mthca_cmd_imm(dev, 0, &out, 0, 0, CMD_SYS_EN, HZ, status); ret = mthca_cmd_imm(dev, 0, &out, 0, 0, CMD_SYS_EN, CMD_TIME_CLASS_D, status);
if (*status == MTHCA_CMD_STAT_DDR_MEM_ERR) if (*status == MTHCA_CMD_STAT_DDR_MEM_ERR)
mthca_warn(dev, "SYS_EN DDR error: syn=%x, sock=%d, " mthca_warn(dev, "SYS_EN DDR error: syn=%x, sock=%d, "
...@@ -611,7 +613,7 @@ int mthca_SYS_EN(struct mthca_dev *dev, u8 *status) ...@@ -611,7 +613,7 @@ int mthca_SYS_EN(struct mthca_dev *dev, u8 *status)
int mthca_SYS_DIS(struct mthca_dev *dev, u8 *status) int mthca_SYS_DIS(struct mthca_dev *dev, u8 *status)
{ {
return mthca_cmd(dev, 0, 0, 0, CMD_SYS_DIS, HZ, status); return mthca_cmd(dev, 0, 0, 0, CMD_SYS_DIS, CMD_TIME_CLASS_C, status);
} }
static int mthca_map_cmd(struct mthca_dev *dev, u16 op, struct mthca_icm *icm, static int mthca_map_cmd(struct mthca_dev *dev, u16 op, struct mthca_icm *icm,
...@@ -1390,7 +1392,7 @@ int mthca_INIT_HCA(struct mthca_dev *dev, ...@@ -1390,7 +1392,7 @@ int mthca_INIT_HCA(struct mthca_dev *dev,
MTHCA_PUT(inbox, param->uarc_base, INIT_HCA_UAR_CTX_BASE_OFFSET); MTHCA_PUT(inbox, param->uarc_base, INIT_HCA_UAR_CTX_BASE_OFFSET);
} }
err = mthca_cmd(dev, mailbox->dma, 0, 0, CMD_INIT_HCA, HZ, status); err = mthca_cmd(dev, mailbox->dma, 0, 0, CMD_INIT_HCA, CMD_TIME_CLASS_D, status);
mthca_free_mailbox(dev, mailbox); mthca_free_mailbox(dev, mailbox);
return err; return err;
...@@ -1450,12 +1452,12 @@ int mthca_INIT_IB(struct mthca_dev *dev, ...@@ -1450,12 +1452,12 @@ int mthca_INIT_IB(struct mthca_dev *dev,
int mthca_CLOSE_IB(struct mthca_dev *dev, int port, u8 *status) int mthca_CLOSE_IB(struct mthca_dev *dev, int port, u8 *status)
{ {
return mthca_cmd(dev, 0, port, 0, CMD_CLOSE_IB, HZ, status); return mthca_cmd(dev, 0, port, 0, CMD_CLOSE_IB, CMD_TIME_CLASS_A, status);
} }
int mthca_CLOSE_HCA(struct mthca_dev *dev, int panic, u8 *status) int mthca_CLOSE_HCA(struct mthca_dev *dev, int panic, u8 *status)
{ {
return mthca_cmd(dev, 0, 0, panic, CMD_CLOSE_HCA, HZ, status); return mthca_cmd(dev, 0, 0, panic, CMD_CLOSE_HCA, CMD_TIME_CLASS_C, status);
} }
int mthca_SET_IB(struct mthca_dev *dev, struct mthca_set_ib_param *param, int mthca_SET_IB(struct mthca_dev *dev, struct mthca_set_ib_param *param,
......
...@@ -56,10 +56,8 @@ ...@@ -56,10 +56,8 @@
#define QUEUE_DISCONNECTS #define QUEUE_DISCONNECTS
#define DRV_BUILD "1"
#define DRV_NAME "iw_nes" #define DRV_NAME "iw_nes"
#define DRV_VERSION "1.0 KO Build " DRV_BUILD #define DRV_VERSION "1.5.0.0"
#define PFX DRV_NAME ": " #define PFX DRV_NAME ": "
/* /*
......
This diff is collapsed.
...@@ -149,6 +149,7 @@ struct nes_timer_entry { ...@@ -149,6 +149,7 @@ struct nes_timer_entry {
#endif #endif
#define NES_SHORT_TIME (10) #define NES_SHORT_TIME (10)
#define NES_LONG_TIME (2000*HZ/1000) #define NES_LONG_TIME (2000*HZ/1000)
#define NES_MAX_TIMEOUT ((unsigned long) (12*HZ))
#define NES_CM_HASHTABLE_SIZE 1024 #define NES_CM_HASHTABLE_SIZE 1024
#define NES_CM_TCP_TIMER_INTERVAL 3000 #define NES_CM_TCP_TIMER_INTERVAL 3000
......
...@@ -550,11 +550,8 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) { ...@@ -550,11 +550,8 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) {
msleep(1); msleep(1);
} }
if (int_cnt > 1) { if (int_cnt > 1) {
u32 sds;
spin_lock_irqsave(&nesadapter->phy_lock, flags); spin_lock_irqsave(&nesadapter->phy_lock, flags);
sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, 0x0000F0C8);
sds |= 0x00000040;
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds);
mh_detected++; mh_detected++;
reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET); reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET);
reset_value |= 0x0000003d; reset_value |= 0x0000003d;
...@@ -579,7 +576,7 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) { ...@@ -579,7 +576,7 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) {
if (++ext_cnt > int_cnt) { if (++ext_cnt > int_cnt) {
spin_lock_irqsave(&nesadapter->phy_lock, flags); spin_lock_irqsave(&nesadapter->phy_lock, flags);
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1,
0x0000F0C8); 0x0000F088);
mh_detected++; mh_detected++;
reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET); reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET);
reset_value |= 0x0000003d; reset_value |= 0x0000003d;
...@@ -764,6 +761,9 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count, ...@@ -764,6 +761,9 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count,
return 0; return 0;
/* init serdes 1 */ /* init serdes 1 */
if (!(OneG_Mode && (nesadapter->phy_type[1] != NES_PHY_TYPE_PUMA_1G)))
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000000FF);
switch (nesadapter->phy_type[1]) { switch (nesadapter->phy_type[1]) {
case NES_PHY_TYPE_ARGUS: case NES_PHY_TYPE_ARGUS:
case NES_PHY_TYPE_SFP_D: case NES_PHY_TYPE_SFP_D:
...@@ -771,21 +771,20 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count, ...@@ -771,21 +771,20 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count,
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_EMP1, 0x00000000); nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_EMP1, 0x00000000);
break; break;
case NES_PHY_TYPE_CX4: case NES_PHY_TYPE_CX4:
sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1);
sds &= 0xFFFFFFBF;
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds);
if (wide_ppm_offset) if (wide_ppm_offset)
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000FFFAA); nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000FFFAA);
else
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000000FF);
break; break;
case NES_PHY_TYPE_PUMA_1G: case NES_PHY_TYPE_PUMA_1G:
sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1);
sds |= 0x000000100; sds |= 0x000000100;
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds); nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds);
} }
if (!OneG_Mode) if (!OneG_Mode) {
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE1, 0x11110000); nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE1, 0x11110000);
sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1);
sds &= 0xFFFFFFBF;
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds);
}
} else { } else {
/* init serdes 0 */ /* init serdes 0 */
nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0, 0x00000008); nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0, 0x00000008);
...@@ -913,6 +912,12 @@ static void nes_init_csr_ne020(struct nes_device *nesdev, u8 hw_rev, u8 port_cou ...@@ -913,6 +912,12 @@ static void nes_init_csr_ne020(struct nes_device *nesdev, u8 hw_rev, u8 port_cou
u32temp &= 0x7fffffff; u32temp &= 0x7fffffff;
u32temp |= 0x7fff0010; u32temp |= 0x7fff0010;
nes_write_indexed(nesdev, 0x000021f8, u32temp); nes_write_indexed(nesdev, 0x000021f8, u32temp);
if (port_count > 1) {
u32temp = nes_read_indexed(nesdev, 0x000023f8);
u32temp &= 0x7fffffff;
u32temp |= 0x7fff0010;
nes_write_indexed(nesdev, 0x000023f8, u32temp);
}
} }
} }
...@@ -1366,13 +1371,14 @@ int nes_init_phy(struct nes_device *nesdev) ...@@ -1366,13 +1371,14 @@ int nes_init_phy(struct nes_device *nesdev)
if (phy_type == NES_PHY_TYPE_ARGUS) { if (phy_type == NES_PHY_TYPE_ARGUS) {
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x000C); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x000C);
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0008); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0008);
nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0027, 0x0001);
} else { } else {
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x0004); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x0004);
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0038); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0038);
nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0027, 0x0013);
} }
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc31a, 0x0098); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc31a, 0x0098);
nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0026, 0x0E00); nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0026, 0x0E00);
nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0027, 0x0001);
/* setup LEDs */ /* setup LEDs */
nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xd006, 0x0007); nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xd006, 0x0007);
......
...@@ -1627,6 +1627,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, ...@@ -1627,6 +1627,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
nescq->hw_cq.cq_number = nes_ucontext->mcrqf & 0xffff; nescq->hw_cq.cq_number = nes_ucontext->mcrqf & 0xffff;
else else
nescq->hw_cq.cq_number = nesvnic->mcrq_qp_id + nes_ucontext->mcrqf-1; nescq->hw_cq.cq_number = nesvnic->mcrq_qp_id + nes_ucontext->mcrqf-1;
nescq->mcrqf = nes_ucontext->mcrqf;
nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
} }
nes_debug(NES_DBG_CQ, "CQ Virtual Address = %08lX, size = %u.\n", nes_debug(NES_DBG_CQ, "CQ Virtual Address = %08lX, size = %u.\n",
...@@ -1682,6 +1683,12 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, ...@@ -1682,6 +1683,12 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
if (!context) if (!context)
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
nescq->hw_cq.cq_pbase); nescq->hw_cq.cq_pbase);
else {
pci_free_consistent(nesdev->pcidev, nespbl->pbl_size,
nespbl->pbl_vbase, nespbl->pbl_pbase);
kfree(nespbl);
}
nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
kfree(nescq); kfree(nescq);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1705,6 +1712,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, ...@@ -1705,6 +1712,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
if (!context) if (!context)
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
nescq->hw_cq.cq_pbase); nescq->hw_cq.cq_pbase);
else {
pci_free_consistent(nesdev->pcidev, nespbl->pbl_size,
nespbl->pbl_vbase, nespbl->pbl_pbase);
kfree(nespbl);
}
nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
kfree(nescq); kfree(nescq);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1722,6 +1734,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, ...@@ -1722,6 +1734,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
if (!context) if (!context)
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
nescq->hw_cq.cq_pbase); nescq->hw_cq.cq_pbase);
else {
pci_free_consistent(nesdev->pcidev, nespbl->pbl_size,
nespbl->pbl_vbase, nespbl->pbl_pbase);
kfree(nespbl);
}
nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
kfree(nescq); kfree(nescq);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1774,6 +1791,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, ...@@ -1774,6 +1791,11 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
if (!context) if (!context)
pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
nescq->hw_cq.cq_pbase); nescq->hw_cq.cq_pbase);
else {
pci_free_consistent(nesdev->pcidev, nespbl->pbl_size,
nespbl->pbl_vbase, nespbl->pbl_pbase);
kfree(nespbl);
}
nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
kfree(nescq); kfree(nescq);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
...@@ -1855,7 +1877,9 @@ static int nes_destroy_cq(struct ib_cq *ib_cq) ...@@ -1855,7 +1877,9 @@ static int nes_destroy_cq(struct ib_cq *ib_cq)
set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_OPCODE_IDX, opcode); set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_OPCODE_IDX, opcode);
set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_ID_IDX, set_wqe_32bit_value(cqp_wqe->wqe_words, NES_CQP_WQE_ID_IDX,
(nescq->hw_cq.cq_number | ((u32)PCI_FUNC(nesdev->pcidev->devfn) << 16))); (nescq->hw_cq.cq_number | ((u32)PCI_FUNC(nesdev->pcidev->devfn) << 16)));
nes_free_resource(nesadapter, nesadapter->allocated_cqs, nescq->hw_cq.cq_number); if (!nescq->mcrqf)
nes_free_resource(nesadapter, nesadapter->allocated_cqs, nescq->hw_cq.cq_number);
atomic_set(&cqp_request->refcount, 2); atomic_set(&cqp_request->refcount, 2);
nes_post_cqp_request(nesdev, cqp_request); nes_post_cqp_request(nesdev, cqp_request);
...@@ -1895,8 +1919,7 @@ static int nes_destroy_cq(struct ib_cq *ib_cq) ...@@ -1895,8 +1919,7 @@ static int nes_destroy_cq(struct ib_cq *ib_cq)
static u32 root_256(struct nes_device *nesdev, static u32 root_256(struct nes_device *nesdev,
struct nes_root_vpbl *root_vpbl, struct nes_root_vpbl *root_vpbl,
struct nes_root_vpbl *new_root, struct nes_root_vpbl *new_root,
u16 pbl_count_4k, u16 pbl_count_4k)
u16 pbl_count_256)
{ {
u64 leaf_pbl; u64 leaf_pbl;
int i, j, k; int i, j, k;
...@@ -1952,7 +1975,7 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd, ...@@ -1952,7 +1975,7 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
int ret; int ret;
struct nes_adapter *nesadapter = nesdev->nesadapter; struct nes_adapter *nesadapter = nesdev->nesadapter;
uint pg_cnt = 0; uint pg_cnt = 0;
u16 pbl_count_256; u16 pbl_count_256 = 0;
u16 pbl_count = 0; u16 pbl_count = 0;
u8 use_256_pbls = 0; u8 use_256_pbls = 0;
u8 use_4k_pbls = 0; u8 use_4k_pbls = 0;
...@@ -2012,7 +2035,7 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd, ...@@ -2012,7 +2035,7 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
} }
if (use_256_pbls && use_two_level) { if (use_256_pbls && use_two_level) {
if (root_256(nesdev, root_vpbl, &new_root, pbl_count_4k, pbl_count_256) == 1) { if (root_256(nesdev, root_vpbl, &new_root, pbl_count_4k) == 1) {
if (new_root.pbl_pbase != 0) if (new_root.pbl_pbase != 0)
root_vpbl = &new_root; root_vpbl = &new_root;
} else { } else {
...@@ -2122,6 +2145,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, ...@@ -2122,6 +2145,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
struct nes_root_vpbl root_vpbl; struct nes_root_vpbl root_vpbl;
u32 stag; u32 stag;
u32 i; u32 i;
unsigned long mask;
u32 stag_index = 0; u32 stag_index = 0;
u32 next_stag_index = 0; u32 next_stag_index = 0;
u32 driver_key = 0; u32 driver_key = 0;
...@@ -2150,6 +2174,9 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, ...@@ -2150,6 +2174,9 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
return ERR_PTR(-E2BIG); return ERR_PTR(-E2BIG);
} }
if ((buffer_list[0].addr ^ *iova_start) & ~PAGE_MASK)
return ERR_PTR(-EINVAL);
err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr, err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr,
&stag_index, &next_stag_index); &stag_index, &next_stag_index);
if (err) { if (err) {
...@@ -2215,19 +2242,16 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, ...@@ -2215,19 +2242,16 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
root_pbl_index++; root_pbl_index++;
cur_pbl_index = 0; cur_pbl_index = 0;
} }
if (buffer_list[i].addr & ~PAGE_MASK) {
/* TODO: Unwind allocated buffers */
nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
nes_debug(NES_DBG_MR, "Unaligned Memory Buffer: 0x%x\n",
(unsigned int) buffer_list[i].addr);
ibmr = ERR_PTR(-EINVAL);
kfree(nesmr);
goto reg_phys_err;
}
if (!buffer_list[i].size) { mask = !buffer_list[i].size;
if (i != 0)
mask |= buffer_list[i].addr;
if (i != num_phys_buf - 1)
mask |= buffer_list[i].addr + buffer_list[i].size;
if (mask & ~PAGE_MASK) {
nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index); nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
nes_debug(NES_DBG_MR, "Invalid Buffer Size\n"); nes_debug(NES_DBG_MR, "Invalid buffer addr or size\n");
ibmr = ERR_PTR(-EINVAL); ibmr = ERR_PTR(-EINVAL);
kfree(nesmr); kfree(nesmr);
goto reg_phys_err; goto reg_phys_err;
...@@ -2238,7 +2262,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, ...@@ -2238,7 +2262,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
if ((buffer_list[i-1].addr+PAGE_SIZE) != buffer_list[i].addr) if ((buffer_list[i-1].addr+PAGE_SIZE) != buffer_list[i].addr)
single_page = 0; single_page = 0;
} }
vpbl.pbl_vbase[cur_pbl_index].pa_low = cpu_to_le32((u32)buffer_list[i].addr); vpbl.pbl_vbase[cur_pbl_index].pa_low = cpu_to_le32((u32)buffer_list[i].addr & PAGE_MASK);
vpbl.pbl_vbase[cur_pbl_index++].pa_high = vpbl.pbl_vbase[cur_pbl_index++].pa_high =
cpu_to_le32((u32)((((u64)buffer_list[i].addr) >> 32))); cpu_to_le32((u32)((((u64)buffer_list[i].addr) >> 32)));
} }
...@@ -2251,8 +2275,6 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd, ...@@ -2251,8 +2275,6 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
" length = 0x%016lX, index = 0x%08X\n", " length = 0x%016lX, index = 0x%08X\n",
stag, (unsigned long)*iova_start, (unsigned long)region_length, stag_index); stag, (unsigned long)*iova_start, (unsigned long)region_length, stag_index);
region_length -= (*iova_start)&PAGE_MASK;
/* Make the leaf PBL the root if only one PBL */ /* Make the leaf PBL the root if only one PBL */
if (root_pbl_index == 1) { if (root_pbl_index == 1) {
root_vpbl.pbl_pbase = vpbl.pbl_pbase; root_vpbl.pbl_pbase = vpbl.pbl_pbase;
...@@ -2786,10 +2808,9 @@ static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr, ...@@ -2786,10 +2808,9 @@ static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr,
struct nes_vnic *nesvnic = nesibdev->nesvnic; struct nes_vnic *nesvnic = nesibdev->nesvnic;
nes_debug(NES_DBG_INIT, "\n"); nes_debug(NES_DBG_INIT, "\n");
return sprintf(buf, "%x.%x.%x\n", return sprintf(buf, "%u.%u\n",
(int)(nesvnic->nesdev->nesadapter->fw_ver >> 32), (nesvnic->nesdev->nesadapter->firmware_version >> 16),
(int)(nesvnic->nesdev->nesadapter->fw_ver >> 16) & 0xffff, (nesvnic->nesdev->nesadapter->firmware_version & 0x000000ff));
(int)(nesvnic->nesdev->nesadapter->fw_ver & 0xffff));
} }
......
...@@ -112,6 +112,7 @@ struct nes_cq { ...@@ -112,6 +112,7 @@ struct nes_cq {
spinlock_t lock; spinlock_t lock;
u8 virtual_cq; u8 virtual_cq;
u8 pad[3]; u8 pad[3];
u32 mcrqf;
}; };
struct nes_wq { struct nes_wq {
......
...@@ -685,7 +685,8 @@ int ipoib_ib_dev_open(struct net_device *dev) ...@@ -685,7 +685,8 @@ int ipoib_ib_dev_open(struct net_device *dev)
queue_delayed_work(ipoib_workqueue, &priv->ah_reap_task, queue_delayed_work(ipoib_workqueue, &priv->ah_reap_task,
round_jiffies_relative(HZ)); round_jiffies_relative(HZ));
set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); if (!test_and_set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags))
napi_enable(&priv->napi);
return 0; return 0;
} }
...@@ -804,7 +805,8 @@ int ipoib_ib_dev_stop(struct net_device *dev, int flush) ...@@ -804,7 +805,8 @@ int ipoib_ib_dev_stop(struct net_device *dev, int flush)
struct ipoib_tx_buf *tx_req; struct ipoib_tx_buf *tx_req;
int i; int i;
clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); if (test_and_clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags))
napi_disable(&priv->napi);
ipoib_cm_dev_stop(dev); ipoib_cm_dev_stop(dev);
......
...@@ -106,8 +106,7 @@ int ipoib_open(struct net_device *dev) ...@@ -106,8 +106,7 @@ int ipoib_open(struct net_device *dev)
ipoib_dbg(priv, "bringing up interface\n"); ipoib_dbg(priv, "bringing up interface\n");
if (!test_and_set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
napi_enable(&priv->napi);
if (ipoib_pkey_dev_delay_open(dev)) if (ipoib_pkey_dev_delay_open(dev))
return 0; return 0;
...@@ -143,7 +142,6 @@ int ipoib_open(struct net_device *dev) ...@@ -143,7 +142,6 @@ int ipoib_open(struct net_device *dev)
ipoib_ib_dev_stop(dev, 1); ipoib_ib_dev_stop(dev, 1);
err_disable: err_disable:
napi_disable(&priv->napi);
clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
return -EINVAL; return -EINVAL;
...@@ -156,7 +154,6 @@ static int ipoib_stop(struct net_device *dev) ...@@ -156,7 +154,6 @@ static int ipoib_stop(struct net_device *dev)
ipoib_dbg(priv, "stopping interface\n"); ipoib_dbg(priv, "stopping interface\n");
clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
napi_disable(&priv->napi);
netif_stop_queue(dev); netif_stop_queue(dev);
......
...@@ -976,7 +976,7 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev) ...@@ -976,7 +976,7 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
nreq = err; nreq = err;
goto retry; goto retry;
} }
kfree(entries);
goto no_msi; goto no_msi;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment