1/*-
2 * Copyright (C) 2012 Emulex
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
--- 22 unchanged lines hidden (view full) ---
33 *
34 * Emulex
35 * 3333 Susan Street
36 * Costa Mesa, CA 92626
37 */
38
39
40
41/* $FreeBSD: head/sys/dev/oce/oce_mbox.c 247880 2013-03-06 09:53:38Z delphij $ */
42
43
44#include "oce_if.h"
45extern uint32_t sfp_vpd_dump_buffer[TRANSCEIVER_DATA_NUM_ELE];
46
47/**
48 * @brief Reset (firmware) common function
49 * @param sc software handle to the device
--- 672 unchanged lines hidden (view full) ---
722 * @param *fwcmd pointer to the rss mbox command
723 * @returns none
724 */
725static int
726oce_rss_itbl_init(POCE_SOFTC sc, struct mbx_config_nic_rss *fwcmd)
727{
728 int i = 0, j = 0, rc = 0;
729 uint8_t *tbl = fwcmd->params.req.cputable;
730
731
732 for (j = 0; j < sc->nrqs; j++) {
733 if (sc->rq[j]->cfg.is_rss_queue) {
734 tbl[i] = sc->rq[j]->rss_cpuid;
735 i = i + 1;
736 }
737 }
738 if (i == 0) {
739 device_printf(sc->dev, "error: Invalid number of RSS RQ's\n");
740 rc = ENXIO;
741
742 }
743
--- 17 unchanged lines hidden (view full) ---
761 int rc;
762 struct oce_mbx mbx;
763 struct mbx_config_nic_rss *fwcmd =
764 (struct mbx_config_nic_rss *)&mbx.payload;
765 int version;
766
767 bzero(&mbx, sizeof(struct oce_mbx));
768
769 if (IS_XE201(sc)) {
770 version = OCE_MBX_VER_V1;
771 fwcmd->params.req.enable_rss = RSS_ENABLE_UDP_IPV4 |
772 RSS_ENABLE_UDP_IPV6;
773 } else
774 version = OCE_MBX_VER_V0;
775
776 mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0,
777 MBX_SUBSYSTEM_NIC,
--- 891 unchanged lines hidden (view full) ---
1669 int rc = 0, version, num_pages;
1670
1671 bzero(&mbx, sizeof(struct oce_mbx));
1672
1673 fwcmd = (struct mbx_create_nic_wq *)&mbx.payload;
1674 if (IS_XE201(sc)) {
1675 version = OCE_MBX_VER_V1;
1676 fwcmd->params.req.if_id = sc->if_id;
1677 } else
1678 version = OCE_MBX_VER_V0;
1679
1680 mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0,
1681 MBX_SUBSYSTEM_NIC,
1682 NIC_CREATE_WQ, MBX_TIMEOUT_SEC,
1683 sizeof(struct mbx_create_nic_wq),
1684 version);
1685
1686 num_pages = oce_page_list(wq->ring, &fwcmd->params.req.pages[0]);
--- 11 unchanged lines hidden (view full) ---
1698 if (!rc)
1699 rc = fwcmd->hdr.u0.rsp.status;
1700 if (rc) {
1701 device_printf(sc->dev,"%s failed - cmd status: %d\n",
1702 __FUNCTION__, rc);
1703 goto error;
1704 }
1705 wq->wq_id = LE_16(fwcmd->params.rsp.wq_id);
1706error:
1707 return rc;
1708
1709}
1710
1711
1712
1713int
--- 155 unchanged lines hidden (view full) ---
1869 DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ);
1870
1871 fwcmd->params.req.port = LE_32(sc->port_id);
1872 fwcmd->params.req.page_num = LE_32(page_num);
1873
1874 /* command post */
1875 rc = oce_mbox_post(sc, &mbx, NULL);
1876 if (!rc)
1877 rc = fwcmd->hdr.u0.rsp.status;
1878 if (rc) {
1879 device_printf(sc->dev,"%s failed - cmd status: %d\n",
1880 __FUNCTION__, rc);
1881 goto error;
1882 }
1883 if(fwcmd->params.rsp.page_num == PAGE_NUM_A0)
1884 {
1885 bcopy((char *)fwcmd->params.rsp.page_data,
1886 (char *)&sfp_vpd_dump_buffer[0],
1887 TRANSCEIVER_A0_SIZE);
1888 }
1889
1890 if(fwcmd->params.rsp.page_num == PAGE_NUM_A2)
1891 {
1892 bcopy((char *)fwcmd->params.rsp.page_data,
1893 (char *)&sfp_vpd_dump_buffer[32],
1894 TRANSCEIVER_A2_SIZE);
1895 }
1896error:
1897 return rc;
1898}
1899
1900void
1901oce_mbox_eqd_modify_periodic(POCE_SOFTC sc, struct oce_set_eqd *set_eqd,
1902 int num)
1903{
1904 struct oce_mbx mbx;
--- 25 unchanged lines hidden (view full) ---
1930 htole32(set_eqd[i].delay_multiplier);
1931 }
1932
1933
1934 /* command post */
1935 rc = oce_mbox_post(sc, &mbx, NULL);
1936
1937 if (!rc)
1938 rc = fwcmd->hdr.u0.rsp.status;
1939 if (rc)
1940 device_printf(sc->dev,"%s failed - cmd status: %d\n",
1941 __FUNCTION__, rc);
1942}
1943
1944
2 * Copyright (C) 2012 Emulex
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
--- 22 unchanged lines hidden (view full) ---
33 *
34 * Emulex
35 * 3333 Susan Street
36 * Costa Mesa, CA 92626
37 */
38
39
40
41/* $FreeBSD: head/sys/dev/oce/oce_mbox.c 247880 2013-03-06 09:53:38Z delphij $ */
42
43
44#include "oce_if.h"
45extern uint32_t sfp_vpd_dump_buffer[TRANSCEIVER_DATA_NUM_ELE];
46
47/**
48 * @brief Reset (firmware) common function
49 * @param sc software handle to the device
--- 672 unchanged lines hidden (view full) ---
722 * @param *fwcmd pointer to the rss mbox command
723 * @returns none
724 */
725static int
726oce_rss_itbl_init(POCE_SOFTC sc, struct mbx_config_nic_rss *fwcmd)
727{
728 int i = 0, j = 0, rc = 0;
729 uint8_t *tbl = fwcmd->params.req.cputable;
730
731
732 for (j = 0; j < sc->nrqs; j++) {
733 if (sc->rq[j]->cfg.is_rss_queue) {
734 tbl[i] = sc->rq[j]->rss_cpuid;
735 i = i + 1;
736 }
737 }
738 if (i == 0) {
739 device_printf(sc->dev, "error: Invalid number of RSS RQ's\n");
740 rc = ENXIO;
741
742 }
743
--- 17 unchanged lines hidden (view full) ---
761 int rc;
762 struct oce_mbx mbx;
763 struct mbx_config_nic_rss *fwcmd =
764 (struct mbx_config_nic_rss *)&mbx.payload;
765 int version;
766
767 bzero(&mbx, sizeof(struct oce_mbx));
768
769 if (IS_XE201(sc)) {
770 version = OCE_MBX_VER_V1;
771 fwcmd->params.req.enable_rss = RSS_ENABLE_UDP_IPV4 |
772 RSS_ENABLE_UDP_IPV6;
773 } else
774 version = OCE_MBX_VER_V0;
775
776 mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0,
777 MBX_SUBSYSTEM_NIC,
--- 891 unchanged lines hidden (view full) ---
1669 int rc = 0, version, num_pages;
1670
1671 bzero(&mbx, sizeof(struct oce_mbx));
1672
1673 fwcmd = (struct mbx_create_nic_wq *)&mbx.payload;
1674 if (IS_XE201(sc)) {
1675 version = OCE_MBX_VER_V1;
1676 fwcmd->params.req.if_id = sc->if_id;
1677 } else
1678 version = OCE_MBX_VER_V0;
1679
1680 mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0,
1681 MBX_SUBSYSTEM_NIC,
1682 NIC_CREATE_WQ, MBX_TIMEOUT_SEC,
1683 sizeof(struct mbx_create_nic_wq),
1684 version);
1685
1686 num_pages = oce_page_list(wq->ring, &fwcmd->params.req.pages[0]);
--- 11 unchanged lines hidden (view full) ---
1698 if (!rc)
1699 rc = fwcmd->hdr.u0.rsp.status;
1700 if (rc) {
1701 device_printf(sc->dev,"%s failed - cmd status: %d\n",
1702 __FUNCTION__, rc);
1703 goto error;
1704 }
1705 wq->wq_id = LE_16(fwcmd->params.rsp.wq_id);
1706error:
1707 return rc;
1708
1709}
1710
1711
1712
1713int
--- 155 unchanged lines hidden (view full) ---
1869 DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ);
1870
1871 fwcmd->params.req.port = LE_32(sc->port_id);
1872 fwcmd->params.req.page_num = LE_32(page_num);
1873
1874 /* command post */
1875 rc = oce_mbox_post(sc, &mbx, NULL);
1876 if (!rc)
1877 rc = fwcmd->hdr.u0.rsp.status;
1878 if (rc) {
1879 device_printf(sc->dev,"%s failed - cmd status: %d\n",
1880 __FUNCTION__, rc);
1881 goto error;
1882 }
1883 if(fwcmd->params.rsp.page_num == PAGE_NUM_A0)
1884 {
1885 bcopy((char *)fwcmd->params.rsp.page_data,
1886 (char *)&sfp_vpd_dump_buffer[0],
1887 TRANSCEIVER_A0_SIZE);
1888 }
1889
1890 if(fwcmd->params.rsp.page_num == PAGE_NUM_A2)
1891 {
1892 bcopy((char *)fwcmd->params.rsp.page_data,
1893 (char *)&sfp_vpd_dump_buffer[32],
1894 TRANSCEIVER_A2_SIZE);
1895 }
1896error:
1897 return rc;
1898}
1899
1900void
1901oce_mbox_eqd_modify_periodic(POCE_SOFTC sc, struct oce_set_eqd *set_eqd,
1902 int num)
1903{
1904 struct oce_mbx mbx;
--- 25 unchanged lines hidden (view full) ---
1930 htole32(set_eqd[i].delay_multiplier);
1931 }
1932
1933
1934 /* command post */
1935 rc = oce_mbox_post(sc, &mbx, NULL);
1936
1937 if (!rc)
1938 rc = fwcmd->hdr.u0.rsp.status;
1939 if (rc)
1940 device_printf(sc->dev,"%s failed - cmd status: %d\n",
1941 __FUNCTION__, rc);
1942}
1943
1944