40d39
< /* $FreeBSD: head/sys/dev/oce/oce_mbox.c 231879 2012-02-17 13:55:17Z luigi $ */
42c41
< #include "oce_if.h"
---
> /* $FreeBSD: head/sys/dev/oce/oce_mbox.c 247880 2013-03-06 09:53:38Z delphij $ */
44a44,46
> #include "oce_if.h"
> extern uint32_t sfp_vpd_dump_buffer[TRANSCEIVER_DATA_NUM_ELE];
>
279,280c281,287
< if (ret)
< return ret;
---
> if (!ret)
> ret = fwcmd->hdr.u0.rsp.status;
> if (ret) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, ret);
> goto error;
> }
283,284c290,291
<
< return 0;
---
> error:
> return ret;
431,432c438,444
< if (ret)
< return ret;
---
> if (!ret)
> ret = fwcmd->hdr.u0.rsp.status;
> if (ret) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, ret);
> goto error;
> }
438,439c450,451
<
< return 0;
---
> error:
> return ret;
469,470c481,487
< if (ret)
< return ret;
---
> if (!ret)
> ret = fwcmd->hdr.u0.rsp.status;
> if (ret) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, ret);
> goto error;
> }
488c505,506
< return 0;
---
> error:
> return ret;
543,544c561,567
< if (rc)
< return rc;
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
> }
550,551c573,574
<
< return 0;
---
> error:
> return rc;
583a607,611
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
630a659,664
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> return 0;
632,633d665
< return rc;
<
670c702,706
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
728a765
> int version;
731a769,775
> if (IS_XE201(sc)) {
> version = OCE_MBX_VER_V1;
> fwcmd->params.req.enable_rss = RSS_ENABLE_UDP_IPV4 |
> RSS_ENABLE_UDP_IPV6;
> } else
> version = OCE_MBX_VER_V0;
>
737c781
< OCE_MBX_VER_V0);
---
> version);
739,742c783,786
< fwcmd->params.req.enable_rss = (RSS_ENABLE_IPV4 |
< RSS_ENABLE_TCP_IPV4 |
< RSS_ENABLE_IPV6 |
< RSS_ENABLE_TCP_IPV6);
---
> fwcmd->params.req.enable_rss |= (RSS_ENABLE_IPV4 |
> RSS_ENABLE_TCP_IPV4 |
> RSS_ENABLE_IPV6 |
> RSS_ENABLE_TCP_IPV6);
756c800,804
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
758d805
<
837c884,889
< return rc;
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> return 0;
851c903
< int rc = 0;
---
> int rc = 0, version;
854a907,908
> IS_XE201(sc) ? (version = OCE_MBX_VER_V1) : (version = OCE_MBX_VER_V0);
>
861c915
< OCE_MBX_VER_V0);
---
> version);
868a923,924
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
870,875c926,928
< device_printf(sc->dev, "Could not get link speed: %d\n", rc);
< } else {
< /* interpret response */
< bcopy(&fwcmd->params.rsp, link, sizeof(struct link_status));
< link->logical_link_status = LE_32(link->logical_link_status);
< link->qos_link_speed = LE_16(link->qos_link_speed);
---
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
877c930,934
<
---
> /* interpret response */
> bcopy(&fwcmd->params.rsp, link, sizeof(struct link_status));
> link->logical_link_status = LE_32(link->logical_link_status);
> link->qos_link_speed = LE_16(link->qos_link_speed);
> error:
919,923c976,980
< if (rc) {
< device_printf(sc->dev,
< "Could not get nic statistics: %d\n", rc);
< }
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
969,972c1026,1030
< if (rc) {
< device_printf(sc->dev,
< "Could not get nic statistics: %d\n", rc);
< }
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1004c1062
< fwcmd->params.req.port_number = sc->if_id;
---
> fwcmd->params.req.port_number = sc->port_id;
1020,1024c1078,1082
< if (rc != 0) {
< device_printf(sc->dev,
< "Could not get physical port statistics: %d\n", rc);
< }
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1073,1077c1131,1135
< if (rc != 0) {
< device_printf(sc->dev,
< "Could not get physical port statistics: %d\n", rc);
< }
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1118c1176,1180
<
---
> if (!rc)
> rc = req->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1179,1181c1241,1247
< if (rc)
< return rc;
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
> }
1183c1249
<
---
> error:
1212a1279,1283
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1245,1247c1316,1322
< //if (rc != 0) This can fail in legacy mode. So skip
< // FN_LEAVE(rc);
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
> }
1250a1326
> error:
1284a1361,1365
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1322a1404,1405
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
1324c1407,1408
< return rc;
---
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1326c1410
< return(fwcmd->params.rsp.status);
---
> return rc;
1365,1369c1449,1453
< if (rc) {
< device_printf(sc->dev, "Write FlashROM mbox post failed\n");
< } else {
< rc = fwcmd->hdr.u0.rsp.status;
< }
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1410a1495,1496
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
1412,1415c1498,1500
< device_printf(sc->dev, "Read FlashROM CRC mbox post failed\n");
< } else {
< bcopy(fwcmd->data_buffer, flash_crc, 4);
< rc = fwcmd->hdr.u0.rsp.status;
---
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
1416a1502,1503
> bcopy(fwcmd->data_buffer, flash_crc, 4);
> error:
1442a1530,1531
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
1444,1455c1533,1535
< device_printf(sc->dev, "Read PHY info mbox post failed\n");
< } else {
< rc = fwcmd->hdr.u0.rsp.status;
< phy_info->phy_type = fwcmd->params.rsp.phy_info.phy_type;
< phy_info->interface_type =
< fwcmd->params.rsp.phy_info.interface_type;
< phy_info->auto_speeds_supported =
< fwcmd->params.rsp.phy_info.auto_speeds_supported;
< phy_info->fixed_speeds_supported =
< fwcmd->params.rsp.phy_info.fixed_speeds_supported;
< phy_info->misc_params =fwcmd->params.rsp.phy_info.misc_params;
<
---
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
1456a1537,1545
> phy_info->phy_type = fwcmd->params.rsp.phy_info.phy_type;
> phy_info->interface_type =
> fwcmd->params.rsp.phy_info.interface_type;
> phy_info->auto_speeds_supported =
> fwcmd->params.rsp.phy_info.auto_speeds_supported;
> phy_info->fixed_speeds_supported =
> fwcmd->params.rsp.phy_info.fixed_speeds_supported;
> phy_info->misc_params =fwcmd->params.rsp.phy_info.misc_params;
> error:
1501a1591,1592
> if (!rc)
> rc = fwcmd->params.rsp.status;
1503,1508c1594,1596
< device_printf(sc->dev,
< "Write Lancer FlashROM mbox post failed\n");
< } else {
< *written_data = fwcmd->params.rsp.actual_write_length;
< *additional_status = fwcmd->params.rsp.additional_status;
< rc = fwcmd->params.rsp.status;
---
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
1509a1598,1600
> *written_data = fwcmd->params.rsp.actual_write_length;
> *additional_status = fwcmd->params.rsp.additional_status;
> error:
1556c1647,1651
< if (rc)
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1558c1653
<
---
> }
1561,1562d1655
<
< return 0;
1564d1656
< device_printf(sc->dev, "Mbox Create RQ failed\n");
1606c1698,1702
< if (rc)
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1608c1704
<
---
> }
1610,1611d1705
<
< return 0;
1613d1706
< device_printf(sc->dev, "Mbox Create WQ failed\n");
1652c1745,1749
< if (rc)
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1654c1751
<
---
> }
1656,1657d1752
<
< return 0;
1659d1753
< device_printf(sc->dev, "Mbox Create EQ failed\n");
1729c1823,1827
< if (rc)
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1731c1829
<
---
> }
1732a1831,1832
> error:
> return rc;
1734c1834,1895
< return 0;
---
> }
>
> int
> oce_mbox_read_transrecv_data(POCE_SOFTC sc, uint32_t page_num)
> {
> int rc = 0;
> struct oce_mbx mbx;
> struct mbx_read_common_transrecv_data *fwcmd;
> struct oce_mq_sge *sgl;
> OCE_DMA_MEM dma;
>
> /* Allocate DMA mem*/
> if (oce_dma_alloc(sc, sizeof(struct mbx_read_common_transrecv_data),
> &dma, 0))
> return ENOMEM;
>
> fwcmd = OCE_DMAPTR(&dma, struct mbx_read_common_transrecv_data);
> bzero(fwcmd, sizeof(struct mbx_read_common_transrecv_data));
>
> bzero(&mbx, sizeof(struct oce_mbx));
> mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0,
> MBX_SUBSYSTEM_COMMON,
> OPCODE_COMMON_READ_TRANSRECEIVER_DATA,
> MBX_TIMEOUT_SEC,
> sizeof(struct mbx_read_common_transrecv_data),
> OCE_MBX_VER_V0);
>
> /* fill rest of mbx */
> mbx.u0.s.embedded = 0;
> mbx.payload_length = sizeof(struct mbx_read_common_transrecv_data);
> mbx.u0.s.sge_count = 1;
> sgl = &mbx.payload.u0.u1.sgl[0];
> sgl->pa_hi = htole32(upper_32_bits(dma.paddr));
> sgl->pa_lo = htole32((dma.paddr) & 0xFFFFFFFF);
> sgl->length = htole32(mbx.payload_length);
> DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ);
>
> fwcmd->params.req.port = LE_32(sc->port_id);
> fwcmd->params.req.page_num = LE_32(page_num);
>
> /* command post */
> rc = oce_mbox_post(sc, &mbx, NULL);
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
> }
> if(fwcmd->params.rsp.page_num == PAGE_NUM_A0)
> {
> bcopy((char *)fwcmd->params.rsp.page_data,
> (char *)&sfp_vpd_dump_buffer[0],
> TRANSCEIVER_A0_SIZE);
> }
>
> if(fwcmd->params.rsp.page_num == PAGE_NUM_A2)
> {
> bcopy((char *)fwcmd->params.rsp.page_data,
> (char *)&sfp_vpd_dump_buffer[32],
> TRANSCEIVER_A2_SIZE);
> }
1736d1896
< device_printf(sc->dev, "Mbox Create CQ failed\n");
1737a1898
> }
1738a1900,1941
> void
> oce_mbox_eqd_modify_periodic(POCE_SOFTC sc, struct oce_set_eqd *set_eqd,
> int num)
> {
> struct oce_mbx mbx;
> struct mbx_modify_common_eq_delay *fwcmd;
> int rc = 0;
> int i = 0;
>
> bzero(&mbx, sizeof(struct oce_mbx));
>
> /* Initialize MODIFY_EQ_DELAY ioctl header */
> fwcmd = (struct mbx_modify_common_eq_delay *)&mbx.payload;
> mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0,
> MBX_SUBSYSTEM_COMMON,
> OPCODE_COMMON_MODIFY_EQ_DELAY,
> MBX_TIMEOUT_SEC,
> sizeof(struct mbx_modify_common_eq_delay),
> OCE_MBX_VER_V0);
> /* fill rest of mbx */
> mbx.u0.s.embedded = 1;
> mbx.payload_length = sizeof(struct mbx_modify_common_eq_delay);
> DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ);
>
> fwcmd->params.req.num_eq = num;
> for (i = 0; i < num; i++) {
> fwcmd->params.req.delay[i].eq_id =
> htole32(set_eqd[i].eq_id);
> fwcmd->params.req.delay[i].phase = 0;
> fwcmd->params.req.delay[i].dm =
> htole32(set_eqd[i].delay_multiplier);
> }
>
>
> /* command post */
> rc = oce_mbox_post(sc, &mbx, NULL);
>
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1739a1943,1944
>
>
< /* $FreeBSD: head/sys/dev/oce/oce_mbox.c 231879 2012-02-17 13:55:17Z luigi $ */
42c41
< #include "oce_if.h"
---
> /* $FreeBSD: head/sys/dev/oce/oce_mbox.c 247880 2013-03-06 09:53:38Z delphij $ */
44a44,46
> #include "oce_if.h"
> extern uint32_t sfp_vpd_dump_buffer[TRANSCEIVER_DATA_NUM_ELE];
>
279,280c281,287
< if (ret)
< return ret;
---
> if (!ret)
> ret = fwcmd->hdr.u0.rsp.status;
> if (ret) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, ret);
> goto error;
> }
283,284c290,291
<
< return 0;
---
> error:
> return ret;
431,432c438,444
< if (ret)
< return ret;
---
> if (!ret)
> ret = fwcmd->hdr.u0.rsp.status;
> if (ret) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, ret);
> goto error;
> }
438,439c450,451
<
< return 0;
---
> error:
> return ret;
469,470c481,487
< if (ret)
< return ret;
---
> if (!ret)
> ret = fwcmd->hdr.u0.rsp.status;
> if (ret) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, ret);
> goto error;
> }
488c505,506
< return 0;
---
> error:
> return ret;
543,544c561,567
< if (rc)
< return rc;
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
> }
550,551c573,574
<
< return 0;
---
> error:
> return rc;
583a607,611
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
630a659,664
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> return 0;
632,633d665
< return rc;
<
670c702,706
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
728a765
> int version;
731a769,775
> if (IS_XE201(sc)) {
> version = OCE_MBX_VER_V1;
> fwcmd->params.req.enable_rss = RSS_ENABLE_UDP_IPV4 |
> RSS_ENABLE_UDP_IPV6;
> } else
> version = OCE_MBX_VER_V0;
>
737c781
< OCE_MBX_VER_V0);
---
> version);
739,742c783,786
< fwcmd->params.req.enable_rss = (RSS_ENABLE_IPV4 |
< RSS_ENABLE_TCP_IPV4 |
< RSS_ENABLE_IPV6 |
< RSS_ENABLE_TCP_IPV6);
---
> fwcmd->params.req.enable_rss |= (RSS_ENABLE_IPV4 |
> RSS_ENABLE_TCP_IPV4 |
> RSS_ENABLE_IPV6 |
> RSS_ENABLE_TCP_IPV6);
756c800,804
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
758d805
<
837c884,889
< return rc;
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> return 0;
851c903
< int rc = 0;
---
> int rc = 0, version;
854a907,908
> IS_XE201(sc) ? (version = OCE_MBX_VER_V1) : (version = OCE_MBX_VER_V0);
>
861c915
< OCE_MBX_VER_V0);
---
> version);
868a923,924
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
870,875c926,928
< device_printf(sc->dev, "Could not get link speed: %d\n", rc);
< } else {
< /* interpret response */
< bcopy(&fwcmd->params.rsp, link, sizeof(struct link_status));
< link->logical_link_status = LE_32(link->logical_link_status);
< link->qos_link_speed = LE_16(link->qos_link_speed);
---
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
877c930,934
<
---
> /* interpret response */
> bcopy(&fwcmd->params.rsp, link, sizeof(struct link_status));
> link->logical_link_status = LE_32(link->logical_link_status);
> link->qos_link_speed = LE_16(link->qos_link_speed);
> error:
919,923c976,980
< if (rc) {
< device_printf(sc->dev,
< "Could not get nic statistics: %d\n", rc);
< }
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
969,972c1026,1030
< if (rc) {
< device_printf(sc->dev,
< "Could not get nic statistics: %d\n", rc);
< }
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1004c1062
< fwcmd->params.req.port_number = sc->if_id;
---
> fwcmd->params.req.port_number = sc->port_id;
1020,1024c1078,1082
< if (rc != 0) {
< device_printf(sc->dev,
< "Could not get physical port statistics: %d\n", rc);
< }
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1073,1077c1131,1135
< if (rc != 0) {
< device_printf(sc->dev,
< "Could not get physical port statistics: %d\n", rc);
< }
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1118c1176,1180
<
---
> if (!rc)
> rc = req->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1179,1181c1241,1247
< if (rc)
< return rc;
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
> }
1183c1249
<
---
> error:
1212a1279,1283
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1245,1247c1316,1322
< //if (rc != 0) This can fail in legacy mode. So skip
< // FN_LEAVE(rc);
<
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
> }
1250a1326
> error:
1284a1361,1365
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1322a1404,1405
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
1324c1407,1408
< return rc;
---
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1326c1410
< return(fwcmd->params.rsp.status);
---
> return rc;
1365,1369c1449,1453
< if (rc) {
< device_printf(sc->dev, "Write FlashROM mbox post failed\n");
< } else {
< rc = fwcmd->hdr.u0.rsp.status;
< }
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1410a1495,1496
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
1412,1415c1498,1500
< device_printf(sc->dev, "Read FlashROM CRC mbox post failed\n");
< } else {
< bcopy(fwcmd->data_buffer, flash_crc, 4);
< rc = fwcmd->hdr.u0.rsp.status;
---
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
1416a1502,1503
> bcopy(fwcmd->data_buffer, flash_crc, 4);
> error:
1442a1530,1531
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
1444,1455c1533,1535
< device_printf(sc->dev, "Read PHY info mbox post failed\n");
< } else {
< rc = fwcmd->hdr.u0.rsp.status;
< phy_info->phy_type = fwcmd->params.rsp.phy_info.phy_type;
< phy_info->interface_type =
< fwcmd->params.rsp.phy_info.interface_type;
< phy_info->auto_speeds_supported =
< fwcmd->params.rsp.phy_info.auto_speeds_supported;
< phy_info->fixed_speeds_supported =
< fwcmd->params.rsp.phy_info.fixed_speeds_supported;
< phy_info->misc_params =fwcmd->params.rsp.phy_info.misc_params;
<
---
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
1456a1537,1545
> phy_info->phy_type = fwcmd->params.rsp.phy_info.phy_type;
> phy_info->interface_type =
> fwcmd->params.rsp.phy_info.interface_type;
> phy_info->auto_speeds_supported =
> fwcmd->params.rsp.phy_info.auto_speeds_supported;
> phy_info->fixed_speeds_supported =
> fwcmd->params.rsp.phy_info.fixed_speeds_supported;
> phy_info->misc_params =fwcmd->params.rsp.phy_info.misc_params;
> error:
1501a1591,1592
> if (!rc)
> rc = fwcmd->params.rsp.status;
1503,1508c1594,1596
< device_printf(sc->dev,
< "Write Lancer FlashROM mbox post failed\n");
< } else {
< *written_data = fwcmd->params.rsp.actual_write_length;
< *additional_status = fwcmd->params.rsp.additional_status;
< rc = fwcmd->params.rsp.status;
---
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
1509a1598,1600
> *written_data = fwcmd->params.rsp.actual_write_length;
> *additional_status = fwcmd->params.rsp.additional_status;
> error:
1556c1647,1651
< if (rc)
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1558c1653
<
---
> }
1561,1562d1655
<
< return 0;
1564d1656
< device_printf(sc->dev, "Mbox Create RQ failed\n");
1606c1698,1702
< if (rc)
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1608c1704
<
---
> }
1610,1611d1705
<
< return 0;
1613d1706
< device_printf(sc->dev, "Mbox Create WQ failed\n");
1652c1745,1749
< if (rc)
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1654c1751
<
---
> }
1656,1657d1752
<
< return 0;
1659d1753
< device_printf(sc->dev, "Mbox Create EQ failed\n");
1729c1823,1827
< if (rc)
---
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1731c1829
<
---
> }
1732a1831,1832
> error:
> return rc;
1734c1834,1895
< return 0;
---
> }
>
> int
> oce_mbox_read_transrecv_data(POCE_SOFTC sc, uint32_t page_num)
> {
> int rc = 0;
> struct oce_mbx mbx;
> struct mbx_read_common_transrecv_data *fwcmd;
> struct oce_mq_sge *sgl;
> OCE_DMA_MEM dma;
>
> /* Allocate DMA mem*/
> if (oce_dma_alloc(sc, sizeof(struct mbx_read_common_transrecv_data),
> &dma, 0))
> return ENOMEM;
>
> fwcmd = OCE_DMAPTR(&dma, struct mbx_read_common_transrecv_data);
> bzero(fwcmd, sizeof(struct mbx_read_common_transrecv_data));
>
> bzero(&mbx, sizeof(struct oce_mbx));
> mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0,
> MBX_SUBSYSTEM_COMMON,
> OPCODE_COMMON_READ_TRANSRECEIVER_DATA,
> MBX_TIMEOUT_SEC,
> sizeof(struct mbx_read_common_transrecv_data),
> OCE_MBX_VER_V0);
>
> /* fill rest of mbx */
> mbx.u0.s.embedded = 0;
> mbx.payload_length = sizeof(struct mbx_read_common_transrecv_data);
> mbx.u0.s.sge_count = 1;
> sgl = &mbx.payload.u0.u1.sgl[0];
> sgl->pa_hi = htole32(upper_32_bits(dma.paddr));
> sgl->pa_lo = htole32((dma.paddr) & 0xFFFFFFFF);
> sgl->length = htole32(mbx.payload_length);
> DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ);
>
> fwcmd->params.req.port = LE_32(sc->port_id);
> fwcmd->params.req.page_num = LE_32(page_num);
>
> /* command post */
> rc = oce_mbox_post(sc, &mbx, NULL);
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc) {
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
> goto error;
> }
> if(fwcmd->params.rsp.page_num == PAGE_NUM_A0)
> {
> bcopy((char *)fwcmd->params.rsp.page_data,
> (char *)&sfp_vpd_dump_buffer[0],
> TRANSCEIVER_A0_SIZE);
> }
>
> if(fwcmd->params.rsp.page_num == PAGE_NUM_A2)
> {
> bcopy((char *)fwcmd->params.rsp.page_data,
> (char *)&sfp_vpd_dump_buffer[32],
> TRANSCEIVER_A2_SIZE);
> }
1736d1896
< device_printf(sc->dev, "Mbox Create CQ failed\n");
1737a1898
> }
1738a1900,1941
> void
> oce_mbox_eqd_modify_periodic(POCE_SOFTC sc, struct oce_set_eqd *set_eqd,
> int num)
> {
> struct oce_mbx mbx;
> struct mbx_modify_common_eq_delay *fwcmd;
> int rc = 0;
> int i = 0;
>
> bzero(&mbx, sizeof(struct oce_mbx));
>
> /* Initialize MODIFY_EQ_DELAY ioctl header */
> fwcmd = (struct mbx_modify_common_eq_delay *)&mbx.payload;
> mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0,
> MBX_SUBSYSTEM_COMMON,
> OPCODE_COMMON_MODIFY_EQ_DELAY,
> MBX_TIMEOUT_SEC,
> sizeof(struct mbx_modify_common_eq_delay),
> OCE_MBX_VER_V0);
> /* fill rest of mbx */
> mbx.u0.s.embedded = 1;
> mbx.payload_length = sizeof(struct mbx_modify_common_eq_delay);
> DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ);
>
> fwcmd->params.req.num_eq = num;
> for (i = 0; i < num; i++) {
> fwcmd->params.req.delay[i].eq_id =
> htole32(set_eqd[i].eq_id);
> fwcmd->params.req.delay[i].phase = 0;
> fwcmd->params.req.delay[i].dm =
> htole32(set_eqd[i].delay_multiplier);
> }
>
>
> /* command post */
> rc = oce_mbox_post(sc, &mbx, NULL);
>
> if (!rc)
> rc = fwcmd->hdr.u0.rsp.status;
> if (rc)
> device_printf(sc->dev,"%s failed - cmd status: %d\n",
> __FUNCTION__, rc);
1739a1943,1944
>
>