16f45ec7bSml29623 /*
26f45ec7bSml29623 * CDDL HEADER START
36f45ec7bSml29623 *
46f45ec7bSml29623 * The contents of this file are subject to the terms of the
56f45ec7bSml29623 * Common Development and Distribution License (the "License").
66f45ec7bSml29623 * You may not use this file except in compliance with the License.
76f45ec7bSml29623 *
86f45ec7bSml29623 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96f45ec7bSml29623 * or http://www.opensolaris.org/os/licensing.
106f45ec7bSml29623 * See the License for the specific language governing permissions
116f45ec7bSml29623 * and limitations under the License.
126f45ec7bSml29623 *
136f45ec7bSml29623 * When distributing Covered Code, include this CDDL HEADER in each
146f45ec7bSml29623 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156f45ec7bSml29623 * If applicable, add the following below this CDDL HEADER, with the
166f45ec7bSml29623 * fields enclosed by brackets "[]" replaced with your own identifying
176f45ec7bSml29623 * information: Portions Copyright [yyyy] [name of copyright owner]
186f45ec7bSml29623 *
196f45ec7bSml29623 * CDDL HEADER END
206f45ec7bSml29623 */
216f45ec7bSml29623 /*
227b26d9ffSSantwona Behera * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
236f45ec7bSml29623 * Use is subject to license terms.
246f45ec7bSml29623 */
256f45ec7bSml29623
266f45ec7bSml29623 #include <sys/nxge/nxge_impl.h>
27678453a8Sspeer #include <sys/nxge/nxge_hio.h>
28678453a8Sspeer
296f45ec7bSml29623 #include <inet/common.h>
306f45ec7bSml29623 #include <inet/mi.h>
316f45ec7bSml29623 #include <inet/nd.h>
326f45ec7bSml29623
336f45ec7bSml29623 extern uint64_t npi_debug_level;
346f45ec7bSml29623
356f45ec7bSml29623 #define NXGE_PARAM_MAC_RW \
366f45ec7bSml29623 NXGE_PARAM_RW | NXGE_PARAM_MAC | \
376f45ec7bSml29623 NXGE_PARAM_NDD_WR_OK | NXGE_PARAM_READ_PROP
386f45ec7bSml29623
396f45ec7bSml29623 #define NXGE_PARAM_MAC_DONT_SHOW \
406f45ec7bSml29623 NXGE_PARAM_RW | NXGE_PARAM_MAC | NXGE_PARAM_DONT_SHOW
416f45ec7bSml29623
426f45ec7bSml29623 #define NXGE_PARAM_RXDMA_RW \
436f45ec7bSml29623 NXGE_PARAM_RWP | NXGE_PARAM_RXDMA | NXGE_PARAM_NDD_WR_OK | \
446f45ec7bSml29623 NXGE_PARAM_READ_PROP
456f45ec7bSml29623
466f45ec7bSml29623 #define NXGE_PARAM_RXDMA_RWC \
476f45ec7bSml29623 NXGE_PARAM_RWP | NXGE_PARAM_RXDMA | NXGE_PARAM_INIT_ONLY | \
486f45ec7bSml29623 NXGE_PARAM_READ_PROP
496f45ec7bSml29623
506f45ec7bSml29623 #define NXGE_PARAM_L2CLASS_CFG \
516f45ec7bSml29623 NXGE_PARAM_RW | NXGE_PARAM_PROP_ARR32 | NXGE_PARAM_READ_PROP | \
526f45ec7bSml29623 NXGE_PARAM_NDD_WR_OK
536f45ec7bSml29623
546f45ec7bSml29623 #define NXGE_PARAM_CLASS_RWS \
556f45ec7bSml29623 NXGE_PARAM_RWS | NXGE_PARAM_READ_PROP
566f45ec7bSml29623
576f45ec7bSml29623 #define NXGE_PARAM_ARRAY_INIT_SIZE 0x20ULL
586f45ec7bSml29623
596f45ec7bSml29623 #define SET_RX_INTR_TIME_DISABLE 0
606f45ec7bSml29623 #define SET_RX_INTR_TIME_ENABLE 1
616f45ec7bSml29623 #define SET_RX_INTR_PKTS 2
626f45ec7bSml29623
636f45ec7bSml29623 #define BASE_ANY 0
646f45ec7bSml29623 #define BASE_BINARY 2
656f45ec7bSml29623 #define BASE_HEX 16
666f45ec7bSml29623 #define BASE_DECIMAL 10
676f45ec7bSml29623 #define ALL_FF_64 0xFFFFFFFFFFFFFFFFULL
686f45ec7bSml29623 #define ALL_FF_32 0xFFFFFFFFUL
696f45ec7bSml29623
706f45ec7bSml29623 #define NXGE_NDD_INFODUMP_BUFF_SIZE 2048 /* is 2k enough? */
716f45ec7bSml29623 #define NXGE_NDD_INFODUMP_BUFF_8K 8192
726f45ec7bSml29623 #define NXGE_NDD_INFODUMP_BUFF_16K 0x2000
736f45ec7bSml29623 #define NXGE_NDD_INFODUMP_BUFF_64K 0x8000
746f45ec7bSml29623
756f45ec7bSml29623 #define PARAM_OUTOF_RANGE(vptr, eptr, rval, pa) \
766f45ec7bSml29623 ((vptr == eptr) || (rval < pa->minimum) || (rval > pa->maximum))
776f45ec7bSml29623
786f45ec7bSml29623 #define ADVANCE_PRINT_BUFFER(pmp, plen, rlen) { \
796f45ec7bSml29623 ((mblk_t *)pmp)->b_wptr += plen; \
806f45ec7bSml29623 rlen -= plen; \
816f45ec7bSml29623 }
826f45ec7bSml29623
834045d941Ssowmini int nxge_param_set_mac(p_nxge_t, queue_t *,
846f45ec7bSml29623 mblk_t *, char *, caddr_t);
856f45ec7bSml29623 static int nxge_param_set_port_rdc(p_nxge_t, queue_t *,
866f45ec7bSml29623 mblk_t *, char *, caddr_t);
876f45ec7bSml29623 static int nxge_param_set_grp_rdc(p_nxge_t, queue_t *,
886f45ec7bSml29623 mblk_t *, char *, caddr_t);
896f45ec7bSml29623 static int nxge_param_set_ether_usr(p_nxge_t,
906f45ec7bSml29623 queue_t *, mblk_t *, char *, caddr_t);
916f45ec7bSml29623 static int nxge_param_set_ip_usr(p_nxge_t,
926f45ec7bSml29623 queue_t *, mblk_t *, char *, caddr_t);
936f45ec7bSml29623 static int nxge_param_set_vlan_rdcgrp(p_nxge_t,
946f45ec7bSml29623 queue_t *, mblk_t *, char *, caddr_t);
956f45ec7bSml29623 static int nxge_param_set_mac_rdcgrp(p_nxge_t,
966f45ec7bSml29623 queue_t *, mblk_t *, char *, caddr_t);
976f45ec7bSml29623 static int nxge_param_fflp_hash_init(p_nxge_t,
986f45ec7bSml29623 queue_t *, mblk_t *, char *, caddr_t);
996f45ec7bSml29623 static int nxge_param_llc_snap_enable(p_nxge_t, queue_t *,
1006f45ec7bSml29623 mblk_t *, char *, caddr_t);
1016f45ec7bSml29623 static int nxge_param_hash_lookup_enable(p_nxge_t, queue_t *,
1026f45ec7bSml29623 mblk_t *, char *, caddr_t);
1036f45ec7bSml29623 static int nxge_param_tcam_enable(p_nxge_t, queue_t *,
1046f45ec7bSml29623 mblk_t *, char *, caddr_t);
10556d930aeSspeer static int nxge_param_get_fw_ver(p_nxge_t, queue_t *, p_mblk_t, caddr_t);
1062e59129aSraghus static int nxge_param_get_port_mode(p_nxge_t, queue_t *, p_mblk_t, caddr_t);
1076f45ec7bSml29623 static int nxge_param_get_rxdma_info(p_nxge_t, queue_t *q,
1086f45ec7bSml29623 p_mblk_t, caddr_t);
1096f45ec7bSml29623 static int nxge_param_get_txdma_info(p_nxge_t, queue_t *q,
1106f45ec7bSml29623 p_mblk_t, caddr_t);
1116f45ec7bSml29623 static int nxge_param_get_vlan_rdcgrp(p_nxge_t, queue_t *,
1126f45ec7bSml29623 p_mblk_t, caddr_t);
1136f45ec7bSml29623 static int nxge_param_get_mac_rdcgrp(p_nxge_t, queue_t *,
1146f45ec7bSml29623 p_mblk_t, caddr_t);
1156f45ec7bSml29623 static int nxge_param_get_rxdma_rdcgrp_info(p_nxge_t, queue_t *,
1166f45ec7bSml29623 p_mblk_t, caddr_t);
117*c1f9c6e5SSantwona Behera static int nxge_param_get_rx_intr_time(p_nxge_t, queue_t *, p_mblk_t, caddr_t);
118*c1f9c6e5SSantwona Behera static int nxge_param_get_rx_intr_pkts(p_nxge_t, queue_t *, p_mblk_t, caddr_t);
1196f45ec7bSml29623 static int nxge_param_get_ip_opt(p_nxge_t, queue_t *, mblk_t *, caddr_t);
1206f45ec7bSml29623 static int nxge_param_get_mac(p_nxge_t, queue_t *q, p_mblk_t, caddr_t);
1216f45ec7bSml29623 static int nxge_param_get_debug_flag(p_nxge_t, queue_t *, p_mblk_t, caddr_t);
1226f45ec7bSml29623 static int nxge_param_set_nxge_debug_flag(p_nxge_t, queue_t *, mblk_t *,
1236f45ec7bSml29623 char *, caddr_t);
1246f45ec7bSml29623 static int nxge_param_set_npi_debug_flag(p_nxge_t,
1256f45ec7bSml29623 queue_t *, mblk_t *, char *, caddr_t);
1266f45ec7bSml29623 static int nxge_param_dump_rdc(p_nxge_t, queue_t *q, p_mblk_t, caddr_t);
1276f45ec7bSml29623 static int nxge_param_dump_tdc(p_nxge_t, queue_t *q, p_mblk_t, caddr_t);
1286f45ec7bSml29623 static int nxge_param_dump_mac_regs(p_nxge_t, queue_t *, p_mblk_t, caddr_t);
1296f45ec7bSml29623 static int nxge_param_dump_ipp_regs(p_nxge_t, queue_t *, p_mblk_t, caddr_t);
1306f45ec7bSml29623 static int nxge_param_dump_fflp_regs(p_nxge_t, queue_t *, p_mblk_t, caddr_t);
1316f45ec7bSml29623 static int nxge_param_dump_vlan_table(p_nxge_t, queue_t *, p_mblk_t, caddr_t);
1326f45ec7bSml29623 static int nxge_param_dump_rdc_table(p_nxge_t, queue_t *, p_mblk_t, caddr_t);
1336f45ec7bSml29623 static int nxge_param_dump_ptrs(p_nxge_t, queue_t *, p_mblk_t, caddr_t);
1341bd6825cSml29623 static void nxge_param_sync(p_nxge_t);
1356f45ec7bSml29623
1366f45ec7bSml29623 /*
1376f45ec7bSml29623 * Global array of Neptune changable parameters.
1386f45ec7bSml29623 * This array is initialized to correspond to the default
1396f45ec7bSml29623 * Neptune 4 port configuration. This array would be copied
1406f45ec7bSml29623 * into each port's parameter structure and modifed per
1416f45ec7bSml29623 * fcode and nxge.conf configuration. Later, the parameters are
1426f45ec7bSml29623 * exported to ndd to display and run-time configuration (at least
1436f45ec7bSml29623 * some of them).
1446f45ec7bSml29623 *
14500161856Syc148097 * Parameters with DONT_SHOW are not shown by ndd.
14600161856Syc148097 *
1476f45ec7bSml29623 */
1486f45ec7bSml29623
1496f45ec7bSml29623 static nxge_param_t nxge_param_arr[] = {
1506f45ec7bSml29623 /*
1516f45ec7bSml29623 * min max value old hw-name conf-name
1526f45ec7bSml29623 */
153846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_DONT_SHOW,
1546f45ec7bSml29623 0, 999, 1000, 0, "instance", "instance"},
1556f45ec7bSml29623
156846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_DONT_SHOW,
1576f45ec7bSml29623 0, 999, 1000, 0, "main-instance", "main_instance"},
1586f45ec7bSml29623
1596f45ec7bSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_READ,
1606f45ec7bSml29623 0, 3, 0, 0, "function-number", "function_number"},
1616f45ec7bSml29623
1626f45ec7bSml29623 /* Partition Id */
163846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_DONT_SHOW,
1646f45ec7bSml29623 0, 8, 0, 0, "partition-id", "partition_id"},
1656f45ec7bSml29623
1666f45ec7bSml29623 /* Read Write Permission Mode */
167846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_DONT_SHOW,
1686f45ec7bSml29623 0, 2, 0, 0, "read-write-mode", "read_write_mode"},
1696f45ec7bSml29623
17056d930aeSspeer { nxge_param_get_fw_ver, NULL, NXGE_PARAM_READ,
17156d930aeSspeer 0, 32, 0, 0, "version", "fw_version"},
17256d930aeSspeer
1732e59129aSraghus { nxge_param_get_port_mode, NULL, NXGE_PARAM_READ,
1742e59129aSraghus 0, 32, 0, 0, "port-mode", "port_mode"},
1752e59129aSraghus
1766f45ec7bSml29623 /* hw cfg types */
1776f45ec7bSml29623 /* control the DMA config of Neptune/NIU */
178846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_DONT_SHOW,
1796f45ec7bSml29623 CFG_DEFAULT, CFG_CUSTOM, CFG_DEFAULT, CFG_DEFAULT,
1806f45ec7bSml29623 "niu-cfg-type", "niu_cfg_type"},
1816f45ec7bSml29623
1826f45ec7bSml29623 /* control the TXDMA config of the Port controlled by tx-quick-cfg */
183846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_DONT_SHOW,
1846f45ec7bSml29623 CFG_DEFAULT, CFG_CUSTOM, CFG_NOT_SPECIFIED, CFG_DEFAULT,
1856f45ec7bSml29623 "tx-qcfg-type", "tx_qcfg_type"},
1866f45ec7bSml29623
1876f45ec7bSml29623 /* control the RXDMA config of the Port controlled by rx-quick-cfg */
188846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_DONT_SHOW,
1896f45ec7bSml29623 CFG_DEFAULT, CFG_CUSTOM, CFG_NOT_SPECIFIED, CFG_DEFAULT,
1906f45ec7bSml29623 "rx-qcfg-type", "rx_qcfg_type"},
1916f45ec7bSml29623
1926f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac,
1936f45ec7bSml29623 NXGE_PARAM_RW | NXGE_PARAM_DONT_SHOW,
1946f45ec7bSml29623 0, 1, 0, 0, "master-cfg-enable", "master_cfg_enable"},
1956f45ec7bSml29623
1966f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac,
197846a903dSml29623 NXGE_PARAM_DONT_SHOW,
1986f45ec7bSml29623 0, 1, 0, 0, "master-cfg-value", "master_cfg_value"},
1996f45ec7bSml29623
2006f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_MAC_RW,
2016f45ec7bSml29623 0, 1, 1, 1, "adv-autoneg-cap", "adv_autoneg_cap"},
2026f45ec7bSml29623
2036f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_MAC_RW,
2046f45ec7bSml29623 0, 1, 1, 1, "adv-10gfdx-cap", "adv_10gfdx_cap"},
2056f45ec7bSml29623
2066f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_MAC_DONT_SHOW,
2076f45ec7bSml29623 0, 1, 0, 0, "adv-10ghdx-cap", "adv_10ghdx_cap"},
2086f45ec7bSml29623
2096f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_MAC_RW,
2106f45ec7bSml29623 0, 1, 1, 1, "adv-1000fdx-cap", "adv_1000fdx_cap"},
2116f45ec7bSml29623
2126f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_MAC_DONT_SHOW,
2136f45ec7bSml29623 0, 1, 0, 0, "adv-1000hdx-cap", "adv_1000hdx_cap"},
2146f45ec7bSml29623
2156f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_MAC_DONT_SHOW,
2166f45ec7bSml29623 0, 1, 0, 0, "adv-100T4-cap", "adv_100T4_cap"},
2176f45ec7bSml29623
2186f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_MAC_RW,
2196f45ec7bSml29623 0, 1, 1, 1, "adv-100fdx-cap", "adv_100fdx_cap"},
2206f45ec7bSml29623
2216f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_MAC_DONT_SHOW,
2226f45ec7bSml29623 0, 1, 0, 0, "adv-100hdx-cap", "adv_100hdx_cap"},
2236f45ec7bSml29623
2246f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_MAC_RW,
2256f45ec7bSml29623 0, 1, 1, 1, "adv-10fdx-cap", "adv_10fdx_cap"},
2266f45ec7bSml29623
2276f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_MAC_DONT_SHOW,
2286f45ec7bSml29623 0, 1, 0, 0, "adv-10hdx-cap", "adv_10hdx_cap"},
2296f45ec7bSml29623
230846a903dSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_DONT_SHOW,
2316f45ec7bSml29623 0, 1, 0, 0, "adv-asmpause-cap", "adv_asmpause_cap"},
2326f45ec7bSml29623
2336f45ec7bSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_MAC_RW,
2346f45ec7bSml29623 0, 1, 0, 0, "adv-pause-cap", "adv_pause_cap"},
2356f45ec7bSml29623
236846a903dSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_DONT_SHOW,
2376f45ec7bSml29623 0, 1, 0, 0, "use-int-xcvr", "use_int_xcvr"},
2386f45ec7bSml29623
239846a903dSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_DONT_SHOW,
2406f45ec7bSml29623 0, 1, 1, 1, "enable-ipg0", "enable_ipg0"},
2416f45ec7bSml29623
242846a903dSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_DONT_SHOW,
2436f45ec7bSml29623 0, 255, 8, 8, "ipg0", "ipg0"},
2446f45ec7bSml29623
245846a903dSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_DONT_SHOW,
2466f45ec7bSml29623 0, 255, 8, 8, "ipg1", "ipg1"},
2476f45ec7bSml29623
248846a903dSml29623 { nxge_param_get_mac, nxge_param_set_mac, NXGE_PARAM_DONT_SHOW,
2496f45ec7bSml29623 0, 255, 4, 4, "ipg2", "ipg2"},
2506f45ec7bSml29623
2516f45ec7bSml29623 /* Transmit DMA channels */
252846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_READ |
253846a903dSml29623 NXGE_PARAM_READ_PROP | NXGE_PARAM_DONT_SHOW,
2546f45ec7bSml29623 0, 3, 0, 0, "tx-dma-weight", "tx_dma_weight"},
2556f45ec7bSml29623
256846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_READ |
257846a903dSml29623 NXGE_PARAM_READ_PROP | NXGE_PARAM_DONT_SHOW,
2586f45ec7bSml29623 0, 31, 0, 0, "tx-dma-channels-begin", "tx_dma_channels_begin"},
2596f45ec7bSml29623
260846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_READ |
261846a903dSml29623 NXGE_PARAM_READ_PROP | NXGE_PARAM_DONT_SHOW,
2626f45ec7bSml29623 0, 32, 0, 0, "tx-dma-channels", "tx_dma_channels"},
2636f45ec7bSml29623 { nxge_param_get_txdma_info, NULL,
264846a903dSml29623 NXGE_PARAM_READ | NXGE_PARAM_READ_PROP | NXGE_PARAM_DONT_SHOW,
2656f45ec7bSml29623 0, 32, 0, 0, "tx-dma-info", "tx_dma_info"},
2666f45ec7bSml29623
2676f45ec7bSml29623 /* Receive DMA channels */
2686f45ec7bSml29623 { nxge_param_get_generic, NULL,
269846a903dSml29623 NXGE_PARAM_READ | NXGE_PARAM_READ_PROP | NXGE_PARAM_DONT_SHOW,
2706f45ec7bSml29623 0, 31, 0, 0, "rx-dma-channels-begin", "rx_dma_channels_begin"},
2716f45ec7bSml29623
272846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_READ |
273846a903dSml29623 NXGE_PARAM_READ_PROP | NXGE_PARAM_DONT_SHOW,
2746f45ec7bSml29623 0, 32, 0, 0, "rx-dma-channels", "rx_dma_channels"},
2756f45ec7bSml29623
276846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_READ |
277846a903dSml29623 NXGE_PARAM_READ_PROP | NXGE_PARAM_DONT_SHOW,
2786f45ec7bSml29623 0, 65535, PT_DRR_WT_DEFAULT_10G, 0,
2796f45ec7bSml29623 "rx-drr-weight", "rx_drr_weight"},
2806f45ec7bSml29623
281846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_READ |
282846a903dSml29623 NXGE_PARAM_READ_PROP | NXGE_PARAM_DONT_SHOW,
2836f45ec7bSml29623 0, 1, 1, 0, "rx-full-header", "rx_full_header"},
2846f45ec7bSml29623
285846a903dSml29623 { nxge_param_get_rxdma_info, NULL, NXGE_PARAM_READ |
286846a903dSml29623 NXGE_PARAM_DONT_SHOW,
2876f45ec7bSml29623 0, 32, 0, 0, "rx-dma-info", "rx_dma_info"},
2886f45ec7bSml29623
2896f45ec7bSml29623 { nxge_param_get_rxdma_info, NULL,
2906f45ec7bSml29623 NXGE_PARAM_READ | NXGE_PARAM_DONT_SHOW,
2916f45ec7bSml29623 NXGE_RBR_RBB_MIN, NXGE_RBR_RBB_MAX, NXGE_RBR_RBB_DEFAULT, 0,
2926f45ec7bSml29623 "rx-rbr-size", "rx_rbr_size"},
2936f45ec7bSml29623
2946f45ec7bSml29623 { nxge_param_get_rxdma_info, NULL,
2956f45ec7bSml29623 NXGE_PARAM_READ | NXGE_PARAM_DONT_SHOW,
2966f45ec7bSml29623 NXGE_RCR_MIN, NXGE_RCR_MAX, NXGE_RCR_DEFAULT, 0,
2976f45ec7bSml29623 "rx-rcr-size", "rx_rcr_size"},
2986f45ec7bSml29623
299846a903dSml29623 { nxge_param_get_generic, nxge_param_set_port_rdc,
300846a903dSml29623 NXGE_PARAM_RXDMA_RW | NXGE_PARAM_DONT_SHOW,
3016f45ec7bSml29623 0, 15, 0, 0, "default-port-rdc", "default_port_rdc"},
3026f45ec7bSml29623
303*c1f9c6e5SSantwona Behera { nxge_param_get_rx_intr_time, nxge_param_rx_intr_time,
304*c1f9c6e5SSantwona Behera NXGE_PARAM_RXDMA_RW,
3056f45ec7bSml29623 NXGE_RDC_RCR_TIMEOUT_MIN, NXGE_RDC_RCR_TIMEOUT_MAX,
3067b26d9ffSSantwona Behera NXGE_RDC_RCR_TIMEOUT, 0, "rxdma-intr-time", "rxdma_intr_time"},
3076f45ec7bSml29623
308*c1f9c6e5SSantwona Behera { nxge_param_get_rx_intr_pkts, nxge_param_rx_intr_pkts,
309*c1f9c6e5SSantwona Behera NXGE_PARAM_RXDMA_RW,
3106f45ec7bSml29623 NXGE_RDC_RCR_THRESHOLD_MIN, NXGE_RDC_RCR_THRESHOLD_MAX,
3117b26d9ffSSantwona Behera NXGE_RDC_RCR_THRESHOLD, 0,
3126f45ec7bSml29623 "rxdma-intr-pkts", "rxdma_intr_pkts"},
3136f45ec7bSml29623
314846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_READ_PROP |
315846a903dSml29623 NXGE_PARAM_DONT_SHOW,
3166f45ec7bSml29623 0, 8, 0, 0, "rx-rdc-grps-begin", "rx_rdc_grps_begin"},
3176f45ec7bSml29623
318846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_READ_PROP |
319846a903dSml29623 NXGE_PARAM_DONT_SHOW,
3206f45ec7bSml29623 0, 8, 0, 0, "rx-rdc-grps", "rx_rdc_grps"},
3216f45ec7bSml29623
322846a903dSml29623 { nxge_param_get_generic, nxge_param_set_grp_rdc,
323846a903dSml29623 NXGE_PARAM_RXDMA_RW | NXGE_PARAM_DONT_SHOW,
3246f45ec7bSml29623 0, 15, 0, 0, "default-grp0-rdc", "default_grp0_rdc"},
3256f45ec7bSml29623
326846a903dSml29623 { nxge_param_get_generic, nxge_param_set_grp_rdc,
327846a903dSml29623 NXGE_PARAM_RXDMA_RW | NXGE_PARAM_DONT_SHOW,
3286f45ec7bSml29623 0, 15, 2, 0, "default-grp1-rdc", "default_grp1_rdc"},
3296f45ec7bSml29623
330846a903dSml29623 { nxge_param_get_generic, nxge_param_set_grp_rdc,
331846a903dSml29623 NXGE_PARAM_RXDMA_RW | NXGE_PARAM_DONT_SHOW,
3326f45ec7bSml29623 0, 15, 4, 0, "default-grp2-rdc", "default_grp2_rdc"},
3336f45ec7bSml29623
334846a903dSml29623 { nxge_param_get_generic, nxge_param_set_grp_rdc,
335846a903dSml29623 NXGE_PARAM_RXDMA_RW | NXGE_PARAM_DONT_SHOW,
3366f45ec7bSml29623 0, 15, 6, 0, "default-grp3-rdc", "default_grp3_rdc"},
3376f45ec7bSml29623
338846a903dSml29623 { nxge_param_get_generic, nxge_param_set_grp_rdc,
339846a903dSml29623 NXGE_PARAM_RXDMA_RW | NXGE_PARAM_DONT_SHOW,
3406f45ec7bSml29623 0, 15, 8, 0, "default-grp4-rdc", "default_grp4_rdc"},
3416f45ec7bSml29623
342846a903dSml29623 { nxge_param_get_generic, nxge_param_set_grp_rdc,
343846a903dSml29623 NXGE_PARAM_RXDMA_RW | NXGE_PARAM_DONT_SHOW,
3446f45ec7bSml29623 0, 15, 10, 0, "default-grp5-rdc", "default_grp5_rdc"},
3456f45ec7bSml29623
346846a903dSml29623 { nxge_param_get_generic, nxge_param_set_grp_rdc,
347846a903dSml29623 NXGE_PARAM_RXDMA_RW | NXGE_PARAM_DONT_SHOW,
3486f45ec7bSml29623 0, 15, 12, 0, "default-grp6-rdc", "default_grp6_rdc"},
3496f45ec7bSml29623
350846a903dSml29623 { nxge_param_get_generic, nxge_param_set_grp_rdc,
351846a903dSml29623 NXGE_PARAM_RXDMA_RW | NXGE_PARAM_DONT_SHOW,
3526f45ec7bSml29623 0, 15, 14, 0, "default-grp7-rdc", "default_grp7_rdc"},
3536f45ec7bSml29623
3546f45ec7bSml29623 { nxge_param_get_rxdma_rdcgrp_info, NULL,
355846a903dSml29623 NXGE_PARAM_READ | NXGE_PARAM_CMPLX | NXGE_PARAM_DONT_SHOW,
3566f45ec7bSml29623 0, 8, 0, 0, "rdc-groups-info", "rdc_groups_info"},
3576f45ec7bSml29623
3586f45ec7bSml29623 /* Logical device groups */
359846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_READ | NXGE_PARAM_DONT_SHOW,
3606f45ec7bSml29623 0, 63, 0, 0, "start-ldg", "start_ldg"},
3616f45ec7bSml29623
362846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_READ | NXGE_PARAM_DONT_SHOW,
3636f45ec7bSml29623 0, 64, 0, 0, "max-ldg", "max_ldg" },
3646f45ec7bSml29623
3656f45ec7bSml29623 /* MAC table information */
3666f45ec7bSml29623 { nxge_param_get_mac_rdcgrp, nxge_param_set_mac_rdcgrp,
367846a903dSml29623 NXGE_PARAM_L2CLASS_CFG | NXGE_PARAM_DONT_SHOW,
3686f45ec7bSml29623 0, 31, 0, 0, "mac-2rdc-grp", "mac_2rdc_grp"},
3696f45ec7bSml29623
3706f45ec7bSml29623 /* VLAN table information */
3716f45ec7bSml29623 { nxge_param_get_vlan_rdcgrp, nxge_param_set_vlan_rdcgrp,
372846a903dSml29623 NXGE_PARAM_L2CLASS_CFG | NXGE_PARAM_DONT_SHOW,
3736f45ec7bSml29623 0, 31, 0, 0, "vlan-2rdc-grp", "vlan_2rdc_grp"},
3746f45ec7bSml29623
3756f45ec7bSml29623 { nxge_param_get_generic, NULL,
376846a903dSml29623 NXGE_PARAM_READ_PROP | NXGE_PARAM_READ |
377846a903dSml29623 NXGE_PARAM_PROP_ARR32 | NXGE_PARAM_DONT_SHOW,
3786f45ec7bSml29623 0, 0x0ffff, 0x0ffff, 0, "fcram-part-cfg", "fcram_part_cfg"},
3796f45ec7bSml29623
380846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_CLASS_RWS |
381846a903dSml29623 NXGE_PARAM_DONT_SHOW,
3826f45ec7bSml29623 0, 0x10, 0xa, 0, "fcram-access-ratio", "fcram_access_ratio"},
3836f45ec7bSml29623
384846a903dSml29623 { nxge_param_get_generic, NULL, NXGE_PARAM_CLASS_RWS |
385846a903dSml29623 NXGE_PARAM_DONT_SHOW,
3866f45ec7bSml29623 0, 0x10, 0xa, 0, "tcam-access-ratio", "tcam_access_ratio"},
3876f45ec7bSml29623
3886f45ec7bSml29623 { nxge_param_get_generic, nxge_param_tcam_enable,
389846a903dSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
3906f45ec7bSml29623 0, 0x1, 0x0, 0, "tcam-enable", "tcam_enable"},
3916f45ec7bSml29623
3926f45ec7bSml29623 { nxge_param_get_generic, nxge_param_hash_lookup_enable,
393846a903dSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
3946f45ec7bSml29623 0, 0x01, 0x0, 0, "hash-lookup-enable", "hash_lookup_enable"},
3956f45ec7bSml29623
3966f45ec7bSml29623 { nxge_param_get_generic, nxge_param_llc_snap_enable,
397846a903dSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
3986f45ec7bSml29623 0, 0x01, 0x01, 0, "llc-snap-enable", "llc_snap_enable"},
3996f45ec7bSml29623
4006f45ec7bSml29623 { nxge_param_get_generic, nxge_param_fflp_hash_init,
401846a903dSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4026f45ec7bSml29623 0, ALL_FF_32, ALL_FF_32, 0, "h1-init-value", "h1_init_value"},
4036f45ec7bSml29623
4046f45ec7bSml29623 { nxge_param_get_generic, nxge_param_fflp_hash_init,
405846a903dSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4066f45ec7bSml29623 0, 0x0ffff, 0x0ffff, 0, "h2-init-value", "h2_init_value"},
4076f45ec7bSml29623
4086f45ec7bSml29623 { nxge_param_get_generic, nxge_param_set_ether_usr,
4096f45ec7bSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4106f45ec7bSml29623 0, ALL_FF_32, 0x0, 0,
4116f45ec7bSml29623 "class-cfg-ether-usr1", "class_cfg_ether_usr1"},
4126f45ec7bSml29623
4136f45ec7bSml29623 { nxge_param_get_generic, nxge_param_set_ether_usr,
4146f45ec7bSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4156f45ec7bSml29623 0, ALL_FF_32, 0x0, 0,
4166f45ec7bSml29623 "class-cfg-ether-usr2", "class_cfg_ether_usr2"},
4176f45ec7bSml29623
4186f45ec7bSml29623 { nxge_param_get_generic, nxge_param_set_ip_usr,
4196f45ec7bSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4206f45ec7bSml29623 0, ALL_FF_32, 0x0, 0,
4216f45ec7bSml29623 "class-cfg-ip-usr4", "class_cfg_ip_usr4"},
4226f45ec7bSml29623
4236f45ec7bSml29623 { nxge_param_get_generic, nxge_param_set_ip_usr,
4246f45ec7bSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4256f45ec7bSml29623 0, ALL_FF_32, 0x0, 0,
4266f45ec7bSml29623 "class-cfg-ip-usr5", "class_cfg_ip_usr5"},
4276f45ec7bSml29623
4286f45ec7bSml29623 { nxge_param_get_generic, nxge_param_set_ip_usr,
4296f45ec7bSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4306f45ec7bSml29623 0, ALL_FF_32, 0x0, 0,
4316f45ec7bSml29623 "class-cfg-ip-usr6", "class_cfg_ip_usr6"},
4326f45ec7bSml29623
4336f45ec7bSml29623 { nxge_param_get_generic, nxge_param_set_ip_usr,
4346f45ec7bSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4356f45ec7bSml29623 0, ALL_FF_32, 0x0, 0,
4366f45ec7bSml29623 "class-cfg-ip-usr7", "class_cfg_ip_usr7"},
4376f45ec7bSml29623
4386f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt,
4396f45ec7bSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4406f45ec7bSml29623 0, ALL_FF_32, 0x0, 0,
4416f45ec7bSml29623 "class-opt-ip-usr4", "class_opt_ip_usr4"},
4426f45ec7bSml29623
4436f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt,
4446f45ec7bSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4456f45ec7bSml29623 0, ALL_FF_32, 0x0, 0,
4466f45ec7bSml29623 "class-opt-ip-usr5", "class_opt_ip_usr5"},
4476f45ec7bSml29623
4486f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt,
4496f45ec7bSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4506f45ec7bSml29623 0, ALL_FF_32, 0x0, 0,
4516f45ec7bSml29623 "class-opt-ip-usr6", "class_opt_ip_usr6"},
4526f45ec7bSml29623
4536f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt,
4546f45ec7bSml29623 NXGE_PARAM_CLASS_RWS | NXGE_PARAM_DONT_SHOW,
4556f45ec7bSml29623 0, ALL_FF_32, 0x0, 0,
4566f45ec7bSml29623 "class-opt-ip-usr7", "class_opt_ip_usr7"},
4576f45ec7bSml29623
4586f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt,
4596f45ec7bSml29623 NXGE_PARAM_CLASS_RWS,
4606f45ec7bSml29623 0, ALL_FF_32, NXGE_CLASS_FLOW_GEN_SERVER, 0,
4616f45ec7bSml29623 "class-opt-ipv4-tcp", "class_opt_ipv4_tcp"},
4626f45ec7bSml29623
4636f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt,
4646f45ec7bSml29623 NXGE_PARAM_CLASS_RWS,
4656f45ec7bSml29623 0, ALL_FF_32, NXGE_CLASS_FLOW_GEN_SERVER, 0,
4666f45ec7bSml29623 "class-opt-ipv4-udp", "class_opt_ipv4_udp"},
4676f45ec7bSml29623
4686f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt,
4696f45ec7bSml29623 NXGE_PARAM_CLASS_RWS,
4706f45ec7bSml29623 0, ALL_FF_32, NXGE_CLASS_FLOW_GEN_SERVER, 0,
4716f45ec7bSml29623 "class-opt-ipv4-ah", "class_opt_ipv4_ah"},
4726f45ec7bSml29623
4736f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt,
4746f45ec7bSml29623 NXGE_PARAM_CLASS_RWS,
4756f45ec7bSml29623 0, ALL_FF_32, NXGE_CLASS_FLOW_GEN_SERVER, 0,
4766f45ec7bSml29623 "class-opt-ipv4-sctp", "class_opt_ipv4_sctp"},
4776f45ec7bSml29623
4786f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt, NXGE_PARAM_CLASS_RWS,
4796f45ec7bSml29623 0, ALL_FF_32, NXGE_CLASS_FLOW_GEN_SERVER, 0,
4806f45ec7bSml29623 "class-opt-ipv6-tcp", "class_opt_ipv6_tcp"},
4816f45ec7bSml29623
4826f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt, NXGE_PARAM_CLASS_RWS,
4836f45ec7bSml29623 0, ALL_FF_32, NXGE_CLASS_FLOW_GEN_SERVER, 0,
4846f45ec7bSml29623 "class-opt-ipv6-udp", "class_opt_ipv6_udp"},
4856f45ec7bSml29623
4866f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt, NXGE_PARAM_CLASS_RWS,
4876f45ec7bSml29623 0, ALL_FF_32, NXGE_CLASS_FLOW_GEN_SERVER, 0,
4886f45ec7bSml29623 "class-opt-ipv6-ah", "class_opt_ipv6_ah"},
4896f45ec7bSml29623
4906f45ec7bSml29623 { nxge_param_get_ip_opt, nxge_param_set_ip_opt, NXGE_PARAM_CLASS_RWS,
4916f45ec7bSml29623 0, ALL_FF_32, NXGE_CLASS_FLOW_GEN_SERVER, 0,
4926f45ec7bSml29623 "class-opt-ipv6-sctp", "class_opt_ipv6_sctp"},
4936f45ec7bSml29623
4946f45ec7bSml29623 { nxge_param_get_debug_flag, nxge_param_set_nxge_debug_flag,
495846a903dSml29623 NXGE_PARAM_RW | NXGE_PARAM_DONT_SHOW,
4966f45ec7bSml29623 0ULL, ALL_FF_64, 0ULL, 0ULL,
4976f45ec7bSml29623 "nxge-debug-flag", "nxge_debug_flag"},
4986f45ec7bSml29623
4996f45ec7bSml29623 { nxge_param_get_debug_flag, nxge_param_set_npi_debug_flag,
500846a903dSml29623 NXGE_PARAM_RW | NXGE_PARAM_DONT_SHOW,
5016f45ec7bSml29623 0ULL, ALL_FF_64, 0ULL, 0ULL,
5026f45ec7bSml29623 "npi-debug-flag", "npi_debug_flag"},
5036f45ec7bSml29623
504846a903dSml29623 { nxge_param_dump_tdc, NULL, NXGE_PARAM_READ | NXGE_PARAM_DONT_SHOW,
5056f45ec7bSml29623 0, 0x0fffffff, 0x0fffffff, 0, "dump-tdc", "dump_tdc"},
5066f45ec7bSml29623
507846a903dSml29623 { nxge_param_dump_rdc, NULL, NXGE_PARAM_READ | NXGE_PARAM_DONT_SHOW,
5086f45ec7bSml29623 0, 0x0fffffff, 0x0fffffff, 0, "dump-rdc", "dump_rdc"},
5096f45ec7bSml29623
510846a903dSml29623 { nxge_param_dump_mac_regs, NULL, NXGE_PARAM_READ |
511846a903dSml29623 NXGE_PARAM_DONT_SHOW,
5126f45ec7bSml29623 0, 0x0fffffff, 0x0fffffff, 0, "dump-mac-regs", "dump_mac_regs"},
5136f45ec7bSml29623
514846a903dSml29623 { nxge_param_dump_ipp_regs, NULL, NXGE_PARAM_READ |
515846a903dSml29623 NXGE_PARAM_DONT_SHOW,
5166f45ec7bSml29623 0, 0x0fffffff, 0x0fffffff, 0, "dump-ipp-regs", "dump_ipp_regs"},
5176f45ec7bSml29623
518846a903dSml29623 { nxge_param_dump_fflp_regs, NULL, NXGE_PARAM_READ |
519846a903dSml29623 NXGE_PARAM_DONT_SHOW,
5206f45ec7bSml29623 0, 0x0fffffff, 0x0fffffff, 0,
5216f45ec7bSml29623 "dump-fflp-regs", "dump_fflp_regs"},
5226f45ec7bSml29623
523846a903dSml29623 { nxge_param_dump_vlan_table, NULL, NXGE_PARAM_READ |
524846a903dSml29623 NXGE_PARAM_DONT_SHOW,
5256f45ec7bSml29623 0, 0x0fffffff, 0x0fffffff, 0,
5266f45ec7bSml29623 "dump-vlan-table", "dump_vlan_table"},
5276f45ec7bSml29623
528846a903dSml29623 { nxge_param_dump_rdc_table, NULL, NXGE_PARAM_READ |
529846a903dSml29623 NXGE_PARAM_DONT_SHOW,
5306f45ec7bSml29623 0, 0x0fffffff, 0x0fffffff, 0,
5316f45ec7bSml29623 "dump-rdc-table", "dump_rdc_table"},
5326f45ec7bSml29623
533846a903dSml29623 { nxge_param_dump_ptrs, NULL, NXGE_PARAM_READ |
534846a903dSml29623 NXGE_PARAM_DONT_SHOW,
5356f45ec7bSml29623 0, 0x0fffffff, 0x0fffffff, 0, "dump-ptrs", "dump_ptrs"},
5366f45ec7bSml29623
5376f45ec7bSml29623 { NULL, NULL, NXGE_PARAM_READ | NXGE_PARAM_DONT_SHOW,
5386f45ec7bSml29623 0, 0x0fffffff, 0x0fffffff, 0, "end", "end"},
5396f45ec7bSml29623 };
5406f45ec7bSml29623
5416f45ec7bSml29623 extern void *nxge_list;
5426f45ec7bSml29623
5436f45ec7bSml29623 void
nxge_get_param_soft_properties(p_nxge_t nxgep)5446f45ec7bSml29623 nxge_get_param_soft_properties(p_nxge_t nxgep)
5456f45ec7bSml29623 {
5466f45ec7bSml29623
5476f45ec7bSml29623 p_nxge_param_t param_arr;
5486f45ec7bSml29623 uint_t prop_len;
5496f45ec7bSml29623 int i, j;
5506f45ec7bSml29623 uint32_t param_count;
5516f45ec7bSml29623 uint32_t *int_prop_val;
5526f45ec7bSml29623
5536f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, DDI_CTL, " ==> nxge_get_param_soft_properties"));
5546f45ec7bSml29623
5556f45ec7bSml29623 param_arr = nxgep->param_arr;
5566f45ec7bSml29623 param_count = nxgep->param_count;
5576f45ec7bSml29623 for (i = 0; i < param_count; i++) {
5586f45ec7bSml29623 if ((param_arr[i].type & NXGE_PARAM_READ_PROP) == 0)
5596f45ec7bSml29623 continue;
5606f45ec7bSml29623 if ((param_arr[i].type & NXGE_PARAM_PROP_STR))
5616f45ec7bSml29623 continue;
5626f45ec7bSml29623 if ((param_arr[i].type & NXGE_PARAM_PROP_ARR32) ||
5636f45ec7bSml29623 (param_arr[i].type & NXGE_PARAM_PROP_ARR64)) {
5646f45ec7bSml29623 if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY,
5656f45ec7bSml29623 nxgep->dip, 0, param_arr[i].fcode_name,
5666f45ec7bSml29623 (int **)&int_prop_val,
5676f45ec7bSml29623 (uint_t *)&prop_len)
5686f45ec7bSml29623 == DDI_PROP_SUCCESS) {
5696f45ec7bSml29623 uint32_t *cfg_value;
5706f45ec7bSml29623 uint64_t prop_count;
5716f45ec7bSml29623
5726f45ec7bSml29623 if (prop_len > NXGE_PARAM_ARRAY_INIT_SIZE)
5736f45ec7bSml29623 prop_len = NXGE_PARAM_ARRAY_INIT_SIZE;
574adfcba55Sjoycey #if defined(__i386)
575adfcba55Sjoycey cfg_value =
576adfcba55Sjoycey (uint32_t *)(int32_t)param_arr[i].value;
577adfcba55Sjoycey #else
5786f45ec7bSml29623 cfg_value = (uint32_t *)param_arr[i].value;
579adfcba55Sjoycey #endif
5806f45ec7bSml29623 for (j = 0; j < prop_len; j++) {
5816f45ec7bSml29623 cfg_value[j] = int_prop_val[j];
5826f45ec7bSml29623 }
5836f45ec7bSml29623 prop_count = prop_len;
5846f45ec7bSml29623 param_arr[i].type |=
5856f45ec7bSml29623 (prop_count << NXGE_PARAM_ARRAY_CNT_SHIFT);
5866f45ec7bSml29623 ddi_prop_free(int_prop_val);
5876f45ec7bSml29623 }
5886f45ec7bSml29623 continue;
5896f45ec7bSml29623 }
5906f45ec7bSml29623
5916f45ec7bSml29623 if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, nxgep->dip, 0,
5926f45ec7bSml29623 param_arr[i].fcode_name,
5936f45ec7bSml29623 (int **)&int_prop_val,
5946f45ec7bSml29623 &prop_len) == DDI_PROP_SUCCESS) {
5956f45ec7bSml29623 if ((*int_prop_val >= param_arr[i].minimum) &&
5966f45ec7bSml29623 (*int_prop_val <= param_arr[i].maximum))
5976f45ec7bSml29623 param_arr[i].value = *int_prop_val;
5986f45ec7bSml29623 #ifdef NXGE_DEBUG_ERROR
5996f45ec7bSml29623 else {
6006f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, OBP_CTL,
6016f45ec7bSml29623 "nxge%d: 'prom' file parameter error\n",
6026f45ec7bSml29623 nxgep->instance));
6036f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, OBP_CTL,
6046f45ec7bSml29623 "Parameter keyword '%s'"
6056f45ec7bSml29623 " is outside valid range\n",
6066f45ec7bSml29623 param_arr[i].name));
6076f45ec7bSml29623 }
6086f45ec7bSml29623 #endif
6096f45ec7bSml29623 ddi_prop_free(int_prop_val);
6106f45ec7bSml29623 }
6116f45ec7bSml29623
6126f45ec7bSml29623 if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, nxgep->dip, 0,
6136f45ec7bSml29623 param_arr[i].name,
6146f45ec7bSml29623 (int **)&int_prop_val,
6156f45ec7bSml29623 &prop_len) == DDI_PROP_SUCCESS) {
6166f45ec7bSml29623 if ((*int_prop_val >= param_arr[i].minimum) &&
6176f45ec7bSml29623 (*int_prop_val <= param_arr[i].maximum))
6186f45ec7bSml29623 param_arr[i].value = *int_prop_val;
6196f45ec7bSml29623 #ifdef NXGE_DEBUG_ERROR
6206f45ec7bSml29623 else {
6216f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, OBP_CTL,
6226f45ec7bSml29623 "nxge%d: 'conf' file parameter error\n",
6236f45ec7bSml29623 nxgep->instance));
6246f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, OBP_CTL,
6256f45ec7bSml29623 "Parameter keyword '%s'"
6266f45ec7bSml29623 "is outside valid range\n",
6276f45ec7bSml29623 param_arr[i].name));
6286f45ec7bSml29623 }
6296f45ec7bSml29623 #endif
6306f45ec7bSml29623 ddi_prop_free(int_prop_val);
6316f45ec7bSml29623 }
6326f45ec7bSml29623 }
6336f45ec7bSml29623 }
6346f45ec7bSml29623
6356f45ec7bSml29623 static int
nxge_private_param_register(p_nxge_t nxgep,p_nxge_param_t param_arr)6366f45ec7bSml29623 nxge_private_param_register(p_nxge_t nxgep, p_nxge_param_t param_arr)
6376f45ec7bSml29623 {
6386f45ec7bSml29623 int status = B_TRUE;
6396f45ec7bSml29623 int channel;
6406f45ec7bSml29623 uint8_t grp;
6416f45ec7bSml29623 char *prop_name;
6426f45ec7bSml29623 char *end;
6436f45ec7bSml29623 uint32_t name_chars;
6446f45ec7bSml29623
6456f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD2_CTL,
6466f45ec7bSml29623 "nxge_private_param_register %s", param_arr->name));
6476f45ec7bSml29623
6486f45ec7bSml29623 if ((param_arr->type & NXGE_PARAM_PRIV) != NXGE_PARAM_PRIV)
6496f45ec7bSml29623 return (B_TRUE);
6506f45ec7bSml29623
6516f45ec7bSml29623 prop_name = param_arr->name;
6526f45ec7bSml29623 if (param_arr->type & NXGE_PARAM_RXDMA) {
6536f45ec7bSml29623 if (strncmp("rxdma_intr", prop_name, 10) == 0)
6546f45ec7bSml29623 return (B_TRUE);
6556f45ec7bSml29623 name_chars = strlen("default_grp");
6566f45ec7bSml29623 if (strncmp("default_grp", prop_name, name_chars) == 0) {
6576f45ec7bSml29623 prop_name += name_chars;
6586f45ec7bSml29623 grp = mi_strtol(prop_name, &end, 10);
6596f45ec7bSml29623 /* now check if this rdcgrp is in config */
6606f45ec7bSml29623 return (nxge_check_rdcgrp_port_member(nxgep, grp));
6616f45ec7bSml29623 }
6626f45ec7bSml29623 name_chars = strlen(prop_name);
6636f45ec7bSml29623 if (strncmp("default_port_rdc", prop_name, name_chars) == 0) {
6646f45ec7bSml29623 return (B_TRUE);
6656f45ec7bSml29623 }
6666f45ec7bSml29623 return (B_FALSE);
6676f45ec7bSml29623 }
6686f45ec7bSml29623
6696f45ec7bSml29623 if (param_arr->type & NXGE_PARAM_TXDMA) {
6706f45ec7bSml29623 name_chars = strlen("txdma");
6716f45ec7bSml29623 if (strncmp("txdma", prop_name, name_chars) == 0) {
6726f45ec7bSml29623 prop_name += name_chars;
6736f45ec7bSml29623 channel = mi_strtol(prop_name, &end, 10);
6746f45ec7bSml29623 /* now check if this rdc is in config */
6756f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD2_CTL,
6766f45ec7bSml29623 " nxge_private_param_register: %d",
6776f45ec7bSml29623 channel));
6786f45ec7bSml29623 return (nxge_check_txdma_port_member(nxgep, channel));
6796f45ec7bSml29623 }
6806f45ec7bSml29623 return (B_FALSE);
6816f45ec7bSml29623 }
6826f45ec7bSml29623
6836f45ec7bSml29623 status = B_FALSE;
6846f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD2_CTL, "<== nxge_private_param_register"));
6856f45ec7bSml29623
6866f45ec7bSml29623 return (status);
6876f45ec7bSml29623 }
6886f45ec7bSml29623
6896f45ec7bSml29623 void
nxge_setup_param(p_nxge_t nxgep)6906f45ec7bSml29623 nxge_setup_param(p_nxge_t nxgep)
6916f45ec7bSml29623 {
6926f45ec7bSml29623 p_nxge_param_t param_arr;
6936f45ec7bSml29623 int i;
6946f45ec7bSml29623 pfi_t set_pfi;
6956f45ec7bSml29623
6966f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_setup_param"));
6976f45ec7bSml29623
6986f45ec7bSml29623 /*
6996f45ec7bSml29623 * Make sure the param_instance is set to a valid device instance.
7006f45ec7bSml29623 */
7016f45ec7bSml29623 if (nxge_param_arr[param_instance].value == 1000)
7026f45ec7bSml29623 nxge_param_arr[param_instance].value = nxgep->instance;
7036f45ec7bSml29623
7046f45ec7bSml29623 param_arr = nxgep->param_arr;
7056f45ec7bSml29623 param_arr[param_instance].value = nxgep->instance;
7066f45ec7bSml29623 param_arr[param_function_number].value = nxgep->function_num;
7076f45ec7bSml29623
7086f45ec7bSml29623 for (i = 0; i < nxgep->param_count; i++) {
7096f45ec7bSml29623 if ((param_arr[i].type & NXGE_PARAM_PRIV) &&
7106f45ec7bSml29623 (nxge_private_param_register(nxgep,
7116f45ec7bSml29623 ¶m_arr[i]) == B_FALSE)) {
7126f45ec7bSml29623 param_arr[i].setf = NULL;
7136f45ec7bSml29623 param_arr[i].getf = NULL;
7146f45ec7bSml29623 }
7156f45ec7bSml29623
7166f45ec7bSml29623 if (param_arr[i].type & NXGE_PARAM_CMPLX)
7176f45ec7bSml29623 param_arr[i].setf = NULL;
7186f45ec7bSml29623
7196f45ec7bSml29623 if (param_arr[i].type & NXGE_PARAM_DONT_SHOW) {
7206f45ec7bSml29623 param_arr[i].setf = NULL;
7216f45ec7bSml29623 param_arr[i].getf = NULL;
7226f45ec7bSml29623 }
7236f45ec7bSml29623
7246f45ec7bSml29623 set_pfi = (pfi_t)param_arr[i].setf;
7256f45ec7bSml29623
7266f45ec7bSml29623 if ((set_pfi) && (param_arr[i].type & NXGE_PARAM_INIT_ONLY)) {
7276f45ec7bSml29623 set_pfi = NULL;
7286f45ec7bSml29623 }
7296f45ec7bSml29623
7306f45ec7bSml29623 }
7316f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_setup_param"));
7326f45ec7bSml29623 }
7336f45ec7bSml29623
7346f45ec7bSml29623 void
nxge_init_param(p_nxge_t nxgep)7356f45ec7bSml29623 nxge_init_param(p_nxge_t nxgep)
7366f45ec7bSml29623 {
7376f45ec7bSml29623 p_nxge_param_t param_arr;
7386f45ec7bSml29623 int i, alloc_size;
7396f45ec7bSml29623 uint64_t alloc_count;
7406f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, DDI_CTL, "==> nxge_init_param"));
7416f45ec7bSml29623 /*
7426f45ec7bSml29623 * Make sure the param_instance is set to a valid device instance.
7436f45ec7bSml29623 */
7446f45ec7bSml29623 if (nxge_param_arr[param_instance].value == 1000)
7456f45ec7bSml29623 nxge_param_arr[param_instance].value = nxgep->instance;
7466f45ec7bSml29623
7476f45ec7bSml29623 param_arr = nxgep->param_arr;
7486f45ec7bSml29623 if (param_arr == NULL) {
7496f45ec7bSml29623 param_arr = (p_nxge_param_t)
7506f45ec7bSml29623 KMEM_ZALLOC(sizeof (nxge_param_arr), KM_SLEEP);
7516f45ec7bSml29623 }
7526f45ec7bSml29623
7536f45ec7bSml29623 for (i = 0; i < sizeof (nxge_param_arr)/sizeof (nxge_param_t); i++) {
7546f45ec7bSml29623 param_arr[i] = nxge_param_arr[i];
7556f45ec7bSml29623 if ((param_arr[i].type & NXGE_PARAM_PROP_ARR32) ||
7566f45ec7bSml29623 (param_arr[i].type & NXGE_PARAM_PROP_ARR64)) {
7576f45ec7bSml29623 alloc_count = NXGE_PARAM_ARRAY_INIT_SIZE;
7586f45ec7bSml29623 alloc_size = alloc_count * sizeof (uint64_t);
7596f45ec7bSml29623 param_arr[i].value =
760adfcba55Sjoycey #if defined(__i386)
7614045d941Ssowmini (uint64_t)(uint32_t)KMEM_ZALLOC(alloc_size,
7624045d941Ssowmini KM_SLEEP);
763adfcba55Sjoycey #else
7646f45ec7bSml29623 (uint64_t)KMEM_ZALLOC(alloc_size, KM_SLEEP);
765adfcba55Sjoycey #endif
7666f45ec7bSml29623 param_arr[i].old_value =
767adfcba55Sjoycey #if defined(__i386)
768adfcba55Sjoycey (uint64_t)(uint32_t)KMEM_ZALLOC(alloc_size,
769adfcba55Sjoycey KM_SLEEP);
770adfcba55Sjoycey #else
7716f45ec7bSml29623 (uint64_t)KMEM_ZALLOC(alloc_size, KM_SLEEP);
772adfcba55Sjoycey #endif
7736f45ec7bSml29623 param_arr[i].type |=
7746f45ec7bSml29623 (alloc_count << NXGE_PARAM_ARRAY_ALLOC_SHIFT);
7756f45ec7bSml29623 }
7766f45ec7bSml29623 }
7776f45ec7bSml29623
7786f45ec7bSml29623 nxgep->param_arr = param_arr;
7796f45ec7bSml29623 nxgep->param_count = sizeof (nxge_param_arr)/sizeof (nxge_param_t);
7801bd6825cSml29623
7811bd6825cSml29623 nxge_param_sync(nxgep);
7821bd6825cSml29623
7836f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, DDI_CTL, "<== nxge_init_param: count %d",
7846f45ec7bSml29623 nxgep->param_count));
7856f45ec7bSml29623 }
7866f45ec7bSml29623
7876f45ec7bSml29623 void
nxge_destroy_param(p_nxge_t nxgep)7886f45ec7bSml29623 nxge_destroy_param(p_nxge_t nxgep)
7896f45ec7bSml29623 {
7906f45ec7bSml29623 int i;
7916f45ec7bSml29623 uint64_t free_size, free_count;
7926f45ec7bSml29623
7936f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, DDI_CTL, "==> nxge_destroy_param"));
7946f45ec7bSml29623
79559ac0c16Sdavemq if (nxgep->param_arr == NULL)
79659ac0c16Sdavemq return;
7976f45ec7bSml29623 /*
7986f45ec7bSml29623 * Make sure the param_instance is set to a valid device instance.
7996f45ec7bSml29623 */
8006f45ec7bSml29623 if (nxge_param_arr[param_instance].value == nxgep->instance) {
8016f45ec7bSml29623 for (i = 0; i <= nxge_param_arr[param_instance].maximum; i++) {
8026f45ec7bSml29623 if ((ddi_get_soft_state(nxge_list, i) != NULL) &&
8036f45ec7bSml29623 (i != nxgep->instance))
8046f45ec7bSml29623 break;
8056f45ec7bSml29623 }
8066f45ec7bSml29623 nxge_param_arr[param_instance].value = i;
8076f45ec7bSml29623 }
8086f45ec7bSml29623
8096f45ec7bSml29623 for (i = 0; i < nxgep->param_count; i++)
8106f45ec7bSml29623 if ((nxgep->param_arr[i].type & NXGE_PARAM_PROP_ARR32) ||
8116f45ec7bSml29623 (nxgep->param_arr[i].type & NXGE_PARAM_PROP_ARR64)) {
8126f45ec7bSml29623 free_count = ((nxgep->param_arr[i].type &
8136f45ec7bSml29623 NXGE_PARAM_ARRAY_ALLOC_MASK) >>
8146f45ec7bSml29623 NXGE_PARAM_ARRAY_ALLOC_SHIFT);
8156f45ec7bSml29623 free_count = NXGE_PARAM_ARRAY_INIT_SIZE;
8166f45ec7bSml29623 free_size = sizeof (uint64_t) * free_count;
817adfcba55Sjoycey #if defined(__i386)
818adfcba55Sjoycey KMEM_FREE((void *)(uint32_t)nxgep->param_arr[i].value,
819adfcba55Sjoycey free_size);
820adfcba55Sjoycey #else
8216f45ec7bSml29623 KMEM_FREE((void *)nxgep->param_arr[i].value, free_size);
822adfcba55Sjoycey #endif
823adfcba55Sjoycey #if defined(__i386)
824adfcba55Sjoycey KMEM_FREE((void *)(uint32_t)
825adfcba55Sjoycey nxgep->param_arr[i].old_value, free_size);
826adfcba55Sjoycey #else
8276f45ec7bSml29623 KMEM_FREE((void *)nxgep->param_arr[i].old_value,
8286f45ec7bSml29623 free_size);
829adfcba55Sjoycey #endif
8306f45ec7bSml29623 }
8316f45ec7bSml29623
8326f45ec7bSml29623 KMEM_FREE(nxgep->param_arr, sizeof (nxge_param_arr));
8336f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, DDI_CTL, "<== nxge_destroy_param"));
8346f45ec7bSml29623 }
8356f45ec7bSml29623
8366f45ec7bSml29623 /*
8376f45ec7bSml29623 * Extracts the value from the 'nxge' parameter array and prints the
8386f45ec7bSml29623 * parameter value. cp points to the required parameter.
8396f45ec7bSml29623 */
8406f45ec7bSml29623
8416f45ec7bSml29623 /* ARGSUSED */
8426f45ec7bSml29623 int
nxge_param_get_generic(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)8436f45ec7bSml29623 nxge_param_get_generic(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
8446f45ec7bSml29623 {
8456f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
8466f45ec7bSml29623
8476f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
8486f45ec7bSml29623 "==> nxge_param_get_generic name %s ", pa->name));
8496f45ec7bSml29623
8506f45ec7bSml29623 if (pa->value > 0xffffffff)
8516f45ec7bSml29623 (void) mi_mpprintf(mp, "%x%x",
8526f45ec7bSml29623 (int)(pa->value >> 32), (int)(pa->value & 0xffffffff));
8536f45ec7bSml29623 else
8546f45ec7bSml29623 (void) mi_mpprintf(mp, "%x", (int)pa->value);
8556f45ec7bSml29623
8566f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_generic"));
8576f45ec7bSml29623 return (0);
8586f45ec7bSml29623 }
8596f45ec7bSml29623
8606f45ec7bSml29623 /* ARGSUSED */
8616f45ec7bSml29623 static int
nxge_param_get_mac(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)8626f45ec7bSml29623 nxge_param_get_mac(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
8636f45ec7bSml29623 {
8646f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
8656f45ec7bSml29623
8666f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_get_mac"));
8676f45ec7bSml29623
8686f45ec7bSml29623 (void) mi_mpprintf(mp, "%d", (uint32_t)pa->value);
8696f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_mac"));
8706f45ec7bSml29623 return (0);
8716f45ec7bSml29623 }
8726f45ec7bSml29623
8736f45ec7bSml29623 /* ARGSUSED */
87456d930aeSspeer static int
nxge_param_get_fw_ver(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)87556d930aeSspeer nxge_param_get_fw_ver(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
87656d930aeSspeer {
87756d930aeSspeer NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_get_fw_ver"));
87856d930aeSspeer
87956d930aeSspeer (void) mi_mpprintf(mp, "Firmware version for nxge%d: %s\n",
88056d930aeSspeer nxgep->instance, nxgep->vpd_info.ver);
88156d930aeSspeer
88256d930aeSspeer NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_fw_ver"));
88356d930aeSspeer return (0);
88456d930aeSspeer }
88556d930aeSspeer
88656d930aeSspeer /* ARGSUSED */
8872e59129aSraghus static int
nxge_param_get_port_mode(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)8882e59129aSraghus nxge_param_get_port_mode(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
8892e59129aSraghus {
8902e59129aSraghus NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_get_port_mode"));
8912e59129aSraghus
8922e59129aSraghus switch (nxgep->mac.portmode) {
8932e59129aSraghus case PORT_1G_COPPER:
8942d17280bSsbehera (void) mi_mpprintf(mp, "Port mode for nxge%d: 1G Copper %s\n",
8952d17280bSsbehera nxgep->instance,
8962d17280bSsbehera nxgep->hot_swappable_phy ? "[Hot Swappable]" : "");
8972e59129aSraghus break;
8982e59129aSraghus case PORT_1G_FIBER:
8992d17280bSsbehera (void) mi_mpprintf(mp, "Port mode for nxge%d: 1G Fiber %s\n",
9002d17280bSsbehera nxgep->instance,
9012d17280bSsbehera nxgep->hot_swappable_phy ? "[Hot Swappable]" : "");
9022e59129aSraghus break;
9032e59129aSraghus case PORT_10G_COPPER:
9042d17280bSsbehera (void) mi_mpprintf(mp, "Port mode for nxge%d: 10G Copper "
9052d17280bSsbehera "%s\n", nxgep->instance,
9062d17280bSsbehera nxgep->hot_swappable_phy ? "[Hot Swappable]" : "");
9072e59129aSraghus break;
9082e59129aSraghus case PORT_10G_FIBER:
9092d17280bSsbehera (void) mi_mpprintf(mp, "Port mode for nxge%d: 10G Fiber %s\n",
9102d17280bSsbehera nxgep->instance,
9112d17280bSsbehera nxgep->hot_swappable_phy ? "[Hot Swappable]" : "");
9122e59129aSraghus break;
9132e59129aSraghus case PORT_10G_SERDES:
9142d17280bSsbehera (void) mi_mpprintf(mp, "Port mode for nxge%d: 10G Serdes "
9152d17280bSsbehera "%s\n", nxgep->instance,
9162d17280bSsbehera nxgep->hot_swappable_phy ? "[Hot Swappable]" : "");
9172e59129aSraghus break;
9182e59129aSraghus case PORT_1G_SERDES:
9192d17280bSsbehera (void) mi_mpprintf(mp, "Port mode for nxge%d: 1G Serdes %s\n",
9202d17280bSsbehera nxgep->instance,
9212d17280bSsbehera nxgep->hot_swappable_phy ? "[Hot Swappable]" : "");
9222e59129aSraghus break;
9232e59129aSraghus case PORT_1G_RGMII_FIBER:
9242e59129aSraghus (void) mi_mpprintf(mp, "Port mode for nxge%d: 1G RGMII "
9252d17280bSsbehera "Fiber %s\n", nxgep->instance,
9262d17280bSsbehera nxgep->hot_swappable_phy ? "[Hot Swappable]" : "");
9272d17280bSsbehera break;
9282d17280bSsbehera case PORT_HSP_MODE:
9292d17280bSsbehera (void) mi_mpprintf(mp, "Port mode for nxge%d: Hot Swappable "
9302d17280bSsbehera "PHY, Currently NOT present\n", nxgep->instance);
9312e59129aSraghus break;
93200161856Syc148097 case PORT_10G_TN1010:
93300161856Syc148097 (void) mi_mpprintf(mp, "Port mode for nxge%d:"
93400161856Syc148097 " 10G Copper with TN1010 %s\n", nxgep->instance,
93500161856Syc148097 nxgep->hot_swappable_phy ? "[Hot Swappable]" : "");
93600161856Syc148097 break;
93700161856Syc148097 case PORT_1G_TN1010:
93800161856Syc148097 (void) mi_mpprintf(mp, "Port mode for nxge%d:"
93900161856Syc148097 " 1G Copper with TN1010 %s\n", nxgep->instance,
94000161856Syc148097 nxgep->hot_swappable_phy ? "[Hot Swappable]" : "");
94100161856Syc148097 break;
9422e59129aSraghus default:
9432d17280bSsbehera (void) mi_mpprintf(mp, "Port mode for nxge%d: Unknown %s\n",
9442d17280bSsbehera nxgep->instance,
9452d17280bSsbehera nxgep->hot_swappable_phy ? "[Hot Swappable]" : "");
9462e59129aSraghus break;
9472e59129aSraghus }
9482e59129aSraghus
9493d16f8e7Sml29623 (void) mi_mpprintf(mp, "Software LSO for nxge%d: %s\n",
9503d16f8e7Sml29623 nxgep->instance,
9513d16f8e7Sml29623 nxgep->soft_lso_enable ? "enable" : "disable");
9523d16f8e7Sml29623
9532e59129aSraghus NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_port_mode"));
9542e59129aSraghus return (0);
9552e59129aSraghus }
9562e59129aSraghus
9572e59129aSraghus /* ARGSUSED */
958*c1f9c6e5SSantwona Behera static int
nxge_param_get_rx_intr_time(p_nxge_t nxgep,queue_t * q,mblk_t * mp,caddr_t cp)959*c1f9c6e5SSantwona Behera nxge_param_get_rx_intr_time(p_nxge_t nxgep, queue_t *q, mblk_t *mp, caddr_t cp)
960*c1f9c6e5SSantwona Behera {
961*c1f9c6e5SSantwona Behera p_nxge_param_t pa = (p_nxge_param_t)cp;
962*c1f9c6e5SSantwona Behera
963*c1f9c6e5SSantwona Behera NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_get_rx_intr_time"));
964*c1f9c6e5SSantwona Behera
965*c1f9c6e5SSantwona Behera pa->value = (uint32_t)nxgep->intr_timeout;
966*c1f9c6e5SSantwona Behera (void) mi_mpprintf(mp, "%d", (uint32_t)nxgep->intr_timeout);
967*c1f9c6e5SSantwona Behera
968*c1f9c6e5SSantwona Behera NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_rx_intr_time"));
969*c1f9c6e5SSantwona Behera return (0);
970*c1f9c6e5SSantwona Behera }
971*c1f9c6e5SSantwona Behera
972*c1f9c6e5SSantwona Behera /* ARGSUSED */
973*c1f9c6e5SSantwona Behera static int
nxge_param_get_rx_intr_pkts(p_nxge_t nxgep,queue_t * q,mblk_t * mp,caddr_t cp)974*c1f9c6e5SSantwona Behera nxge_param_get_rx_intr_pkts(p_nxge_t nxgep, queue_t *q, mblk_t *mp, caddr_t cp)
975*c1f9c6e5SSantwona Behera {
976*c1f9c6e5SSantwona Behera p_nxge_param_t pa = (p_nxge_param_t)cp;
977*c1f9c6e5SSantwona Behera
978*c1f9c6e5SSantwona Behera NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_get_rx_intr_pkts"));
979*c1f9c6e5SSantwona Behera
980*c1f9c6e5SSantwona Behera pa->value = (uint32_t)nxgep->intr_threshold;
981*c1f9c6e5SSantwona Behera (void) mi_mpprintf(mp, "%d", (uint32_t)nxgep->intr_threshold);
982*c1f9c6e5SSantwona Behera
983*c1f9c6e5SSantwona Behera NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_rx_intr_pkts"));
984*c1f9c6e5SSantwona Behera return (0);
985*c1f9c6e5SSantwona Behera }
986*c1f9c6e5SSantwona Behera
987*c1f9c6e5SSantwona Behera /* ARGSUSED */
9886f45ec7bSml29623 int
nxge_param_get_txdma_info(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)9896f45ec7bSml29623 nxge_param_get_txdma_info(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
9906f45ec7bSml29623 {
9916f45ec7bSml29623
9926f45ec7bSml29623 uint_t print_len, buf_len;
9936f45ec7bSml29623 p_mblk_t np;
9946f45ec7bSml29623
9956f45ec7bSml29623 int buff_alloc_size = NXGE_NDD_INFODUMP_BUFF_SIZE;
996678453a8Sspeer int tdc;
997678453a8Sspeer
998678453a8Sspeer nxge_grp_set_t *set;
999678453a8Sspeer
10006f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_get_txdma_info"));
10016f45ec7bSml29623
10026f45ec7bSml29623 (void) mi_mpprintf(mp, "TXDMA Information for Port\t %d \n",
10036f45ec7bSml29623 nxgep->function_num);
10046f45ec7bSml29623
10056f45ec7bSml29623 if ((np = allocb(buff_alloc_size, BPRI_HI)) == NULL) {
10066f45ec7bSml29623 (void) mi_mpprintf(mp, "%s\n", "out of buffer");
10076f45ec7bSml29623 return (0);
10086f45ec7bSml29623 }
10096f45ec7bSml29623
10106f45ec7bSml29623 buf_len = buff_alloc_size;
10116f45ec7bSml29623 mp->b_cont = np;
1012678453a8Sspeer print_len = 0;
10136f45ec7bSml29623
10146f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
10156f45ec7bSml29623 "TDC\t HW TDC\t\n");
10166f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
10176f45ec7bSml29623 buf_len -= print_len;
1018678453a8Sspeer
1019678453a8Sspeer set = &nxgep->tx_set;
1020da14cebeSEric Cheng for (tdc = 0; tdc < NXGE_MAX_TDCS; tdc++) {
1021678453a8Sspeer if ((1 << tdc) & set->owned.map) {
10226f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr,
1023678453a8Sspeer buf_len, "%d\n", tdc);
10246f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
10256f45ec7bSml29623 buf_len -= print_len;
10266f45ec7bSml29623 }
1027678453a8Sspeer }
10286f45ec7bSml29623
10296f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_txdma_info"));
10306f45ec7bSml29623 return (0);
10316f45ec7bSml29623 }
10326f45ec7bSml29623
10336f45ec7bSml29623 /* ARGSUSED */
10346f45ec7bSml29623 int
nxge_param_get_rxdma_info(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)10356f45ec7bSml29623 nxge_param_get_rxdma_info(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
10366f45ec7bSml29623 {
10376f45ec7bSml29623 uint_t print_len, buf_len;
10386f45ec7bSml29623 p_mblk_t np;
10396f45ec7bSml29623 int rdc;
10406f45ec7bSml29623 p_nxge_dma_pt_cfg_t p_dma_cfgp;
10416f45ec7bSml29623 p_nxge_hw_pt_cfg_t p_cfgp;
10426f45ec7bSml29623 int buff_alloc_size = NXGE_NDD_INFODUMP_BUFF_SIZE;
10436f45ec7bSml29623 p_rx_rcr_rings_t rx_rcr_rings;
10446f45ec7bSml29623 p_rx_rcr_ring_t *rcr_rings;
10456f45ec7bSml29623 p_rx_rbr_rings_t rx_rbr_rings;
10466f45ec7bSml29623 p_rx_rbr_ring_t *rbr_rings;
1047678453a8Sspeer nxge_grp_set_t *set;
10486f45ec7bSml29623
10496f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_get_rxdma_info"));
10506f45ec7bSml29623
10516f45ec7bSml29623 (void) mi_mpprintf(mp, "RXDMA Information for Port\t %d \n",
10526f45ec7bSml29623 nxgep->function_num);
10536f45ec7bSml29623
10546f45ec7bSml29623 if ((np = allocb(buff_alloc_size, BPRI_HI)) == NULL) {
10556f45ec7bSml29623 /* The following may work even if we cannot get a large buf. */
10566f45ec7bSml29623 (void) mi_mpprintf(mp, "%s\n", "out of buffer");
10576f45ec7bSml29623 return (0);
10586f45ec7bSml29623 }
10596f45ec7bSml29623
10606f45ec7bSml29623 buf_len = buff_alloc_size;
10616f45ec7bSml29623 mp->b_cont = np;
10626f45ec7bSml29623 p_dma_cfgp = (p_nxge_dma_pt_cfg_t)&nxgep->pt_config;
10636f45ec7bSml29623 p_cfgp = (p_nxge_hw_pt_cfg_t)&p_dma_cfgp->hw_config;
10646f45ec7bSml29623
10656f45ec7bSml29623 rx_rcr_rings = nxgep->rx_rcr_rings;
10666f45ec7bSml29623 rcr_rings = rx_rcr_rings->rcr_rings;
10676f45ec7bSml29623 rx_rbr_rings = nxgep->rx_rbr_rings;
10686f45ec7bSml29623 rbr_rings = rx_rbr_rings->rbr_rings;
10696f45ec7bSml29623
10706f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
10716f45ec7bSml29623 "Total RDCs\t %d\n", p_cfgp->max_rdcs);
10726f45ec7bSml29623
10736f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
10746f45ec7bSml29623 buf_len -= print_len;
10756f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
10766f45ec7bSml29623 "RDC\t HW RDC\t Timeout\t Packets RBR ptr \t"
10776f45ec7bSml29623 "chunks\t RCR ptr\n");
10786f45ec7bSml29623
10796f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
10806f45ec7bSml29623 buf_len -= print_len;
1081678453a8Sspeer
1082678453a8Sspeer set = &nxgep->rx_set;
1083678453a8Sspeer for (rdc = 0; rdc < NXGE_MAX_RDCS; rdc++) {
1084678453a8Sspeer if ((1 << rdc) & set->owned.map) {
1085678453a8Sspeer print_len = snprintf((char *)
1086678453a8Sspeer ((mblk_t *)np)->b_wptr, buf_len,
1087678453a8Sspeer " %d\t %x\t\t %x\t $%p\t 0x%x\t $%p\n",
1088678453a8Sspeer rdc,
10896f45ec7bSml29623 p_dma_cfgp->rcr_timeout[rdc],
10906f45ec7bSml29623 p_dma_cfgp->rcr_threshold[rdc],
10918793b36bSNick Todd (void *)rbr_rings[rdc],
10928793b36bSNick Todd rbr_rings[rdc]->num_blocks, (void *)rcr_rings[rdc]);
10936f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
10946f45ec7bSml29623 buf_len -= print_len;
10956f45ec7bSml29623 }
1096678453a8Sspeer }
10976f45ec7bSml29623
10986f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_rxdma_info"));
10996f45ec7bSml29623 return (0);
11006f45ec7bSml29623 }
11016f45ec7bSml29623
11026f45ec7bSml29623 /* ARGSUSED */
11036f45ec7bSml29623 int
nxge_param_get_rxdma_rdcgrp_info(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)11046f45ec7bSml29623 nxge_param_get_rxdma_rdcgrp_info(p_nxge_t nxgep, queue_t *q,
11056f45ec7bSml29623 p_mblk_t mp, caddr_t cp)
11066f45ec7bSml29623 {
11076f45ec7bSml29623 uint_t print_len, buf_len;
11086f45ec7bSml29623 p_mblk_t np;
11096f45ec7bSml29623 int offset, rdc, i, rdc_grp;
11106f45ec7bSml29623 p_nxge_rdc_grp_t rdc_grp_p;
11116f45ec7bSml29623 p_nxge_dma_pt_cfg_t p_dma_cfgp;
11126f45ec7bSml29623 p_nxge_hw_pt_cfg_t p_cfgp;
11136f45ec7bSml29623
11146f45ec7bSml29623 int buff_alloc_size = NXGE_NDD_INFODUMP_BUFF_SIZE;
11156f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
11166f45ec7bSml29623 "==> nxge_param_get_rxdma_rdcgrp_info"));
11176f45ec7bSml29623
11186f45ec7bSml29623 p_dma_cfgp = (p_nxge_dma_pt_cfg_t)&nxgep->pt_config;
11196f45ec7bSml29623 p_cfgp = (p_nxge_hw_pt_cfg_t)&p_dma_cfgp->hw_config;
11206f45ec7bSml29623
11216f45ec7bSml29623 (void) mi_mpprintf(mp, "RXDMA RDC Group Information for Port\t %d \n",
11226f45ec7bSml29623 nxgep->function_num);
11236f45ec7bSml29623
1124678453a8Sspeer rdc_grp = p_cfgp->def_mac_rxdma_grpid;
11256f45ec7bSml29623 if ((np = allocb(buff_alloc_size, BPRI_HI)) == NULL) {
11266f45ec7bSml29623 /* The following may work even if we cannot get a large buf. */
11276f45ec7bSml29623 (void) mi_mpprintf(mp, "%s\n", "out of buffer");
11286f45ec7bSml29623 return (0);
11296f45ec7bSml29623 }
11306f45ec7bSml29623
11316f45ec7bSml29623 buf_len = buff_alloc_size;
11326f45ec7bSml29623 mp->b_cont = np;
11336f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
11346f45ec7bSml29623 "Total RDC Groups\t %d \n"
1135678453a8Sspeer "default RDC group\t %d\n",
11366f45ec7bSml29623 p_cfgp->max_rdc_grpids,
1137678453a8Sspeer p_cfgp->def_mac_rxdma_grpid);
11386f45ec7bSml29623
11396f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
11406f45ec7bSml29623 buf_len -= print_len;
11416f45ec7bSml29623
11427b26d9ffSSantwona Behera for (i = 0; i < NXGE_MAX_RDC_GROUPS; i++) {
1143678453a8Sspeer if (p_cfgp->grpids[i]) {
11446f45ec7bSml29623 rdc_grp_p = &p_dma_cfgp->rdc_grps[i];
1145678453a8Sspeer print_len = snprintf((char *)((mblk_t *)np)->b_wptr,
1146678453a8Sspeer buf_len,
11476f45ec7bSml29623 "\nRDC Group Info for Group [%d] %d\n"
11486f45ec7bSml29623 "RDC Count %d\tstart RDC %d\n"
11496f45ec7bSml29623 "RDC Group Population Information"
11506f45ec7bSml29623 " (offsets 0 - 15)\n",
11516f45ec7bSml29623 i, rdc_grp, rdc_grp_p->max_rdcs,
11526f45ec7bSml29623 rdc_grp_p->start_rdc);
11536f45ec7bSml29623
11546f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
11556f45ec7bSml29623 buf_len -= print_len;
11566f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr,
11576f45ec7bSml29623 buf_len, "\n");
11586f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
11596f45ec7bSml29623 buf_len -= print_len;
11606f45ec7bSml29623
11616f45ec7bSml29623 for (rdc = 0; rdc < rdc_grp_p->max_rdcs; rdc++) {
1162678453a8Sspeer print_len = snprintf(
1163678453a8Sspeer (char *)((mblk_t *)np)->b_wptr,
11646f45ec7bSml29623 buf_len, "[%d]=%d ", rdc,
11656f45ec7bSml29623 rdc_grp_p->start_rdc + rdc);
11666f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
11676f45ec7bSml29623 buf_len -= print_len;
11686f45ec7bSml29623 }
11696f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr,
11706f45ec7bSml29623 buf_len, "\n");
11716f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
11726f45ec7bSml29623 buf_len -= print_len;
11736f45ec7bSml29623
11746f45ec7bSml29623 for (offset = 0; offset < 16; offset++) {
1175678453a8Sspeer print_len = snprintf(
1176678453a8Sspeer (char *)((mblk_t *)np)->b_wptr,
1177678453a8Sspeer buf_len, " %c",
1178678453a8Sspeer rdc_grp_p->map & (1 << offset) ?
1179678453a8Sspeer '1' : '0');
11806f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
11816f45ec7bSml29623 buf_len -= print_len;
11826f45ec7bSml29623 }
11836f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr,
11846f45ec7bSml29623 buf_len, "\n");
11856f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
11866f45ec7bSml29623 buf_len -= print_len;
11876f45ec7bSml29623 }
1188678453a8Sspeer }
11896f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
11906f45ec7bSml29623 "<== nxge_param_get_rxdma_rdcgrp_info"));
11916f45ec7bSml29623 return (0);
11926f45ec7bSml29623 }
11936f45ec7bSml29623
11946f45ec7bSml29623 int
nxge_mk_mblk_tail_space(p_mblk_t mp,p_mblk_t * nmp,size_t size)11956f45ec7bSml29623 nxge_mk_mblk_tail_space(p_mblk_t mp, p_mblk_t *nmp, size_t size)
11966f45ec7bSml29623 {
11976f45ec7bSml29623 p_mblk_t tmp;
11986f45ec7bSml29623
11996f45ec7bSml29623 tmp = mp;
12006f45ec7bSml29623 while (tmp->b_cont)
12016f45ec7bSml29623 tmp = tmp->b_cont;
12026f45ec7bSml29623 if ((tmp->b_wptr + size) >= tmp->b_datap->db_lim) {
12036f45ec7bSml29623 tmp->b_cont = allocb(1024, BPRI_HI);
12046f45ec7bSml29623 tmp = tmp->b_cont;
12056f45ec7bSml29623 if (!tmp)
12066f45ec7bSml29623 return (ENOMEM);
12076f45ec7bSml29623 }
12086f45ec7bSml29623
12096f45ec7bSml29623 *nmp = tmp;
12106f45ec7bSml29623 return (0);
12116f45ec7bSml29623 }
12126f45ec7bSml29623
12136f45ec7bSml29623
12146f45ec7bSml29623 /* ARGSUSED */
12156f45ec7bSml29623 int
nxge_param_set_generic(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)12166f45ec7bSml29623 nxge_param_set_generic(p_nxge_t nxgep, queue_t *q, mblk_t *mp,
12176f45ec7bSml29623 char *value, caddr_t cp)
12186f45ec7bSml29623 {
12196f45ec7bSml29623 char *end;
12206f45ec7bSml29623 uint32_t new_value;
12216f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
12226f45ec7bSml29623
12236f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, " ==> nxge_param_set_generic"));
12246f45ec7bSml29623 new_value = (uint32_t)mi_strtol(value, &end, 10);
12256f45ec7bSml29623 if (end == value || new_value < pa->minimum ||
12266f45ec7bSml29623 new_value > pa->maximum) {
12276f45ec7bSml29623 return (EINVAL);
12286f45ec7bSml29623 }
12296f45ec7bSml29623 pa->value = new_value;
12306f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, " <== nxge_param_set_generic"));
12316f45ec7bSml29623 return (0);
12326f45ec7bSml29623 }
12336f45ec7bSml29623
12346f45ec7bSml29623
12356f45ec7bSml29623 /* ARGSUSED */
12366f45ec7bSml29623 int
nxge_param_set_instance(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)12376f45ec7bSml29623 nxge_param_set_instance(p_nxge_t nxgep, queue_t *q, mblk_t *mp,
12386f45ec7bSml29623 char *value, caddr_t cp)
12396f45ec7bSml29623 {
12406f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, " ==> nxge_param_set_instance"));
12416f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, " <== nxge_param_set_instance"));
12426f45ec7bSml29623 return (0);
12436f45ec7bSml29623 }
12446f45ec7bSml29623
12456f45ec7bSml29623
12466f45ec7bSml29623 /* ARGSUSED */
12476f45ec7bSml29623 int
nxge_param_set_mac(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)12486f45ec7bSml29623 nxge_param_set_mac(p_nxge_t nxgep, queue_t *q, mblk_t *mp,
12496f45ec7bSml29623 char *value, caddr_t cp)
12506f45ec7bSml29623 {
12516f45ec7bSml29623 char *end;
12526f45ec7bSml29623 uint32_t new_value;
12536f45ec7bSml29623 int status = 0;
12546f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
12556f45ec7bSml29623
12566f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_set_mac"));
12576f45ec7bSml29623 new_value = (uint32_t)mi_strtol(value, &end, BASE_DECIMAL);
12586f45ec7bSml29623 if (PARAM_OUTOF_RANGE(value, end, new_value, pa)) {
12596f45ec7bSml29623 return (EINVAL);
12606f45ec7bSml29623 }
12616f45ec7bSml29623
12626f45ec7bSml29623 if (pa->value != new_value) {
12636f45ec7bSml29623 pa->old_value = pa->value;
12646f45ec7bSml29623 pa->value = new_value;
12656f45ec7bSml29623 }
12666f45ec7bSml29623
12676f45ec7bSml29623 if (!nxge_param_link_update(nxgep)) {
12686f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
12696f45ec7bSml29623 " false ret from nxge_param_link_update"));
12706f45ec7bSml29623 status = EINVAL;
12716f45ec7bSml29623 }
12726f45ec7bSml29623
12736f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_set_mac"));
12746f45ec7bSml29623 return (status);
12756f45ec7bSml29623 }
12766f45ec7bSml29623
12776f45ec7bSml29623 /* ARGSUSED */
12781bd6825cSml29623 int
nxge_param_rx_intr_pkts(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)12796f45ec7bSml29623 nxge_param_rx_intr_pkts(p_nxge_t nxgep, queue_t *q, mblk_t *mp,
12806f45ec7bSml29623 char *value, caddr_t cp)
12816f45ec7bSml29623 {
12826f45ec7bSml29623 char *end;
12836f45ec7bSml29623 uint32_t cfg_value;
12846f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
12856f45ec7bSml29623
12866f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_rx_intr_pkts"));
12876f45ec7bSml29623
12886f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_ANY);
12896f45ec7bSml29623
12906f45ec7bSml29623 if ((cfg_value > NXGE_RDC_RCR_THRESHOLD_MAX) ||
12916f45ec7bSml29623 (cfg_value < NXGE_RDC_RCR_THRESHOLD_MIN)) {
12926f45ec7bSml29623 return (EINVAL);
12936f45ec7bSml29623 }
12946f45ec7bSml29623
12956f45ec7bSml29623 if ((pa->value != cfg_value)) {
12966f45ec7bSml29623 pa->old_value = pa->value;
12976f45ec7bSml29623 pa->value = cfg_value;
12986f45ec7bSml29623 nxgep->intr_threshold = pa->value;
12996f45ec7bSml29623 }
13006f45ec7bSml29623
13016f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_rx_intr_pkts"));
13026f45ec7bSml29623 return (0);
13036f45ec7bSml29623 }
13046f45ec7bSml29623
13056f45ec7bSml29623 /* ARGSUSED */
13061bd6825cSml29623 int
nxge_param_rx_intr_time(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)13076f45ec7bSml29623 nxge_param_rx_intr_time(p_nxge_t nxgep, queue_t *q, mblk_t *mp,
13086f45ec7bSml29623 char *value, caddr_t cp)
13096f45ec7bSml29623 {
13106f45ec7bSml29623 char *end;
13116f45ec7bSml29623 uint32_t cfg_value;
13126f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
13136f45ec7bSml29623
13146f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_rx_intr_time"));
13156f45ec7bSml29623
13166f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_ANY);
13176f45ec7bSml29623
13186f45ec7bSml29623 if ((cfg_value > NXGE_RDC_RCR_TIMEOUT_MAX) ||
13196f45ec7bSml29623 (cfg_value < NXGE_RDC_RCR_TIMEOUT_MIN)) {
13206f45ec7bSml29623 return (EINVAL);
13216f45ec7bSml29623 }
13226f45ec7bSml29623
13236f45ec7bSml29623 if ((pa->value != cfg_value)) {
13246f45ec7bSml29623 pa->old_value = pa->value;
13256f45ec7bSml29623 pa->value = cfg_value;
13266f45ec7bSml29623 nxgep->intr_timeout = pa->value;
13276f45ec7bSml29623 }
13286f45ec7bSml29623
13296f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_rx_intr_time"));
13306f45ec7bSml29623 return (0);
13316f45ec7bSml29623 }
13326f45ec7bSml29623
13336f45ec7bSml29623 /* ARGSUSED */
13346f45ec7bSml29623 static int
nxge_param_set_mac_rdcgrp(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)13356f45ec7bSml29623 nxge_param_set_mac_rdcgrp(p_nxge_t nxgep, queue_t *q,
13366f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
13376f45ec7bSml29623 {
13386f45ec7bSml29623 char *end;
13396f45ec7bSml29623 uint32_t status = 0, cfg_value;
13406f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
13416f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
13426f45ec7bSml29623 p_nxge_dma_pt_cfg_t p_dma_cfgp;
13436f45ec7bSml29623 p_nxge_hw_pt_cfg_t p_cfgp;
13446f45ec7bSml29623 uint32_t *val_ptr, *old_val_ptr;
13456f45ec7bSml29623 nxge_param_map_t *mac_map;
13466f45ec7bSml29623 p_nxge_class_pt_cfg_t p_class_cfgp;
13476f45ec7bSml29623 nxge_mv_cfg_t *mac_host_info;
13486f45ec7bSml29623
13496f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_set_mac_rdcgrp "));
13506f45ec7bSml29623
13516f45ec7bSml29623 p_dma_cfgp = (p_nxge_dma_pt_cfg_t)&nxgep->pt_config;
13526f45ec7bSml29623 p_cfgp = (p_nxge_hw_pt_cfg_t)&p_dma_cfgp->hw_config;
13536f45ec7bSml29623 p_class_cfgp = (p_nxge_class_pt_cfg_t)&nxgep->class_config;
13546f45ec7bSml29623 mac_host_info = (nxge_mv_cfg_t *)&p_class_cfgp->mac_host_info[0];
13556f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_HEX);
13566f45ec7bSml29623
13576f45ec7bSml29623 /*
13586f45ec7bSml29623 * now do decoding
13596f45ec7bSml29623 */
13606f45ec7bSml29623 mac_map = (nxge_param_map_t *)&cfg_value;
13616f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, " cfg_value %x id %x map_to %x",
13626f45ec7bSml29623 cfg_value, mac_map->param_id, mac_map->map_to));
13636f45ec7bSml29623
13646f45ec7bSml29623 if ((mac_map->param_id < p_cfgp->max_macs) &&
1365678453a8Sspeer p_cfgp->grpids[mac_map->map_to]) {
13666f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
13676f45ec7bSml29623 " nxge_param_set_mac_rdcgrp mapping"
13686f45ec7bSml29623 " id %d grp %d", mac_map->param_id, mac_map->map_to));
1369adfcba55Sjoycey #if defined(__i386)
1370adfcba55Sjoycey val_ptr = (uint32_t *)(uint32_t)pa->value;
1371adfcba55Sjoycey #else
13726f45ec7bSml29623 val_ptr = (uint32_t *)pa->value;
1373adfcba55Sjoycey #endif
1374adfcba55Sjoycey #if defined(__i386)
1375adfcba55Sjoycey old_val_ptr = (uint32_t *)(uint32_t)pa->old_value;
1376adfcba55Sjoycey #else
13776f45ec7bSml29623 old_val_ptr = (uint32_t *)pa->old_value;
1378adfcba55Sjoycey #endif
13796f45ec7bSml29623 if (val_ptr[mac_map->param_id] != cfg_value) {
13806f45ec7bSml29623 old_val_ptr[mac_map->param_id] =
13816f45ec7bSml29623 val_ptr[mac_map->param_id];
13826f45ec7bSml29623 val_ptr[mac_map->param_id] = cfg_value;
13836f45ec7bSml29623 mac_host_info[mac_map->param_id].mpr_npr =
13846f45ec7bSml29623 mac_map->pref;
13856f45ec7bSml29623 mac_host_info[mac_map->param_id].flag = 1;
13866f45ec7bSml29623 mac_host_info[mac_map->param_id].rdctbl =
13876f45ec7bSml29623 mac_map->map_to;
13886f45ec7bSml29623 cfg_it = B_TRUE;
13896f45ec7bSml29623 }
13906f45ec7bSml29623 } else {
13916f45ec7bSml29623 return (EINVAL);
13926f45ec7bSml29623 }
13936f45ec7bSml29623
13946f45ec7bSml29623 if (cfg_it == B_TRUE) {
13956f45ec7bSml29623 status = nxge_logical_mac_assign_rdc_table(nxgep,
13966f45ec7bSml29623 (uint8_t)mac_map->param_id);
13976f45ec7bSml29623 if (status != NXGE_OK)
13986f45ec7bSml29623 return (EINVAL);
13996f45ec7bSml29623 }
14006f45ec7bSml29623
14016f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_set_mac_rdcgrp"));
14026f45ec7bSml29623 return (0);
14036f45ec7bSml29623 }
14046f45ec7bSml29623
14056f45ec7bSml29623 /* ARGSUSED */
14066f45ec7bSml29623 static int
nxge_param_set_vlan_rdcgrp(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)14076f45ec7bSml29623 nxge_param_set_vlan_rdcgrp(p_nxge_t nxgep, queue_t *q,
14086f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
14096f45ec7bSml29623 {
14106f45ec7bSml29623 char *end;
14116f45ec7bSml29623 uint32_t status = 0, cfg_value;
14126f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
14136f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
14146f45ec7bSml29623 p_nxge_dma_pt_cfg_t p_dma_cfgp;
14156f45ec7bSml29623 p_nxge_hw_pt_cfg_t p_cfgp;
14166f45ec7bSml29623 uint32_t *val_ptr, *old_val_ptr;
14176f45ec7bSml29623 nxge_param_map_t *vmap, *old_map;
14186f45ec7bSml29623 p_nxge_class_pt_cfg_t p_class_cfgp;
14196f45ec7bSml29623 uint64_t cfgd_vlans;
14206f45ec7bSml29623 int i, inc = 0, cfg_position;
14216f45ec7bSml29623 nxge_mv_cfg_t *vlan_tbl;
14226f45ec7bSml29623
14236f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_set_vlan_rdcgrp "));
14246f45ec7bSml29623
14256f45ec7bSml29623 p_dma_cfgp = (p_nxge_dma_pt_cfg_t)&nxgep->pt_config;
14266f45ec7bSml29623 p_cfgp = (p_nxge_hw_pt_cfg_t)&p_dma_cfgp->hw_config;
14276f45ec7bSml29623 p_class_cfgp = (p_nxge_class_pt_cfg_t)&nxgep->class_config;
14286f45ec7bSml29623 vlan_tbl = (nxge_mv_cfg_t *)&p_class_cfgp->vlan_tbl[0];
14296f45ec7bSml29623
14306f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_HEX);
14316f45ec7bSml29623
14326f45ec7bSml29623 /* now do decoding */
14336f45ec7bSml29623 cfgd_vlans = ((pa->type & NXGE_PARAM_ARRAY_CNT_MASK) >>
14346f45ec7bSml29623 NXGE_PARAM_ARRAY_CNT_SHIFT);
14356f45ec7bSml29623
14366f45ec7bSml29623 if (cfgd_vlans == NXGE_PARAM_ARRAY_INIT_SIZE) {
14376f45ec7bSml29623 /*
14386f45ec7bSml29623 * for now, we process only upto max
14396f45ec7bSml29623 * NXGE_PARAM_ARRAY_INIT_SIZE parameters
14406f45ec7bSml29623 * In the future, we may want to expand
14416f45ec7bSml29623 * the storage array and continue
14426f45ec7bSml29623 */
14436f45ec7bSml29623 return (EINVAL);
14446f45ec7bSml29623 }
14456f45ec7bSml29623
14466f45ec7bSml29623 vmap = (nxge_param_map_t *)&cfg_value;
14476f45ec7bSml29623 if ((vmap->param_id) &&
14486f45ec7bSml29623 (vmap->param_id < NXGE_MAX_VLANS) &&
14496f45ec7bSml29623 (vmap->map_to < p_cfgp->max_rdc_grpids)) {
14506f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
14516f45ec7bSml29623 "nxge_param_set_vlan_rdcgrp mapping"
14526f45ec7bSml29623 " id %d grp %d",
14536f45ec7bSml29623 vmap->param_id, vmap->map_to));
1454adfcba55Sjoycey #if defined(__i386)
1455adfcba55Sjoycey val_ptr = (uint32_t *)(uint32_t)pa->value;
1456adfcba55Sjoycey #else
14576f45ec7bSml29623 val_ptr = (uint32_t *)pa->value;
1458adfcba55Sjoycey #endif
1459adfcba55Sjoycey #if defined(__i386)
1460adfcba55Sjoycey old_val_ptr = (uint32_t *)(uint32_t)pa->old_value;
1461adfcba55Sjoycey #else
14626f45ec7bSml29623 old_val_ptr = (uint32_t *)pa->old_value;
1463adfcba55Sjoycey #endif
14646f45ec7bSml29623
14656f45ec7bSml29623 /* search to see if this vlan id is already configured */
14666f45ec7bSml29623 for (i = 0; i < cfgd_vlans; i++) {
14676f45ec7bSml29623 old_map = (nxge_param_map_t *)&val_ptr[i];
14686f45ec7bSml29623 if ((old_map->param_id == 0) ||
14696f45ec7bSml29623 (vmap->param_id == old_map->param_id) ||
14706f45ec7bSml29623 (vlan_tbl[vmap->param_id].flag)) {
14716f45ec7bSml29623 cfg_position = i;
14726f45ec7bSml29623 break;
14736f45ec7bSml29623 }
14746f45ec7bSml29623 }
14756f45ec7bSml29623
14766f45ec7bSml29623 if (cfgd_vlans == 0) {
14776f45ec7bSml29623 cfg_position = 0;
14786f45ec7bSml29623 inc++;
14796f45ec7bSml29623 }
14806f45ec7bSml29623
14816f45ec7bSml29623 if (i == cfgd_vlans) {
14826f45ec7bSml29623 cfg_position = i;
14836f45ec7bSml29623 inc++;
14846f45ec7bSml29623 }
14856f45ec7bSml29623
14866f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD2_CTL,
14876f45ec7bSml29623 "set_vlan_rdcgrp mapping"
14886f45ec7bSml29623 " i %d cfgd_vlans %llx position %d ",
14896f45ec7bSml29623 i, cfgd_vlans, cfg_position));
14906f45ec7bSml29623 if (val_ptr[cfg_position] != cfg_value) {
14916f45ec7bSml29623 old_val_ptr[cfg_position] = val_ptr[cfg_position];
14926f45ec7bSml29623 val_ptr[cfg_position] = cfg_value;
14936f45ec7bSml29623 vlan_tbl[vmap->param_id].mpr_npr = vmap->pref;
14946f45ec7bSml29623 vlan_tbl[vmap->param_id].flag = 1;
14956f45ec7bSml29623 vlan_tbl[vmap->param_id].rdctbl =
1496678453a8Sspeer vmap->map_to + p_cfgp->def_mac_rxdma_grpid;
14976f45ec7bSml29623 cfg_it = B_TRUE;
14986f45ec7bSml29623 if (inc) {
14996f45ec7bSml29623 cfgd_vlans++;
15006f45ec7bSml29623 pa->type &= ~NXGE_PARAM_ARRAY_CNT_MASK;
15016f45ec7bSml29623 pa->type |= (cfgd_vlans <<
15026f45ec7bSml29623 NXGE_PARAM_ARRAY_CNT_SHIFT);
15036f45ec7bSml29623
15046f45ec7bSml29623 }
15056f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD2_CTL,
15066f45ec7bSml29623 "after: param_set_vlan_rdcgrp "
15076f45ec7bSml29623 " cfg_vlans %llx position %d \n",
15086f45ec7bSml29623 cfgd_vlans, cfg_position));
15096f45ec7bSml29623 }
15106f45ec7bSml29623 } else {
15116f45ec7bSml29623 return (EINVAL);
15126f45ec7bSml29623 }
15136f45ec7bSml29623
15146f45ec7bSml29623 if (cfg_it == B_TRUE) {
15156f45ec7bSml29623 status = nxge_fflp_config_vlan_table(nxgep,
15166f45ec7bSml29623 (uint16_t)vmap->param_id);
15176f45ec7bSml29623 if (status != NXGE_OK)
15186f45ec7bSml29623 return (EINVAL);
15196f45ec7bSml29623 }
15206f45ec7bSml29623
15216f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_set_vlan_rdcgrp"));
15226f45ec7bSml29623 return (0);
15236f45ec7bSml29623 }
15246f45ec7bSml29623
15256f45ec7bSml29623 /* ARGSUSED */
15266f45ec7bSml29623 static int
nxge_param_get_vlan_rdcgrp(p_nxge_t nxgep,queue_t * q,mblk_t * mp,caddr_t cp)15276f45ec7bSml29623 nxge_param_get_vlan_rdcgrp(p_nxge_t nxgep, queue_t *q,
15286f45ec7bSml29623 mblk_t *mp, caddr_t cp)
15296f45ec7bSml29623 {
15306f45ec7bSml29623
15316f45ec7bSml29623 uint_t print_len, buf_len;
15326f45ec7bSml29623 p_mblk_t np;
15336f45ec7bSml29623 int i;
15346f45ec7bSml29623 uint32_t *val_ptr;
15356f45ec7bSml29623 nxge_param_map_t *vmap;
15366f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
15376f45ec7bSml29623 p_nxge_class_pt_cfg_t p_class_cfgp;
15386f45ec7bSml29623 p_nxge_dma_pt_cfg_t p_dma_cfgp;
15396f45ec7bSml29623 p_nxge_hw_pt_cfg_t p_cfgp;
15406f45ec7bSml29623 uint64_t cfgd_vlans = 0;
15416f45ec7bSml29623 nxge_mv_cfg_t *vlan_tbl;
15426f45ec7bSml29623 int buff_alloc_size =
15436f45ec7bSml29623 NXGE_NDD_INFODUMP_BUFF_SIZE * 32;
15446f45ec7bSml29623
15456f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_set_vlan_rdcgrp "));
15466f45ec7bSml29623 (void) mi_mpprintf(mp, "VLAN RDC Mapping Information for Port\t %d \n",
15476f45ec7bSml29623 nxgep->function_num);
15486f45ec7bSml29623
15496f45ec7bSml29623 if ((np = allocb(buff_alloc_size, BPRI_HI)) == NULL) {
15506f45ec7bSml29623 (void) mi_mpprintf(mp, "%s\n", "out of buffer");
15516f45ec7bSml29623 return (0);
15526f45ec7bSml29623 }
15536f45ec7bSml29623
15546f45ec7bSml29623 p_dma_cfgp = (p_nxge_dma_pt_cfg_t)&nxgep->pt_config;
15556f45ec7bSml29623 p_cfgp = (p_nxge_hw_pt_cfg_t)&p_dma_cfgp->hw_config;
15566f45ec7bSml29623
15576f45ec7bSml29623 buf_len = buff_alloc_size;
15586f45ec7bSml29623 mp->b_cont = np;
15596f45ec7bSml29623 cfgd_vlans = (pa->type & NXGE_PARAM_ARRAY_CNT_MASK) >>
15606f45ec7bSml29623 NXGE_PARAM_ARRAY_CNT_SHIFT;
15616f45ec7bSml29623
15626f45ec7bSml29623 i = (int)cfgd_vlans;
15636f45ec7bSml29623 p_class_cfgp = (p_nxge_class_pt_cfg_t)&nxgep->class_config;
15646f45ec7bSml29623 vlan_tbl = (nxge_mv_cfg_t *)&p_class_cfgp->vlan_tbl[0];
15656f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
15666f45ec7bSml29623 "Configured VLANs %d\n"
15676f45ec7bSml29623 "VLAN ID\t RDC GRP (Actual/Port)\t"
15686f45ec7bSml29623 " Prefernce\n", i);
15696f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
15706f45ec7bSml29623 buf_len -= print_len;
1571adfcba55Sjoycey #if defined(__i386)
1572adfcba55Sjoycey val_ptr = (uint32_t *)(uint32_t)pa->value;
1573adfcba55Sjoycey #else
15746f45ec7bSml29623 val_ptr = (uint32_t *)pa->value;
1575adfcba55Sjoycey #endif
15766f45ec7bSml29623
15776f45ec7bSml29623 for (i = 0; i < cfgd_vlans; i++) {
15786f45ec7bSml29623 vmap = (nxge_param_map_t *)&val_ptr[i];
15796f45ec7bSml29623 if (p_class_cfgp->vlan_tbl[vmap->param_id].flag) {
15806f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr,
15816f45ec7bSml29623 buf_len,
15826f45ec7bSml29623 " %d\t\t %d/%d\t\t %d\n",
15836f45ec7bSml29623 vmap->param_id,
15846f45ec7bSml29623 vlan_tbl[vmap->param_id].rdctbl,
15856f45ec7bSml29623 vlan_tbl[vmap->param_id].rdctbl -
1586678453a8Sspeer p_cfgp->def_mac_rxdma_grpid,
15876f45ec7bSml29623 vlan_tbl[vmap->param_id].mpr_npr);
15886f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
15896f45ec7bSml29623 buf_len -= print_len;
15906f45ec7bSml29623 }
15916f45ec7bSml29623 }
15926f45ec7bSml29623
15936f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_vlan_rdcgrp"));
15946f45ec7bSml29623 return (0);
15956f45ec7bSml29623 }
15966f45ec7bSml29623
15976f45ec7bSml29623 /* ARGSUSED */
15986f45ec7bSml29623 static int
nxge_param_get_mac_rdcgrp(p_nxge_t nxgep,queue_t * q,mblk_t * mp,caddr_t cp)15996f45ec7bSml29623 nxge_param_get_mac_rdcgrp(p_nxge_t nxgep, queue_t *q,
16006f45ec7bSml29623 mblk_t *mp, caddr_t cp)
16016f45ec7bSml29623 {
16026f45ec7bSml29623 uint_t print_len, buf_len;
16036f45ec7bSml29623 p_mblk_t np;
16046f45ec7bSml29623 int i;
16056f45ec7bSml29623 p_nxge_class_pt_cfg_t p_class_cfgp;
16066f45ec7bSml29623 p_nxge_dma_pt_cfg_t p_dma_cfgp;
16076f45ec7bSml29623 p_nxge_hw_pt_cfg_t p_cfgp;
16086f45ec7bSml29623 nxge_mv_cfg_t *mac_host_info;
16096f45ec7bSml29623
16106f45ec7bSml29623 int buff_alloc_size = NXGE_NDD_INFODUMP_BUFF_SIZE * 32;
16116f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_get_mac_rdcgrp "));
16126f45ec7bSml29623 (void) mi_mpprintf(mp,
16136f45ec7bSml29623 "MAC ADDR RDC Mapping Information for Port\t %d\n",
16146f45ec7bSml29623 nxgep->function_num);
16156f45ec7bSml29623
16166f45ec7bSml29623 if ((np = allocb(buff_alloc_size, BPRI_HI)) == NULL) {
16176f45ec7bSml29623 (void) mi_mpprintf(mp, "%s\n", "out of buffer");
16186f45ec7bSml29623 return (0);
16196f45ec7bSml29623 }
16206f45ec7bSml29623
16216f45ec7bSml29623 buf_len = buff_alloc_size;
16226f45ec7bSml29623 mp->b_cont = np;
16236f45ec7bSml29623 p_class_cfgp = (p_nxge_class_pt_cfg_t)&nxgep->class_config;
16246f45ec7bSml29623 p_dma_cfgp = (p_nxge_dma_pt_cfg_t)&nxgep->pt_config;
16256f45ec7bSml29623 p_cfgp = (p_nxge_hw_pt_cfg_t)&p_dma_cfgp->hw_config;
16266f45ec7bSml29623 mac_host_info = (nxge_mv_cfg_t *)&p_class_cfgp->mac_host_info[0];
16276f45ec7bSml29623 print_len = snprintf((char *)np->b_wptr, buf_len,
16286f45ec7bSml29623 "MAC ID\t RDC GRP (Actual/Port)\t"
16296f45ec7bSml29623 " Prefernce\n");
16306f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
16316f45ec7bSml29623 buf_len -= print_len;
16326f45ec7bSml29623 for (i = 0; i < p_cfgp->max_macs; i++) {
16336f45ec7bSml29623 if (mac_host_info[i].flag) {
16346f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr,
16356f45ec7bSml29623 buf_len,
16366f45ec7bSml29623 " %d\t %d/%d\t\t %d\n",
16376f45ec7bSml29623 i, mac_host_info[i].rdctbl,
16386f45ec7bSml29623 mac_host_info[i].rdctbl -
1639678453a8Sspeer p_cfgp->def_mac_rxdma_grpid,
16406f45ec7bSml29623 mac_host_info[i].mpr_npr);
16416f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
16426f45ec7bSml29623 buf_len -= print_len;
16436f45ec7bSml29623 }
16446f45ec7bSml29623 }
16456f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
16466f45ec7bSml29623 "Done Info Dumping \n");
16476f45ec7bSml29623 ((mblk_t *)np)->b_wptr += print_len;
16486f45ec7bSml29623 buf_len -= print_len;
16496f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_macrdcgrp"));
16506f45ec7bSml29623 return (0);
16516f45ec7bSml29623 }
16526f45ec7bSml29623
16536f45ec7bSml29623 /* ARGSUSED */
16546f45ec7bSml29623 static int
nxge_param_tcam_enable(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)16556f45ec7bSml29623 nxge_param_tcam_enable(p_nxge_t nxgep, queue_t *q,
16566f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
16576f45ec7bSml29623 {
16586f45ec7bSml29623 uint32_t status = 0, cfg_value;
16596f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
16606f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
16616f45ec7bSml29623 char *end;
16626f45ec7bSml29623
16636f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_tcam_enable"));
16646f45ec7bSml29623
16656f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_BINARY);
16666f45ec7bSml29623 if (pa->value != cfg_value) {
16676f45ec7bSml29623 pa->old_value = pa->value;
16686f45ec7bSml29623 pa->value = cfg_value;
16696f45ec7bSml29623 cfg_it = B_TRUE;
16706f45ec7bSml29623 }
16716f45ec7bSml29623
16726f45ec7bSml29623 if (cfg_it == B_TRUE) {
16736f45ec7bSml29623 if (pa->value)
16746f45ec7bSml29623 status = nxge_fflp_config_tcam_enable(nxgep);
16756f45ec7bSml29623 else
16766f45ec7bSml29623 status = nxge_fflp_config_tcam_disable(nxgep);
16776f45ec7bSml29623 if (status != NXGE_OK)
16786f45ec7bSml29623 return (EINVAL);
16796f45ec7bSml29623 }
16806f45ec7bSml29623
16816f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, " <== nxge_param_tcam_enable"));
16826f45ec7bSml29623 return (0);
16836f45ec7bSml29623 }
16846f45ec7bSml29623
16856f45ec7bSml29623 /* ARGSUSED */
16866f45ec7bSml29623 static int
nxge_param_hash_lookup_enable(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)16876f45ec7bSml29623 nxge_param_hash_lookup_enable(p_nxge_t nxgep, queue_t *q,
16886f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
16896f45ec7bSml29623 {
16906f45ec7bSml29623 uint32_t status = 0, cfg_value;
16916f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
16926f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
16936f45ec7bSml29623 char *end;
16946f45ec7bSml29623
16956f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_hash_lookup_enable"));
16966f45ec7bSml29623
16976f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_BINARY);
16986f45ec7bSml29623 if (pa->value != cfg_value) {
16996f45ec7bSml29623 pa->old_value = pa->value;
17006f45ec7bSml29623 pa->value = cfg_value;
17016f45ec7bSml29623 cfg_it = B_TRUE;
17026f45ec7bSml29623 }
17036f45ec7bSml29623
17046f45ec7bSml29623 if (cfg_it == B_TRUE) {
17056f45ec7bSml29623 if (pa->value)
17066f45ec7bSml29623 status = nxge_fflp_config_hash_lookup_enable(nxgep);
17076f45ec7bSml29623 else
17086f45ec7bSml29623 status = nxge_fflp_config_hash_lookup_disable(nxgep);
17096f45ec7bSml29623 if (status != NXGE_OK)
17106f45ec7bSml29623 return (EINVAL);
17116f45ec7bSml29623 }
17126f45ec7bSml29623
17136f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, " <== nxge_param_hash_lookup_enable"));
17146f45ec7bSml29623 return (0);
17156f45ec7bSml29623 }
17166f45ec7bSml29623
17176f45ec7bSml29623 /* ARGSUSED */
17186f45ec7bSml29623 static int
nxge_param_llc_snap_enable(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)17196f45ec7bSml29623 nxge_param_llc_snap_enable(p_nxge_t nxgep, queue_t *q,
17206f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
17216f45ec7bSml29623 {
17226f45ec7bSml29623 char *end;
17236f45ec7bSml29623 uint32_t status = 0, cfg_value;
17246f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
17256f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
17266f45ec7bSml29623
17276f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_llc_snap_enable"));
17286f45ec7bSml29623
17296f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_BINARY);
17306f45ec7bSml29623 if (pa->value != cfg_value) {
17316f45ec7bSml29623 pa->old_value = pa->value;
17326f45ec7bSml29623 pa->value = cfg_value;
17336f45ec7bSml29623 cfg_it = B_TRUE;
17346f45ec7bSml29623 }
17356f45ec7bSml29623
17366f45ec7bSml29623 if (cfg_it == B_TRUE) {
17376f45ec7bSml29623 if (pa->value)
17386f45ec7bSml29623 status = nxge_fflp_config_tcam_enable(nxgep);
17396f45ec7bSml29623 else
17406f45ec7bSml29623 status = nxge_fflp_config_tcam_disable(nxgep);
17416f45ec7bSml29623 if (status != NXGE_OK)
17426f45ec7bSml29623 return (EINVAL);
17436f45ec7bSml29623 }
17446f45ec7bSml29623
17456f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, " <== nxge_param_llc_snap_enable"));
17466f45ec7bSml29623 return (0);
17476f45ec7bSml29623 }
17486f45ec7bSml29623
17496f45ec7bSml29623 /* ARGSUSED */
17506f45ec7bSml29623 static int
nxge_param_set_ether_usr(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)17516f45ec7bSml29623 nxge_param_set_ether_usr(p_nxge_t nxgep, queue_t *q,
17526f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
17536f45ec7bSml29623 {
17546f45ec7bSml29623 char *end;
17556f45ec7bSml29623 uint8_t ether_class;
17566f45ec7bSml29623 uint32_t status = 0, cfg_value;
17576f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
17586f45ec7bSml29623 uint8_t cfg_it = B_FALSE;
17596f45ec7bSml29623
17606f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_set_ether_usr"));
17616f45ec7bSml29623
17626f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_HEX);
17636f45ec7bSml29623 if (PARAM_OUTOF_RANGE(value, end, cfg_value, pa)) {
17646f45ec7bSml29623 return (EINVAL);
17656f45ec7bSml29623 }
17666f45ec7bSml29623
17676f45ec7bSml29623 if (pa->value != cfg_value) {
17686f45ec7bSml29623 pa->old_value = pa->value;
17696f45ec7bSml29623 pa->value = cfg_value;
17706f45ec7bSml29623 cfg_it = B_TRUE;
17716f45ec7bSml29623 }
17726f45ec7bSml29623
17736f45ec7bSml29623 /* do the actual hw setup */
17746f45ec7bSml29623 if (cfg_it == B_TRUE) {
17756f45ec7bSml29623 ether_class = mi_strtol(pa->name, &end, 10);
17766f45ec7bSml29623 #ifdef lint
17776f45ec7bSml29623 ether_class = ether_class;
17786f45ec7bSml29623 #endif
17796f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, " nxge_param_set_ether_usr"));
17806f45ec7bSml29623 }
17816f45ec7bSml29623
17826f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_set_ether_usr"));
17836f45ec7bSml29623 return (status);
17846f45ec7bSml29623 }
17856f45ec7bSml29623
17866f45ec7bSml29623 /* ARGSUSED */
17876f45ec7bSml29623 static int
nxge_param_set_ip_usr(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)17886f45ec7bSml29623 nxge_param_set_ip_usr(p_nxge_t nxgep, queue_t *q,
17896f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
17906f45ec7bSml29623 {
17916f45ec7bSml29623 char *end;
17926f45ec7bSml29623 tcam_class_t class;
17936f45ec7bSml29623 uint32_t status, cfg_value;
17946f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
17956f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
17966f45ec7bSml29623
17976f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_set_ip_usr"));
17986f45ec7bSml29623
17996f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_HEX);
18006f45ec7bSml29623 if (PARAM_OUTOF_RANGE(value, end, cfg_value, pa)) {
18016f45ec7bSml29623 return (EINVAL);
18026f45ec7bSml29623 }
18036f45ec7bSml29623
18046f45ec7bSml29623 if (pa->value != cfg_value) {
18056f45ec7bSml29623 pa->old_value = pa->value;
18066f45ec7bSml29623 pa->value = cfg_value;
18076f45ec7bSml29623 cfg_it = B_TRUE;
18086f45ec7bSml29623 }
18096f45ec7bSml29623
18106f45ec7bSml29623 /* do the actual hw setup with cfg_value. */
18116f45ec7bSml29623 if (cfg_it == B_TRUE) {
18126f45ec7bSml29623 class = mi_strtol(pa->name, &end, 10);
18136f45ec7bSml29623 status = nxge_fflp_ip_usr_class_config(nxgep, class, pa->value);
18146f45ec7bSml29623 }
18156f45ec7bSml29623
18166f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_set_ip_usr"));
18176f45ec7bSml29623 return (status);
18186f45ec7bSml29623 }
18196f45ec7bSml29623
18206f45ec7bSml29623 /* ARGSUSED */
18216f45ec7bSml29623 static int
nxge_class_name_2value(p_nxge_t nxgep,char * name)18226f45ec7bSml29623 nxge_class_name_2value(p_nxge_t nxgep, char *name)
18236f45ec7bSml29623 {
18246f45ec7bSml29623 int i;
18256f45ec7bSml29623 int class_instance = param_class_opt_ip_usr4;
18266f45ec7bSml29623 p_nxge_param_t param_arr;
18276f45ec7bSml29623
18286f45ec7bSml29623 param_arr = nxgep->param_arr;
18296f45ec7bSml29623 for (i = TCAM_CLASS_IP_USER_4; i <= TCAM_CLASS_SCTP_IPV6; i++) {
18306f45ec7bSml29623 if (strcmp(param_arr[class_instance].name, name) == 0)
18316f45ec7bSml29623 return (i);
18326f45ec7bSml29623 class_instance++;
18336f45ec7bSml29623 }
18346f45ec7bSml29623 return (-1);
18356f45ec7bSml29623 }
18366f45ec7bSml29623
18376f45ec7bSml29623 /* ARGSUSED */
18381bd6825cSml29623 int
nxge_param_set_ip_opt(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)18396f45ec7bSml29623 nxge_param_set_ip_opt(p_nxge_t nxgep, queue_t *q,
18406f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
18416f45ec7bSml29623 {
18426f45ec7bSml29623 char *end;
18436f45ec7bSml29623 uint32_t status, cfg_value;
18446f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
18456f45ec7bSml29623 tcam_class_t class;
18466f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
18476f45ec7bSml29623
18486f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_set_ip_opt"));
18496f45ec7bSml29623
18506f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_HEX);
18516f45ec7bSml29623 if (PARAM_OUTOF_RANGE(value, end, cfg_value, pa)) {
18526f45ec7bSml29623 return (EINVAL);
18536f45ec7bSml29623 }
18546f45ec7bSml29623
18556f45ec7bSml29623 if (pa->value != cfg_value) {
18566f45ec7bSml29623 pa->old_value = pa->value;
18576f45ec7bSml29623 pa->value = cfg_value;
18586f45ec7bSml29623 cfg_it = B_TRUE;
18596f45ec7bSml29623 }
18606f45ec7bSml29623
18616f45ec7bSml29623 if (cfg_it == B_TRUE) {
18626f45ec7bSml29623 /* do the actual hw setup */
18636f45ec7bSml29623 class = nxge_class_name_2value(nxgep, pa->name);
18646f45ec7bSml29623 if (class == -1)
18656f45ec7bSml29623 return (EINVAL);
18666f45ec7bSml29623
1867*c1f9c6e5SSantwona Behera /* Filter out the allowed bits */
1868*c1f9c6e5SSantwona Behera pa->value &= (NXGE_CLASS_FLOW_USE_PORTNUM |
1869*c1f9c6e5SSantwona Behera NXGE_CLASS_FLOW_USE_L2DA | NXGE_CLASS_FLOW_USE_VLAN |
1870*c1f9c6e5SSantwona Behera NXGE_CLASS_FLOW_USE_PROTO | NXGE_CLASS_FLOW_USE_IPSRC |
1871*c1f9c6e5SSantwona Behera NXGE_CLASS_FLOW_USE_IPDST | NXGE_CLASS_FLOW_USE_SRC_PORT |
1872*c1f9c6e5SSantwona Behera NXGE_CLASS_FLOW_USE_DST_PORT);
1873*c1f9c6e5SSantwona Behera
18746f45ec7bSml29623 status = nxge_fflp_ip_class_config(nxgep, class, pa->value);
18756f45ec7bSml29623 if (status != NXGE_OK)
18766f45ec7bSml29623 return (EINVAL);
18776f45ec7bSml29623 }
18786f45ec7bSml29623
18796f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_set_ip_opt"));
18806f45ec7bSml29623 return (0);
18816f45ec7bSml29623 }
18826f45ec7bSml29623
18836f45ec7bSml29623 /* ARGSUSED */
18846f45ec7bSml29623 static int
nxge_param_get_ip_opt(p_nxge_t nxgep,queue_t * q,mblk_t * mp,caddr_t cp)18856f45ec7bSml29623 nxge_param_get_ip_opt(p_nxge_t nxgep, queue_t *q,
18866f45ec7bSml29623 mblk_t *mp, caddr_t cp)
18876f45ec7bSml29623 {
18886f45ec7bSml29623 uint32_t status, cfg_value;
18896f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
18906f45ec7bSml29623 tcam_class_t class;
18916f45ec7bSml29623
18926f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_get_ip_opt"));
18936f45ec7bSml29623
18946f45ec7bSml29623 /* do the actual hw setup */
18956f45ec7bSml29623 class = nxge_class_name_2value(nxgep, pa->name);
18966f45ec7bSml29623 if (class == -1)
18976f45ec7bSml29623 return (EINVAL);
18986f45ec7bSml29623
18996f45ec7bSml29623 cfg_value = 0;
19006f45ec7bSml29623 status = nxge_fflp_ip_class_config_get(nxgep, class, &cfg_value);
19016f45ec7bSml29623 if (status != NXGE_OK)
19026f45ec7bSml29623 return (EINVAL);
19036f45ec7bSml29623
1904*c1f9c6e5SSantwona Behera /* Filter out the allowed bits */
1905*c1f9c6e5SSantwona Behera cfg_value &= (NXGE_CLASS_FLOW_USE_PORTNUM | NXGE_CLASS_FLOW_USE_L2DA |
1906*c1f9c6e5SSantwona Behera NXGE_CLASS_FLOW_USE_VLAN | NXGE_CLASS_FLOW_USE_PROTO |
1907*c1f9c6e5SSantwona Behera NXGE_CLASS_FLOW_USE_IPSRC | NXGE_CLASS_FLOW_USE_IPDST |
1908*c1f9c6e5SSantwona Behera NXGE_CLASS_FLOW_USE_SRC_PORT | NXGE_CLASS_FLOW_USE_DST_PORT);
1909*c1f9c6e5SSantwona Behera
19106f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
19116f45ec7bSml29623 "nxge_param_get_ip_opt_get %x ", cfg_value));
19126f45ec7bSml29623
19136f45ec7bSml29623 pa->value = cfg_value;
19146f45ec7bSml29623 (void) mi_mpprintf(mp, "%x", cfg_value);
19156f45ec7bSml29623
19166f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_ip_opt status "));
19176f45ec7bSml29623 return (0);
19186f45ec7bSml29623 }
19196f45ec7bSml29623
19206f45ec7bSml29623 /* ARGSUSED */
19216f45ec7bSml29623 static int
nxge_param_fflp_hash_init(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)19226f45ec7bSml29623 nxge_param_fflp_hash_init(p_nxge_t nxgep, queue_t *q,
19236f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
19246f45ec7bSml29623 {
19256f45ec7bSml29623 char *end;
19266f45ec7bSml29623 uint32_t status, cfg_value;
19276f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
19286f45ec7bSml29623 tcam_class_t class;
19296f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
19306f45ec7bSml29623
19316f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_fflp_hash_init"));
19326f45ec7bSml29623
19336f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_HEX);
19346f45ec7bSml29623 if (PARAM_OUTOF_RANGE(value, end, cfg_value, pa)) {
19356f45ec7bSml29623 return (EINVAL);
19366f45ec7bSml29623 }
19376f45ec7bSml29623
19386f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
19396f45ec7bSml29623 "nxge_param_fflp_hash_init value %x", cfg_value));
19406f45ec7bSml29623
19416f45ec7bSml29623 if (pa->value != cfg_value) {
19426f45ec7bSml29623 pa->old_value = pa->value;
19436f45ec7bSml29623 pa->value = cfg_value;
19446f45ec7bSml29623 cfg_it = B_TRUE;
19456f45ec7bSml29623 }
19466f45ec7bSml29623
19476f45ec7bSml29623 if (cfg_it == B_TRUE) {
19486f45ec7bSml29623 char *h_name;
19496f45ec7bSml29623
19506f45ec7bSml29623 /* do the actual hw setup */
19516f45ec7bSml29623 h_name = pa->name;
19526f45ec7bSml29623 h_name++;
19536f45ec7bSml29623 class = mi_strtol(h_name, &end, 10);
19546f45ec7bSml29623 switch (class) {
19556f45ec7bSml29623 case 1:
19566f45ec7bSml29623 status = nxge_fflp_set_hash1(nxgep,
19576f45ec7bSml29623 (uint32_t)pa->value);
19586f45ec7bSml29623 break;
19596f45ec7bSml29623 case 2:
19606f45ec7bSml29623 status = nxge_fflp_set_hash2(nxgep,
19616f45ec7bSml29623 (uint16_t)pa->value);
19626f45ec7bSml29623 break;
19636f45ec7bSml29623
19646f45ec7bSml29623 default:
19656f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
19666f45ec7bSml29623 " nxge_param_fflp_hash_init"
19676f45ec7bSml29623 " %s Wrong hash var %d",
19686f45ec7bSml29623 pa->name, class));
19696f45ec7bSml29623 return (EINVAL);
19706f45ec7bSml29623 }
19716f45ec7bSml29623 if (status != NXGE_OK)
19726f45ec7bSml29623 return (EINVAL);
19736f45ec7bSml29623 }
19746f45ec7bSml29623
19756f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, " <== nxge_param_fflp_hash_init"));
19766f45ec7bSml29623 return (0);
19776f45ec7bSml29623 }
19786f45ec7bSml29623
19796f45ec7bSml29623 /* ARGSUSED */
19806f45ec7bSml29623 static int
nxge_param_set_grp_rdc(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)19816f45ec7bSml29623 nxge_param_set_grp_rdc(p_nxge_t nxgep, queue_t *q,
19826f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
19836f45ec7bSml29623 {
19846f45ec7bSml29623 char *end;
19856f45ec7bSml29623 uint32_t status = 0, cfg_value;
19866f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
19876f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
19886f45ec7bSml29623 int rdc_grp;
19896f45ec7bSml29623 uint8_t real_rdc;
19906f45ec7bSml29623 p_nxge_dma_pt_cfg_t p_dma_cfgp;
19916f45ec7bSml29623 p_nxge_hw_pt_cfg_t p_cfgp;
19926f45ec7bSml29623 p_nxge_rdc_grp_t rdc_grp_p;
19936f45ec7bSml29623
19946f45ec7bSml29623 p_dma_cfgp = (p_nxge_dma_pt_cfg_t)&nxgep->pt_config;
19956f45ec7bSml29623 p_cfgp = (p_nxge_hw_pt_cfg_t)&p_dma_cfgp->hw_config;
19966f45ec7bSml29623
19976f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_set_grp_rdc"));
19986f45ec7bSml29623
19996f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_ANY);
20006f45ec7bSml29623 if (PARAM_OUTOF_RANGE(value, end, cfg_value, pa)) {
20016f45ec7bSml29623 return (EINVAL);
20026f45ec7bSml29623 }
20036f45ec7bSml29623
20046f45ec7bSml29623 if (cfg_value >= p_cfgp->max_rdcs) {
20056f45ec7bSml29623 return (EINVAL);
20066f45ec7bSml29623 }
20076f45ec7bSml29623
20086f45ec7bSml29623 if (pa->value != cfg_value) {
20096f45ec7bSml29623 pa->old_value = pa->value;
20106f45ec7bSml29623 pa->value = cfg_value;
20116f45ec7bSml29623 cfg_it = B_TRUE;
20126f45ec7bSml29623 }
20136f45ec7bSml29623
20146f45ec7bSml29623 if (cfg_it == B_TRUE) {
20156f45ec7bSml29623 char *grp_name;
20166f45ec7bSml29623 grp_name = pa->name;
20176f45ec7bSml29623 grp_name += strlen("default-grp");
20186f45ec7bSml29623 rdc_grp = mi_strtol(grp_name, &end, 10);
20196f45ec7bSml29623 rdc_grp_p = &p_dma_cfgp->rdc_grps[rdc_grp];
20206f45ec7bSml29623 real_rdc = rdc_grp_p->start_rdc + cfg_value;
20216f45ec7bSml29623 if (nxge_check_rxdma_rdcgrp_member(nxgep, rdc_grp,
20226f45ec7bSml29623 cfg_value) == B_FALSE) {
20236f45ec7bSml29623 pa->value = pa->old_value;
20246f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
20256f45ec7bSml29623 " nxge_param_set_grp_rdc"
20266f45ec7bSml29623 " %d read %d actual %d outof range",
20276f45ec7bSml29623 rdc_grp, cfg_value, real_rdc));
20286f45ec7bSml29623 return (EINVAL);
20296f45ec7bSml29623 }
20306f45ec7bSml29623 status = nxge_rxdma_cfg_rdcgrp_default_rdc(nxgep, rdc_grp,
20316f45ec7bSml29623 real_rdc);
20326f45ec7bSml29623 if (status != NXGE_OK)
20336f45ec7bSml29623 return (EINVAL);
20346f45ec7bSml29623 }
20356f45ec7bSml29623
20366f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_set_grp_rdc"));
20376f45ec7bSml29623 return (0);
20386f45ec7bSml29623 }
20396f45ec7bSml29623
20406f45ec7bSml29623 /* ARGSUSED */
20416f45ec7bSml29623 static int
nxge_param_set_port_rdc(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)20426f45ec7bSml29623 nxge_param_set_port_rdc(p_nxge_t nxgep, queue_t *q,
20436f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
20446f45ec7bSml29623 {
20456f45ec7bSml29623 char *end;
20466f45ec7bSml29623 uint32_t status = B_TRUE, cfg_value;
20476f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
20486f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
20496f45ec7bSml29623
20506f45ec7bSml29623 p_nxge_dma_pt_cfg_t p_dma_cfgp;
20516f45ec7bSml29623 p_nxge_hw_pt_cfg_t p_cfgp;
20526f45ec7bSml29623
20536f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_set_port_rdc"));
20546f45ec7bSml29623 p_dma_cfgp = (p_nxge_dma_pt_cfg_t)&nxgep->pt_config;
20556f45ec7bSml29623 p_cfgp = (p_nxge_hw_pt_cfg_t)&p_dma_cfgp->hw_config;
20566f45ec7bSml29623
20576f45ec7bSml29623 cfg_value = (uint32_t)mi_strtol(value, &end, BASE_ANY);
20586f45ec7bSml29623 if (PARAM_OUTOF_RANGE(value, end, cfg_value, pa)) {
20596f45ec7bSml29623 return (EINVAL);
20606f45ec7bSml29623 }
20616f45ec7bSml29623
20626f45ec7bSml29623 if (pa->value != cfg_value) {
20636f45ec7bSml29623 if (cfg_value >= p_cfgp->max_rdcs)
20646f45ec7bSml29623 return (EINVAL);
20656f45ec7bSml29623 pa->old_value = pa->value;
20666f45ec7bSml29623 pa->value = cfg_value;
20676f45ec7bSml29623 cfg_it = B_TRUE;
20686f45ec7bSml29623 }
20696f45ec7bSml29623
20706f45ec7bSml29623 if (cfg_it == B_TRUE) {
2071678453a8Sspeer int rdc;
2072678453a8Sspeer if ((rdc = nxge_dci_map(nxgep, VP_BOUND_RX, cfg_value)) < 0)
2073678453a8Sspeer return (EINVAL);
20746f45ec7bSml29623 status = nxge_rxdma_cfg_port_default_rdc(nxgep,
2075678453a8Sspeer nxgep->function_num, rdc);
20766f45ec7bSml29623 if (status != NXGE_OK)
20776f45ec7bSml29623 return (EINVAL);
20786f45ec7bSml29623 }
20796f45ec7bSml29623
20806f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_set_port_rdc"));
20816f45ec7bSml29623 return (0);
20826f45ec7bSml29623 }
20836f45ec7bSml29623
20846f45ec7bSml29623 /* ARGSUSED */
20856f45ec7bSml29623 static int
nxge_param_set_nxge_debug_flag(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)20866f45ec7bSml29623 nxge_param_set_nxge_debug_flag(p_nxge_t nxgep, queue_t *q,
20876f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
20886f45ec7bSml29623 {
20896f45ec7bSml29623 char *end;
20906f45ec7bSml29623 uint32_t status = 0;
20916f45ec7bSml29623 uint64_t cfg_value = 0;
20926f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
20936f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
20946f45ec7bSml29623
20956f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_set_nxge_debug_flag"));
20966f45ec7bSml29623 cfg_value = mi_strtol(value, &end, BASE_HEX);
20976f45ec7bSml29623
20986f45ec7bSml29623 if (PARAM_OUTOF_RANGE(value, end, cfg_value, pa)) {
20996f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
21006f45ec7bSml29623 " nxge_param_set_nxge_debug_flag"
21016f45ec7bSml29623 " outof range %llx", cfg_value));
21026f45ec7bSml29623 return (EINVAL);
21036f45ec7bSml29623 }
21046f45ec7bSml29623 if (pa->value != cfg_value) {
21056f45ec7bSml29623 pa->old_value = pa->value;
21066f45ec7bSml29623 pa->value = cfg_value;
21076f45ec7bSml29623 cfg_it = B_TRUE;
21086f45ec7bSml29623 }
21096f45ec7bSml29623
21106f45ec7bSml29623 if (cfg_it == B_TRUE) {
21116f45ec7bSml29623 nxgep->nxge_debug_level = pa->value;
21126f45ec7bSml29623 }
21136f45ec7bSml29623
21146f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_set_nxge_debug_flag"));
21156f45ec7bSml29623 return (status);
21166f45ec7bSml29623 }
21176f45ec7bSml29623
21186f45ec7bSml29623 /* ARGSUSED */
21196f45ec7bSml29623 static int
nxge_param_get_debug_flag(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)21206f45ec7bSml29623 nxge_param_get_debug_flag(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
21216f45ec7bSml29623 {
21226f45ec7bSml29623 int status = 0;
21236f45ec7bSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
21246f45ec7bSml29623
21256f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_get_debug_flag"));
21266f45ec7bSml29623
21276f45ec7bSml29623 if (pa->value > 0xffffffff)
21286f45ec7bSml29623 (void) mi_mpprintf(mp, "%x%x", (int)(pa->value >> 32),
21296f45ec7bSml29623 (int)(pa->value & 0xffffffff));
21306f45ec7bSml29623 else
21316f45ec7bSml29623 (void) mi_mpprintf(mp, "%x", (int)pa->value);
21326f45ec7bSml29623
21336f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_debug_flag"));
21346f45ec7bSml29623 return (status);
21356f45ec7bSml29623 }
21366f45ec7bSml29623
21376f45ec7bSml29623 /* ARGSUSED */
21386f45ec7bSml29623 static int
nxge_param_set_npi_debug_flag(p_nxge_t nxgep,queue_t * q,mblk_t * mp,char * value,caddr_t cp)21396f45ec7bSml29623 nxge_param_set_npi_debug_flag(p_nxge_t nxgep, queue_t *q,
21406f45ec7bSml29623 mblk_t *mp, char *value, caddr_t cp)
21416f45ec7bSml29623 {
21426f45ec7bSml29623 char *end;
21436f45ec7bSml29623 uint32_t status = 0;
21446f45ec7bSml29623 uint64_t cfg_value = 0;
21456f45ec7bSml29623 p_nxge_param_t pa;
21466f45ec7bSml29623 uint32_t cfg_it = B_FALSE;
21476f45ec7bSml29623
21486f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_set_npi_debug_flag"));
21496f45ec7bSml29623 cfg_value = mi_strtol(value, &end, BASE_HEX);
21506f45ec7bSml29623 pa = (p_nxge_param_t)cp;
21516f45ec7bSml29623 if (PARAM_OUTOF_RANGE(value, end, cfg_value, pa)) {
21526f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, " nxge_param_set_npi_debug_flag"
21536f45ec7bSml29623 " outof range %llx", cfg_value));
21546f45ec7bSml29623 return (EINVAL);
21556f45ec7bSml29623 }
21566f45ec7bSml29623 if (pa->value != cfg_value) {
21576f45ec7bSml29623 pa->old_value = pa->value;
21586f45ec7bSml29623 pa->value = cfg_value;
21596f45ec7bSml29623 cfg_it = B_TRUE;
21606f45ec7bSml29623 }
21616f45ec7bSml29623
21626f45ec7bSml29623 if (cfg_it == B_TRUE) {
21636f45ec7bSml29623 npi_debug_level = pa->value;
21646f45ec7bSml29623 }
21656f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_set_debug_flag"));
21666f45ec7bSml29623 return (status);
21676f45ec7bSml29623 }
21686f45ec7bSml29623
21696f45ec7bSml29623 /* ARGSUSED */
21706f45ec7bSml29623 static int
nxge_param_dump_rdc(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)21716f45ec7bSml29623 nxge_param_dump_rdc(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
21726f45ec7bSml29623 {
2173678453a8Sspeer nxge_grp_set_t *set = &nxgep->rx_set;
2174678453a8Sspeer int rdc;
21756f45ec7bSml29623
21766f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, "==> nxge_param_dump_rdc"));
21776f45ec7bSml29623
2178678453a8Sspeer if (!isLDOMguest(nxgep))
21796f45ec7bSml29623 (void) npi_rxdma_dump_fzc_regs(NXGE_DEV_NPI_HANDLE(nxgep));
2180678453a8Sspeer
2181678453a8Sspeer for (rdc = 0; rdc < NXGE_MAX_TDCS; rdc++) {
2182678453a8Sspeer if ((1 << rdc) & set->owned.map) {
2183678453a8Sspeer (void) nxge_dump_rxdma_channel(nxgep, rdc);
2184678453a8Sspeer }
2185678453a8Sspeer }
21866f45ec7bSml29623
21876f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, "<== nxge_param_dump_rdc"));
21886f45ec7bSml29623 return (0);
21896f45ec7bSml29623 }
21906f45ec7bSml29623
21916f45ec7bSml29623 /* ARGSUSED */
21926f45ec7bSml29623 static int
nxge_param_dump_tdc(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)21936f45ec7bSml29623 nxge_param_dump_tdc(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
21946f45ec7bSml29623 {
2195678453a8Sspeer nxge_grp_set_t *set = &nxgep->tx_set;
2196678453a8Sspeer int tdc;
21976f45ec7bSml29623
21986f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, "==> nxge_param_dump_tdc"));
21996f45ec7bSml29623
2200678453a8Sspeer for (tdc = 0; tdc < NXGE_MAX_TDCS; tdc++) {
2201678453a8Sspeer if ((1 << tdc) & set->owned.map) {
2202678453a8Sspeer (void) nxge_txdma_regs_dump(nxgep, tdc);
2203678453a8Sspeer }
2204678453a8Sspeer }
22056f45ec7bSml29623
22066f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, "<== nxge_param_dump_tdc"));
22076f45ec7bSml29623 return (0);
22086f45ec7bSml29623 }
22096f45ec7bSml29623
22106f45ec7bSml29623 /* ARGSUSED */
22116f45ec7bSml29623 static int
nxge_param_dump_fflp_regs(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)22126f45ec7bSml29623 nxge_param_dump_fflp_regs(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
22136f45ec7bSml29623 {
22146f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, "==> nxge_param_dump_fflp_regs"));
22156f45ec7bSml29623
22166f45ec7bSml29623 (void) npi_fflp_dump_regs(NXGE_DEV_NPI_HANDLE(nxgep));
22176f45ec7bSml29623
22186f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, "<== nxge_param_dump_fflp_regs"));
22196f45ec7bSml29623 return (0);
22206f45ec7bSml29623 }
22216f45ec7bSml29623
22226f45ec7bSml29623 /* ARGSUSED */
22236f45ec7bSml29623 static int
nxge_param_dump_mac_regs(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)22246f45ec7bSml29623 nxge_param_dump_mac_regs(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
22256f45ec7bSml29623 {
22266f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, "==> nxge_param_dump_mac_regs"));
22276f45ec7bSml29623
22286f45ec7bSml29623 (void) npi_mac_dump_regs(NXGE_DEV_NPI_HANDLE(nxgep),
22296f45ec7bSml29623 nxgep->function_num);
22306f45ec7bSml29623
22316f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, "<== nxge_param_dump_mac_regs"));
22326f45ec7bSml29623 return (0);
22336f45ec7bSml29623 }
22346f45ec7bSml29623
22356f45ec7bSml29623 /* ARGSUSED */
22366f45ec7bSml29623 static int
nxge_param_dump_ipp_regs(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)22376f45ec7bSml29623 nxge_param_dump_ipp_regs(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
22386f45ec7bSml29623 {
22396f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, "==> nxge_param_dump_ipp_regs"));
22406f45ec7bSml29623
22416f45ec7bSml29623 (void) npi_ipp_dump_regs(NXGE_DEV_NPI_HANDLE(nxgep),
22426f45ec7bSml29623 nxgep->function_num);
22436f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, "<== nxge_param_dump_ipp_regs"));
22446f45ec7bSml29623 return (0);
22456f45ec7bSml29623 }
22466f45ec7bSml29623
22476f45ec7bSml29623 /* ARGSUSED */
22486f45ec7bSml29623 static int
nxge_param_dump_vlan_table(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)22496f45ec7bSml29623 nxge_param_dump_vlan_table(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
22506f45ec7bSml29623 {
22516f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_dump_vlan_table"));
22526f45ec7bSml29623
22536f45ec7bSml29623 (void) npi_fflp_vlan_tbl_dump(NXGE_DEV_NPI_HANDLE(nxgep));
22546f45ec7bSml29623
22556f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_dump_vlan_table"));
22566f45ec7bSml29623 return (0);
22576f45ec7bSml29623 }
22586f45ec7bSml29623
22596f45ec7bSml29623 /* ARGSUSED */
22606f45ec7bSml29623 static int
nxge_param_dump_rdc_table(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)22616f45ec7bSml29623 nxge_param_dump_rdc_table(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
22626f45ec7bSml29623 {
22636f45ec7bSml29623 uint8_t table;
22646f45ec7bSml29623
22656f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_dump_rdc_table"));
22666f45ec7bSml29623 for (table = 0; table < NXGE_MAX_RDC_GROUPS; table++) {
22676f45ec7bSml29623 (void) npi_rxdma_dump_rdc_table(NXGE_DEV_NPI_HANDLE(nxgep),
22686f45ec7bSml29623 table);
22696f45ec7bSml29623 }
22706f45ec7bSml29623
22716f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_dump_rdc_table"));
22726f45ec7bSml29623 return (0);
22736f45ec7bSml29623 }
22746f45ec7bSml29623
22756f45ec7bSml29623 typedef struct block_info {
22766f45ec7bSml29623 char *name;
22776f45ec7bSml29623 uint32_t offset;
22786f45ec7bSml29623 } block_info_t;
22796f45ec7bSml29623
22806f45ec7bSml29623 block_info_t reg_block[] = {
22816f45ec7bSml29623 {"PIO", PIO},
22826f45ec7bSml29623 {"FZC_PIO", FZC_PIO},
22836f45ec7bSml29623 {"FZC_XMAC", FZC_MAC},
22846f45ec7bSml29623 {"FZC_IPP", FZC_IPP},
22856f45ec7bSml29623 {"FFLP", FFLP},
22866f45ec7bSml29623 {"FZC_FFLP", FZC_FFLP},
22876f45ec7bSml29623 {"PIO_VADDR", PIO_VADDR},
22886f45ec7bSml29623 {"ZCP", ZCP},
22896f45ec7bSml29623 {"FZC_ZCP", FZC_ZCP},
22906f45ec7bSml29623 {"DMC", DMC},
22916f45ec7bSml29623 {"FZC_DMC", FZC_DMC},
22926f45ec7bSml29623 {"TXC", TXC},
22936f45ec7bSml29623 {"FZC_TXC", FZC_TXC},
22946f45ec7bSml29623 {"PIO_LDSV", PIO_LDSV},
22956f45ec7bSml29623 {"PIO_LDGIM", PIO_LDGIM},
22966f45ec7bSml29623 {"PIO_IMASK0", PIO_IMASK0},
22976f45ec7bSml29623 {"PIO_IMASK1", PIO_IMASK1},
22986f45ec7bSml29623 {"FZC_PROM", FZC_PROM},
22996f45ec7bSml29623 {"END", ALL_FF_32},
23006f45ec7bSml29623 };
23016f45ec7bSml29623
23026f45ec7bSml29623 /* ARGSUSED */
23036f45ec7bSml29623 static int
nxge_param_dump_ptrs(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t cp)23046f45ec7bSml29623 nxge_param_dump_ptrs(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t cp)
23056f45ec7bSml29623 {
23066f45ec7bSml29623 uint_t print_len, buf_len;
23076f45ec7bSml29623 p_mblk_t np;
23086f45ec7bSml29623 int rdc, tdc, block;
23096f45ec7bSml29623 uint64_t base;
23106f45ec7bSml29623 p_nxge_dma_pt_cfg_t p_dma_cfgp;
23116f45ec7bSml29623 p_nxge_hw_pt_cfg_t p_cfgp;
23126f45ec7bSml29623 int buff_alloc_size = NXGE_NDD_INFODUMP_BUFF_8K;
23136f45ec7bSml29623 p_tx_ring_t *tx_rings;
23146f45ec7bSml29623 p_rx_rcr_rings_t rx_rcr_rings;
23156f45ec7bSml29623 p_rx_rcr_ring_t *rcr_rings;
23166f45ec7bSml29623 p_rx_rbr_rings_t rx_rbr_rings;
23176f45ec7bSml29623 p_rx_rbr_ring_t *rbr_rings;
23186f45ec7bSml29623
23196f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL,
23206f45ec7bSml29623 "==> nxge_param_dump_ptrs"));
23216f45ec7bSml29623
23226f45ec7bSml29623 (void) mi_mpprintf(mp, "ptr information for Port\t %d \n",
23236f45ec7bSml29623 nxgep->function_num);
23246f45ec7bSml29623
23256f45ec7bSml29623 if ((np = allocb(buff_alloc_size, BPRI_HI)) == NULL) {
23266f45ec7bSml29623 /* The following may work even if we cannot get a large buf. */
23276f45ec7bSml29623 (void) mi_mpprintf(mp, "%s\n", "out of buffer");
23286f45ec7bSml29623 return (0);
23296f45ec7bSml29623 }
23306f45ec7bSml29623
23316f45ec7bSml29623 buf_len = buff_alloc_size;
23326f45ec7bSml29623 mp->b_cont = np;
23336f45ec7bSml29623 p_dma_cfgp = (p_nxge_dma_pt_cfg_t)&nxgep->pt_config;
23346f45ec7bSml29623 p_cfgp = (p_nxge_hw_pt_cfg_t)&p_dma_cfgp->hw_config;
23356f45ec7bSml29623
23366f45ec7bSml29623 rx_rcr_rings = nxgep->rx_rcr_rings;
23376f45ec7bSml29623 rcr_rings = rx_rcr_rings->rcr_rings;
23386f45ec7bSml29623 rx_rbr_rings = nxgep->rx_rbr_rings;
23396f45ec7bSml29623 rbr_rings = rx_rbr_rings->rbr_rings;
23406f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
23416f45ec7bSml29623 "nxgep (nxge_t) $%p\n"
23426f45ec7bSml29623 "dev_regs (dev_regs_t) $%p\n",
23438793b36bSNick Todd (void *)nxgep, (void *)nxgep->dev_regs);
23446f45ec7bSml29623
23456f45ec7bSml29623 ADVANCE_PRINT_BUFFER(np, print_len, buf_len);
23466f45ec7bSml29623
23476f45ec7bSml29623 /* do register pointers */
23486f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
23496f45ec7bSml29623 "reg base (npi_reg_ptr_t) $%p\t "
23506f45ec7bSml29623 "pci reg (npi_reg_ptr_t) $%p\n",
23518793b36bSNick Todd (void *)nxgep->dev_regs->nxge_regp,
23528793b36bSNick Todd (void *)nxgep->dev_regs->nxge_pciregp);
23536f45ec7bSml29623
23546f45ec7bSml29623 ADVANCE_PRINT_BUFFER(np, print_len, buf_len);
23556f45ec7bSml29623
23566f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
23576f45ec7bSml29623 "\nBlock \t Offset \n");
23586f45ec7bSml29623
23596f45ec7bSml29623 ADVANCE_PRINT_BUFFER(np, print_len, buf_len);
23606f45ec7bSml29623 block = 0;
2361adfcba55Sjoycey #if defined(__i386)
2362adfcba55Sjoycey base = (uint64_t)(uint32_t)nxgep->dev_regs->nxge_regp;
2363adfcba55Sjoycey #else
23646f45ec7bSml29623 base = (uint64_t)nxgep->dev_regs->nxge_regp;
2365adfcba55Sjoycey #endif
23666f45ec7bSml29623 while (reg_block[block].offset != ALL_FF_32) {
23676f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
23686f45ec7bSml29623 "%9s\t 0x%llx\n",
23696f45ec7bSml29623 reg_block[block].name,
23706f45ec7bSml29623 (unsigned long long)(reg_block[block].offset + base));
23716f45ec7bSml29623 ADVANCE_PRINT_BUFFER(np, print_len, buf_len);
23726f45ec7bSml29623 block++;
23736f45ec7bSml29623 }
23746f45ec7bSml29623
23756f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
23766f45ec7bSml29623 "\nRDC\t rcrp (rx_rcr_ring_t)\t "
23776f45ec7bSml29623 "rbrp (rx_rbr_ring_t)\n");
23786f45ec7bSml29623
23796f45ec7bSml29623 ADVANCE_PRINT_BUFFER(np, print_len, buf_len);
23806f45ec7bSml29623
23816f45ec7bSml29623 for (rdc = 0; rdc < p_cfgp->max_rdcs; rdc++) {
23826f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
23836f45ec7bSml29623 " %d\t $%p\t\t $%p\n",
23848793b36bSNick Todd rdc, (void *)rcr_rings[rdc],
23858793b36bSNick Todd (void *)rbr_rings[rdc]);
23866f45ec7bSml29623 ADVANCE_PRINT_BUFFER(np, print_len, buf_len);
23876f45ec7bSml29623 }
23886f45ec7bSml29623
23896f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
23906f45ec7bSml29623 "\nTDC\t tdcp (tx_ring_t)\n");
23916f45ec7bSml29623
23926f45ec7bSml29623 ADVANCE_PRINT_BUFFER(np, print_len, buf_len);
23936f45ec7bSml29623 tx_rings = nxgep->tx_rings->rings;
2394678453a8Sspeer for (tdc = 0; tdc < p_cfgp->tdc.count; tdc++) {
23956f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len,
23968793b36bSNick Todd " %d\t $%p\n", tdc, (void *)tx_rings[tdc]);
23976f45ec7bSml29623 ADVANCE_PRINT_BUFFER(np, print_len, buf_len);
23986f45ec7bSml29623 }
23996f45ec7bSml29623
24006f45ec7bSml29623 print_len = snprintf((char *)((mblk_t *)np)->b_wptr, buf_len, "\n\n");
24016f45ec7bSml29623
24026f45ec7bSml29623 ADVANCE_PRINT_BUFFER(np, print_len, buf_len);
24036f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, IOC_CTL, "<== nxge_param_dump_ptrs"));
24046f45ec7bSml29623 return (0);
24056f45ec7bSml29623 }
24066f45ec7bSml29623
24076f45ec7bSml29623
24086f45ec7bSml29623 /* ARGSUSED */
24096f45ec7bSml29623 int
nxge_nd_get_names(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t param)24106f45ec7bSml29623 nxge_nd_get_names(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t param)
24116f45ec7bSml29623 {
24126f45ec7bSml29623 ND *nd;
24136f45ec7bSml29623 NDE *nde;
24146f45ec7bSml29623 char *rwtag;
24156f45ec7bSml29623 boolean_t get_ok, set_ok;
24166f45ec7bSml29623 size_t param_len;
24176f45ec7bSml29623 int status = 0;
24186f45ec7bSml29623
24196f45ec7bSml29623 nd = (ND *)param;
24206f45ec7bSml29623 if (!nd)
24216f45ec7bSml29623 return (ENOENT);
24226f45ec7bSml29623
24236f45ec7bSml29623 for (nde = nd->nd_tbl; nde->nde_name; nde++) {
24246f45ec7bSml29623 get_ok = (nde->nde_get_pfi != nxge_get_default) &&
24256f45ec7bSml29623 (nde->nde_get_pfi != NULL);
24266f45ec7bSml29623 set_ok = (nde->nde_set_pfi != nxge_set_default) &&
24276f45ec7bSml29623 (nde->nde_set_pfi != NULL);
24286f45ec7bSml29623 if (get_ok) {
24296f45ec7bSml29623 if (set_ok)
24306f45ec7bSml29623 rwtag = "read and write";
24316f45ec7bSml29623 else
24326f45ec7bSml29623 rwtag = "read only";
24336f45ec7bSml29623 } else if (set_ok)
24346f45ec7bSml29623 rwtag = "write only";
24356f45ec7bSml29623 else {
24366f45ec7bSml29623 continue;
24376f45ec7bSml29623 }
24386f45ec7bSml29623 param_len = strlen(rwtag);
24396f45ec7bSml29623 param_len += strlen(nde->nde_name);
24406f45ec7bSml29623 param_len += 4;
24416f45ec7bSml29623
24426f45ec7bSml29623 (void) mi_mpprintf(mp, "%s (%s)", nde->nde_name, rwtag);
24436f45ec7bSml29623 }
24446f45ec7bSml29623 return (status);
24456f45ec7bSml29623 }
24466f45ec7bSml29623
24476f45ec7bSml29623 /* ARGSUSED */
24486f45ec7bSml29623 int
nxge_get_default(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,caddr_t data)24496f45ec7bSml29623 nxge_get_default(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, caddr_t data)
24506f45ec7bSml29623 {
24516f45ec7bSml29623 return (EACCES);
24526f45ec7bSml29623 }
24536f45ec7bSml29623
24546f45ec7bSml29623 /* ARGSUSED */
24556f45ec7bSml29623 int
nxge_set_default(p_nxge_t nxgep,queue_t * q,p_mblk_t mp,char * value,caddr_t data)24566f45ec7bSml29623 nxge_set_default(p_nxge_t nxgep, queue_t *q, p_mblk_t mp, char *value,
24576f45ec7bSml29623 caddr_t data)
24586f45ec7bSml29623 {
24596f45ec7bSml29623 return (EACCES);
24606f45ec7bSml29623 }
24616f45ec7bSml29623
24621bd6825cSml29623 boolean_t
nxge_param_link_update(p_nxge_t nxgep)24636f45ec7bSml29623 nxge_param_link_update(p_nxge_t nxgep)
24646f45ec7bSml29623 {
24656f45ec7bSml29623 p_nxge_param_t param_arr;
24666f45ec7bSml29623 nxge_param_index_t i;
24676f45ec7bSml29623 boolean_t update_xcvr;
24686f45ec7bSml29623 boolean_t update_dev;
24696f45ec7bSml29623 int instance;
24706f45ec7bSml29623 boolean_t status = B_TRUE;
24716f45ec7bSml29623
24721bd6825cSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_param_link_update"));
24736f45ec7bSml29623
24746f45ec7bSml29623 param_arr = nxgep->param_arr;
24756f45ec7bSml29623 instance = nxgep->instance;
24766f45ec7bSml29623 update_xcvr = B_FALSE;
24776f45ec7bSml29623 for (i = param_anar_1000fdx; i < param_anar_asmpause; i++) {
24786f45ec7bSml29623 update_xcvr |= param_arr[i].value;
24796f45ec7bSml29623 }
24806f45ec7bSml29623
24816f45ec7bSml29623 if (update_xcvr) {
24826f45ec7bSml29623 update_xcvr = B_FALSE;
24836f45ec7bSml29623 for (i = param_autoneg; i < param_enable_ipg0; i++) {
24846f45ec7bSml29623 update_xcvr |=
24856f45ec7bSml29623 (param_arr[i].value != param_arr[i].old_value);
24866f45ec7bSml29623 param_arr[i].old_value = param_arr[i].value;
24876f45ec7bSml29623 }
24886f45ec7bSml29623 if (update_xcvr) {
24891bd6825cSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
24901bd6825cSml29623 "==> nxge_param_link_update: update xcvr"));
24916f45ec7bSml29623 RW_ENTER_WRITER(&nxgep->filter_lock);
24926f45ec7bSml29623 (void) nxge_link_monitor(nxgep, LINK_MONITOR_STOP);
24936f45ec7bSml29623 (void) nxge_link_init(nxgep);
24946f45ec7bSml29623 (void) nxge_mac_init(nxgep);
24956f45ec7bSml29623 (void) nxge_link_monitor(nxgep, LINK_MONITOR_START);
24966f45ec7bSml29623 RW_EXIT(&nxgep->filter_lock);
24976f45ec7bSml29623 }
24986f45ec7bSml29623 } else {
24996f45ec7bSml29623 cmn_err(CE_WARN, " Last setting will leave nxge%d with "
25006f45ec7bSml29623 " no link capabilities.", instance);
25016f45ec7bSml29623 cmn_err(CE_WARN, " Restoring previous setting.");
25026f45ec7bSml29623 for (i = param_anar_1000fdx; i < param_anar_asmpause; i++)
25036f45ec7bSml29623 param_arr[i].value = param_arr[i].old_value;
25046f45ec7bSml29623 }
25056f45ec7bSml29623
25066f45ec7bSml29623 update_dev = B_FALSE;
25076f45ec7bSml29623
25086f45ec7bSml29623 if (update_dev) {
25096f45ec7bSml29623 RW_ENTER_WRITER(&nxgep->filter_lock);
25101bd6825cSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
25111bd6825cSml29623 "==> nxge_param_link_update: update dev"));
25126f45ec7bSml29623 (void) nxge_rx_mac_disable(nxgep);
25136f45ec7bSml29623 (void) nxge_tx_mac_disable(nxgep);
25146f45ec7bSml29623 (void) nxge_tx_mac_enable(nxgep);
25156f45ec7bSml29623 (void) nxge_rx_mac_enable(nxgep);
25166f45ec7bSml29623 RW_EXIT(&nxgep->filter_lock);
25176f45ec7bSml29623 }
25186f45ec7bSml29623
25196f45ec7bSml29623 nxge_param_hw_update_exit:
25206f45ec7bSml29623 NXGE_DEBUG_MSG((nxgep, DDI_CTL,
25216f45ec7bSml29623 "<== nxge_param_link_update status = 0x%08x", status));
25226f45ec7bSml29623 return (status);
25236f45ec7bSml29623 }
25241bd6825cSml29623
25251bd6825cSml29623 /*
25261bd6825cSml29623 * synchronize the adv* and en* parameters.
25271bd6825cSml29623 *
25281bd6825cSml29623 * See comments in <sys/dld.h> for details of the *_en_*
25291bd6825cSml29623 * parameters. The usage of ndd for setting adv parameters will
25301bd6825cSml29623 * synchronize all the en parameters with the nxge parameters,
25311bd6825cSml29623 * implicitly disabling any settings made via dladm.
25321bd6825cSml29623 */
25331bd6825cSml29623 static void
nxge_param_sync(p_nxge_t nxgep)25341bd6825cSml29623 nxge_param_sync(p_nxge_t nxgep)
25351bd6825cSml29623 {
25361bd6825cSml29623 p_nxge_param_t param_arr;
25371bd6825cSml29623 param_arr = nxgep->param_arr;
25381bd6825cSml29623
25391bd6825cSml29623 nxgep->param_en_pause = param_arr[param_anar_pause].value;
25401bd6825cSml29623 nxgep->param_en_1000fdx = param_arr[param_anar_1000fdx].value;
25411bd6825cSml29623 nxgep->param_en_100fdx = param_arr[param_anar_100fdx].value;
25421bd6825cSml29623 nxgep->param_en_10fdx = param_arr[param_anar_10fdx].value;
25431bd6825cSml29623 }
25441bd6825cSml29623
25451bd6825cSml29623 /* ARGSUSED */
25461bd6825cSml29623 int
nxge_dld_get_ip_opt(p_nxge_t nxgep,caddr_t cp)25471bd6825cSml29623 nxge_dld_get_ip_opt(p_nxge_t nxgep, caddr_t cp)
25481bd6825cSml29623 {
25491bd6825cSml29623 uint32_t status, cfg_value;
25501bd6825cSml29623 p_nxge_param_t pa = (p_nxge_param_t)cp;
25511bd6825cSml29623 tcam_class_t class;
25521bd6825cSml29623
25531bd6825cSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "==> nxge_dld_get_ip_opt"));
25541bd6825cSml29623
25551bd6825cSml29623 /* do the actual hw setup */
25561bd6825cSml29623 class = nxge_class_name_2value(nxgep, pa->name);
25571bd6825cSml29623 if (class == -1)
25581bd6825cSml29623 return (EINVAL);
25591bd6825cSml29623
25601bd6825cSml29623 cfg_value = 0;
25611bd6825cSml29623 status = nxge_fflp_ip_class_config_get(nxgep, class, &cfg_value);
25621bd6825cSml29623 if (status != NXGE_OK)
25631bd6825cSml29623 return (EINVAL);
25641bd6825cSml29623
2565*c1f9c6e5SSantwona Behera /* Filter out the allowed bits */
2566*c1f9c6e5SSantwona Behera cfg_value &= (NXGE_CLASS_FLOW_USE_PORTNUM | NXGE_CLASS_FLOW_USE_L2DA |
2567*c1f9c6e5SSantwona Behera NXGE_CLASS_FLOW_USE_VLAN | NXGE_CLASS_FLOW_USE_PROTO |
2568*c1f9c6e5SSantwona Behera NXGE_CLASS_FLOW_USE_IPSRC | NXGE_CLASS_FLOW_USE_IPDST |
2569*c1f9c6e5SSantwona Behera NXGE_CLASS_FLOW_USE_SRC_PORT | NXGE_CLASS_FLOW_USE_DST_PORT);
2570*c1f9c6e5SSantwona Behera
25711bd6825cSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL,
25721bd6825cSml29623 "nxge_param_get_ip_opt_get %x ", cfg_value));
25731bd6825cSml29623
25741bd6825cSml29623 pa->value = cfg_value;
25751bd6825cSml29623
25761bd6825cSml29623 NXGE_DEBUG_MSG((nxgep, NDD_CTL, "<== nxge_param_get_ip_opt status "));
25771bd6825cSml29623 return (0);
25781bd6825cSml29623 }
2579