aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNaresh Kumar Inna <naresh@chelsio.com>2013-05-17 06:20:03 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-06-04 14:16:28 -0400
commit49c1241384b599421a5e8c9f73f72e2052dd416d (patch)
tree5943b674cc0f18cefd7fc1013de387f36362f9ed /drivers
parent07cdc0464fb9438fd205069dc09d47b8783ad271 (diff)
[SCSI] csiostor: Retain default adapter configuration in absence of config file.
- Retain firmware defined configuration settings in the absence of user-provided configuration by eliminating the global RSS and the PF/VF capabilities mailbox commands. - Remove S_IRUGO from sysfs parameters that don't have 'show' functionality. Signed-off-by: Naresh Kumar Inna <naresh@chelsio.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/csiostor/csio_hw.c91
-rw-r--r--drivers/scsi/csiostor/csio_hw.h11
-rw-r--r--drivers/scsi/csiostor/csio_mb.c77
-rw-r--r--drivers/scsi/csiostor/csio_mb.h11
-rw-r--r--drivers/scsi/csiostor/csio_scsi.c4
5 files changed, 2 insertions, 192 deletions
diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c
index 193605519361..0eb35b9b3784 100644
--- a/drivers/scsi/csiostor/csio_hw.c
+++ b/drivers/scsi/csiostor/csio_hw.c
@@ -1597,87 +1597,6 @@ out:
1597 return rv; 1597 return rv;
1598} 1598}
1599 1599
1600static int
1601csio_config_global_rss(struct csio_hw *hw)
1602{
1603 struct csio_mb *mbp;
1604 enum fw_retval retval;
1605
1606 mbp = mempool_alloc(hw->mb_mempool, GFP_ATOMIC);
1607 if (!mbp) {
1608 CSIO_INC_STATS(hw, n_err_nomem);
1609 return -ENOMEM;
1610 }
1611
1612 csio_rss_glb_config(hw, mbp, CSIO_MB_DEFAULT_TMO,
1613 FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL,
1614 FW_RSS_GLB_CONFIG_CMD_TNLMAPEN |
1615 FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ |
1616 FW_RSS_GLB_CONFIG_CMD_TNLALLLKP,
1617 NULL);
1618
1619 if (csio_mb_issue(hw, mbp)) {
1620 csio_err(hw, "Issue of FW_RSS_GLB_CONFIG_CMD failed!\n");
1621 mempool_free(mbp, hw->mb_mempool);
1622 return -EINVAL;
1623 }
1624
1625 retval = csio_mb_fw_retval(mbp);
1626 if (retval != FW_SUCCESS) {
1627 csio_err(hw, "FW_RSS_GLB_CONFIG_CMD returned 0x%x!\n", retval);
1628 mempool_free(mbp, hw->mb_mempool);
1629 return -EINVAL;
1630 }
1631
1632 mempool_free(mbp, hw->mb_mempool);
1633
1634 return 0;
1635}
1636
1637/*
1638 * csio_config_pfvf - Configure Physical/Virtual functions settings.
1639 * @hw: HW module
1640 *
1641 */
1642static int
1643csio_config_pfvf(struct csio_hw *hw)
1644{
1645 struct csio_mb *mbp;
1646 enum fw_retval retval;
1647
1648 mbp = mempool_alloc(hw->mb_mempool, GFP_ATOMIC);
1649 if (!mbp) {
1650 CSIO_INC_STATS(hw, n_err_nomem);
1651 return -ENOMEM;
1652 }
1653
1654 /*
1655 * For now, allow all PFs to access to all ports using a pmask
1656 * value of 0xF (M_FW_PFVF_CMD_PMASK). Once we have VFs, we will
1657 * need to provide access based on some rule.
1658 */
1659 csio_mb_pfvf(hw, mbp, CSIO_MB_DEFAULT_TMO, hw->pfn, 0, CSIO_NEQ,
1660 CSIO_NETH_CTRL, CSIO_NIQ_FLINT, 0, 0, CSIO_NVI, CSIO_CMASK,
1661 CSIO_PMASK, CSIO_NEXACTF, CSIO_R_CAPS, CSIO_WX_CAPS, NULL);
1662
1663 if (csio_mb_issue(hw, mbp)) {
1664 csio_err(hw, "Issue of FW_PFVF_CMD failed!\n");
1665 mempool_free(mbp, hw->mb_mempool);
1666 return -EINVAL;
1667 }
1668
1669 retval = csio_mb_fw_retval(mbp);
1670 if (retval != FW_SUCCESS) {
1671 csio_err(hw, "FW_PFVF_CMD returned 0x%x!\n", retval);
1672 mempool_free(mbp, hw->mb_mempool);
1673 return -EINVAL;
1674 }
1675
1676 mempool_free(mbp, hw->mb_mempool);
1677
1678 return 0;
1679}
1680
1681/* 1600/*
1682 * csio_enable_ports - Bring up all available ports. 1601 * csio_enable_ports - Bring up all available ports.
1683 * @hw: HW module. 1602 * @hw: HW module.
@@ -2056,16 +1975,6 @@ csio_hw_no_fwconfig(struct csio_hw *hw, int reset)
2056 if (rv != 0) 1975 if (rv != 0)
2057 goto out; 1976 goto out;
2058 1977
2059 /* Config Global RSS command */
2060 rv = csio_config_global_rss(hw);
2061 if (rv != 0)
2062 goto out;
2063
2064 /* Configure PF/VF capabilities of device */
2065 rv = csio_config_pfvf(hw);
2066 if (rv != 0)
2067 goto out;
2068
2069 /* device parameters */ 1978 /* device parameters */
2070 rv = csio_get_device_params(hw); 1979 rv = csio_get_device_params(hw);
2071 if (rv != 0) 1980 if (rv != 0)
diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h
index 489fc095cb03..49b1daa4476e 100644
--- a/drivers/scsi/csiostor/csio_hw.h
+++ b/drivers/scsi/csiostor/csio_hw.h
@@ -153,17 +153,6 @@ enum {
153 CSIO_SGE_INT_CNT_VAL_1 = 4, 153 CSIO_SGE_INT_CNT_VAL_1 = 4,
154 CSIO_SGE_INT_CNT_VAL_2 = 8, 154 CSIO_SGE_INT_CNT_VAL_2 = 8,
155 CSIO_SGE_INT_CNT_VAL_3 = 16, 155 CSIO_SGE_INT_CNT_VAL_3 = 16,
156
157 /* Storage specific - used by FW_PFVF_CMD */
158 CSIO_WX_CAPS = FW_CMD_CAP_PF, /* w/x all */
159 CSIO_R_CAPS = FW_CMD_CAP_PF, /* r all */
160 CSIO_NVI = 4,
161 CSIO_NIQ_FLINT = 34,
162 CSIO_NETH_CTRL = 32,
163 CSIO_NEQ = 66,
164 CSIO_NEXACTF = 32,
165 CSIO_CMASK = FW_PFVF_CMD_CMASK_MASK,
166 CSIO_PMASK = FW_PFVF_CMD_PMASK_MASK,
167}; 156};
168 157
169/* Slowpath events */ 158/* Slowpath events */
diff --git a/drivers/scsi/csiostor/csio_mb.c b/drivers/scsi/csiostor/csio_mb.c
index f5d9ee1fda62..15b635142546 100644
--- a/drivers/scsi/csiostor/csio_mb.c
+++ b/drivers/scsi/csiostor/csio_mb.c
@@ -326,83 +326,6 @@ csio_mb_caps_config(struct csio_hw *hw, struct csio_mb *mbp, uint32_t tmo,
326 cmdp->fcoecaps |= htons(FW_CAPS_CONFIG_FCOE_TARGET); 326 cmdp->fcoecaps |= htons(FW_CAPS_CONFIG_FCOE_TARGET);
327} 327}
328 328
329void
330csio_rss_glb_config(struct csio_hw *hw, struct csio_mb *mbp,
331 uint32_t tmo, uint8_t mode, unsigned int flags,
332 void (*cbfn)(struct csio_hw *, struct csio_mb *))
333{
334 struct fw_rss_glb_config_cmd *cmdp =
335 (struct fw_rss_glb_config_cmd *)(mbp->mb);
336
337 CSIO_INIT_MBP(mbp, cmdp, tmo, hw, cbfn, 1);
338
339 cmdp->op_to_write = htonl(FW_CMD_OP(FW_RSS_GLB_CONFIG_CMD) |
340 FW_CMD_REQUEST | FW_CMD_WRITE);
341 cmdp->retval_len16 = htonl(FW_CMD_LEN16(sizeof(*cmdp) / 16));
342
343 if (mode == FW_RSS_GLB_CONFIG_CMD_MODE_MANUAL) {
344 cmdp->u.manual.mode_pkd =
345 htonl(FW_RSS_GLB_CONFIG_CMD_MODE(mode));
346 } else if (mode == FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL) {
347 cmdp->u.basicvirtual.mode_pkd =
348 htonl(FW_RSS_GLB_CONFIG_CMD_MODE(mode));
349 cmdp->u.basicvirtual.synmapen_to_hashtoeplitz = htonl(flags);
350 }
351}
352
353
354/*
355 * csio_mb_pfvf - FW Write PF/VF capabilities command helper.
356 * @hw: The HW structure
357 * @mbp: Mailbox structure
358 * @pf:
359 * @vf:
360 * @txq:
361 * @txq_eht_ctrl:
362 * @rxqi:
363 * @rxq:
364 * @tc:
365 * @vi:
366 * @pmask:
367 * @rcaps:
368 * @wxcaps:
369 * @cbfn: Callback, if any.
370 *
371 */
372void
373csio_mb_pfvf(struct csio_hw *hw, struct csio_mb *mbp, uint32_t tmo,
374 unsigned int pf, unsigned int vf, unsigned int txq,
375 unsigned int txq_eth_ctrl, unsigned int rxqi,
376 unsigned int rxq, unsigned int tc, unsigned int vi,
377 unsigned int cmask, unsigned int pmask, unsigned int nexactf,
378 unsigned int rcaps, unsigned int wxcaps,
379 void (*cbfn) (struct csio_hw *, struct csio_mb *))
380{
381 struct fw_pfvf_cmd *cmdp = (struct fw_pfvf_cmd *)(mbp->mb);
382
383 CSIO_INIT_MBP(mbp, cmdp, tmo, hw, cbfn, 1);
384
385 cmdp->op_to_vfn = htonl(FW_CMD_OP(FW_PFVF_CMD) |
386 FW_CMD_REQUEST |
387 FW_CMD_WRITE |
388 FW_PFVF_CMD_PFN(pf) |
389 FW_PFVF_CMD_VFN(vf));
390 cmdp->retval_len16 = htonl(FW_CMD_LEN16(sizeof(*cmdp) / 16));
391 cmdp->niqflint_niq = htonl(FW_PFVF_CMD_NIQFLINT(rxqi) |
392 FW_PFVF_CMD_NIQ(rxq));
393
394 cmdp->type_to_neq = htonl(FW_PFVF_CMD_TYPE |
395 FW_PFVF_CMD_CMASK(cmask) |
396 FW_PFVF_CMD_PMASK(pmask) |
397 FW_PFVF_CMD_NEQ(txq));
398 cmdp->tc_to_nexactf = htonl(FW_PFVF_CMD_TC(tc) |
399 FW_PFVF_CMD_NVI(vi) |
400 FW_PFVF_CMD_NEXACTF(nexactf));
401 cmdp->r_caps_to_nethctrl = htonl(FW_PFVF_CMD_R_CAPS(rcaps) |
402 FW_PFVF_CMD_WX_CAPS(wxcaps) |
403 FW_PFVF_CMD_NETHCTRL(txq_eth_ctrl));
404}
405
406#define CSIO_ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ 329#define CSIO_ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\
407 FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_ANEG) 330 FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_ANEG)
408 331
diff --git a/drivers/scsi/csiostor/csio_mb.h b/drivers/scsi/csiostor/csio_mb.h
index 1788ea506f39..a84179e54ab9 100644
--- a/drivers/scsi/csiostor/csio_mb.h
+++ b/drivers/scsi/csiostor/csio_mb.h
@@ -183,17 +183,6 @@ void csio_mb_caps_config(struct csio_hw *, struct csio_mb *, uint32_t,
183 bool, bool, bool, bool, 183 bool, bool, bool, bool,
184 void (*)(struct csio_hw *, struct csio_mb *)); 184 void (*)(struct csio_hw *, struct csio_mb *));
185 185
186void csio_rss_glb_config(struct csio_hw *, struct csio_mb *,
187 uint32_t, uint8_t, unsigned int,
188 void (*)(struct csio_hw *, struct csio_mb *));
189
190void csio_mb_pfvf(struct csio_hw *, struct csio_mb *, uint32_t,
191 unsigned int, unsigned int, unsigned int,
192 unsigned int, unsigned int, unsigned int,
193 unsigned int, unsigned int, unsigned int,
194 unsigned int, unsigned int, unsigned int,
195 unsigned int, void (*) (struct csio_hw *, struct csio_mb *));
196
197void csio_mb_port(struct csio_hw *, struct csio_mb *, uint32_t, 186void csio_mb_port(struct csio_hw *, struct csio_mb *, uint32_t,
198 uint8_t, bool, uint32_t, uint16_t, 187 uint8_t, bool, uint32_t, uint16_t,
199 void (*) (struct csio_hw *, struct csio_mb *)); 188 void (*) (struct csio_hw *, struct csio_mb *));
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index ddd38e5eb0e7..7494e4bc69cc 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -1479,8 +1479,8 @@ csio_store_dbg_level(struct device *dev,
1479} 1479}
1480 1480
1481static DEVICE_ATTR(hw_state, S_IRUGO, csio_show_hw_state, NULL); 1481static DEVICE_ATTR(hw_state, S_IRUGO, csio_show_hw_state, NULL);
1482static DEVICE_ATTR(device_reset, S_IRUGO | S_IWUSR, NULL, csio_device_reset); 1482static DEVICE_ATTR(device_reset, S_IWUSR, NULL, csio_device_reset);
1483static DEVICE_ATTR(disable_port, S_IRUGO | S_IWUSR, NULL, csio_disable_port); 1483static DEVICE_ATTR(disable_port, S_IWUSR, NULL, csio_disable_port);
1484static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level, 1484static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level,
1485 csio_store_dbg_level); 1485 csio_store_dbg_level);
1486 1486