19da57d7bSbt150084 /* 29da57d7bSbt150084 * CDDL HEADER START 39da57d7bSbt150084 * 49da57d7bSbt150084 * The contents of this file are subject to the terms of the 59da57d7bSbt150084 * Common Development and Distribution License (the "License"). 69da57d7bSbt150084 * You may not use this file except in compliance with the License. 79da57d7bSbt150084 * 8da14cebeSEric Cheng * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9da14cebeSEric Cheng * or http://www.opensolaris.org/os/licensing. 109da57d7bSbt150084 * See the License for the specific language governing permissions 119da57d7bSbt150084 * and limitations under the License. 129da57d7bSbt150084 * 13da14cebeSEric Cheng * When distributing Covered Code, include this CDDL HEADER in each 14da14cebeSEric Cheng * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 159da57d7bSbt150084 * If applicable, add the following below this CDDL HEADER, with the 169da57d7bSbt150084 * fields enclosed by brackets "[]" replaced with your own identifying 179da57d7bSbt150084 * information: Portions Copyright [yyyy] [name of copyright owner] 189da57d7bSbt150084 * 199da57d7bSbt150084 * CDDL HEADER END 209da57d7bSbt150084 */ 219da57d7bSbt150084 229da57d7bSbt150084 /* 235b6dd21fSchenlu chen - Sun Microsystems - Beijing China * Copyright(c) 2007-2010 Intel Corporation. All rights reserved. 245b6dd21fSchenlu chen - Sun Microsystems - Beijing China */ 255b6dd21fSchenlu chen - Sun Microsystems - Beijing China 265b6dd21fSchenlu chen - Sun Microsystems - Beijing China /* 275b6dd21fSchenlu chen - Sun Microsystems - Beijing China * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 2869b5a878SDan McDonald * Copyright 2012 Nexenta Systems, Inc. All rights reserved. 29238d8f47SDale Ghent * Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved. 30*59596c01SRobert Mustacchi * Copyright (c) 2017, Joyent, Inc. 31da14cebeSEric Cheng */ 329da57d7bSbt150084 339da57d7bSbt150084 #include "ixgbe_sw.h" 349da57d7bSbt150084 359da57d7bSbt150084 /* 369da57d7bSbt150084 * Bring the device out of the reset/quiesced state that it 379da57d7bSbt150084 * was in when the interface was registered. 389da57d7bSbt150084 */ 399da57d7bSbt150084 int 409da57d7bSbt150084 ixgbe_m_start(void *arg) 419da57d7bSbt150084 { 429da57d7bSbt150084 ixgbe_t *ixgbe = (ixgbe_t *)arg; 439da57d7bSbt150084 449da57d7bSbt150084 mutex_enter(&ixgbe->gen_lock); 459da57d7bSbt150084 469da57d7bSbt150084 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) { 479da57d7bSbt150084 mutex_exit(&ixgbe->gen_lock); 489da57d7bSbt150084 return (ECANCELED); 499da57d7bSbt150084 } 509da57d7bSbt150084 51ea65739eSchenlu chen - Sun Microsystems - Beijing China if (ixgbe_start(ixgbe, B_TRUE) != IXGBE_SUCCESS) { 529da57d7bSbt150084 mutex_exit(&ixgbe->gen_lock); 539da57d7bSbt150084 return (EIO); 549da57d7bSbt150084 } 559da57d7bSbt150084 5662e6e1adSPaul Guo atomic_or_32(&ixgbe->ixgbe_state, IXGBE_STARTED); 579da57d7bSbt150084 589da57d7bSbt150084 mutex_exit(&ixgbe->gen_lock); 599da57d7bSbt150084 609da57d7bSbt150084 /* 619da57d7bSbt150084 * Enable and start the watchdog timer 629da57d7bSbt150084 */ 639da57d7bSbt150084 ixgbe_enable_watchdog_timer(ixgbe); 649da57d7bSbt150084 659da57d7bSbt150084 return (0); 669da57d7bSbt150084 } 679da57d7bSbt150084 689da57d7bSbt150084 /* 699da57d7bSbt150084 * Stop the device and put it in a reset/quiesced state such 709da57d7bSbt150084 * that the interface can be unregistered. 719da57d7bSbt150084 */ 729da57d7bSbt150084 void 739da57d7bSbt150084 ixgbe_m_stop(void *arg) 749da57d7bSbt150084 { 759da57d7bSbt150084 ixgbe_t *ixgbe = (ixgbe_t *)arg; 769da57d7bSbt150084 779da57d7bSbt150084 mutex_enter(&ixgbe->gen_lock); 789da57d7bSbt150084 799da57d7bSbt150084 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) { 809da57d7bSbt150084 mutex_exit(&ixgbe->gen_lock); 819da57d7bSbt150084 return; 829da57d7bSbt150084 } 839da57d7bSbt150084 8462e6e1adSPaul Guo atomic_and_32(&ixgbe->ixgbe_state, ~IXGBE_STARTED); 859da57d7bSbt150084 86ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe_stop(ixgbe, B_TRUE); 879da57d7bSbt150084 889da57d7bSbt150084 mutex_exit(&ixgbe->gen_lock); 899da57d7bSbt150084 909da57d7bSbt150084 /* 919da57d7bSbt150084 * Disable and stop the watchdog timer 929da57d7bSbt150084 */ 939da57d7bSbt150084 ixgbe_disable_watchdog_timer(ixgbe); 949da57d7bSbt150084 } 959da57d7bSbt150084 969da57d7bSbt150084 /* 979da57d7bSbt150084 * Set the promiscuity of the device. 989da57d7bSbt150084 */ 999da57d7bSbt150084 int 1009da57d7bSbt150084 ixgbe_m_promisc(void *arg, boolean_t on) 1019da57d7bSbt150084 { 1029da57d7bSbt150084 ixgbe_t *ixgbe = (ixgbe_t *)arg; 1039da57d7bSbt150084 uint32_t reg_val; 1049da57d7bSbt150084 struct ixgbe_hw *hw = &ixgbe->hw; 1059da57d7bSbt150084 1069da57d7bSbt150084 mutex_enter(&ixgbe->gen_lock); 1079da57d7bSbt150084 1089da57d7bSbt150084 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) { 1099da57d7bSbt150084 mutex_exit(&ixgbe->gen_lock); 1109da57d7bSbt150084 return (ECANCELED); 1119da57d7bSbt150084 } 1129da57d7bSbt150084 reg_val = IXGBE_READ_REG(hw, IXGBE_FCTRL); 1139da57d7bSbt150084 1149da57d7bSbt150084 if (on) 1159da57d7bSbt150084 reg_val |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); 1169da57d7bSbt150084 else 1179da57d7bSbt150084 reg_val &= (~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE)); 1189da57d7bSbt150084 1199da57d7bSbt150084 IXGBE_WRITE_REG(&ixgbe->hw, IXGBE_FCTRL, reg_val); 1209da57d7bSbt150084 1219da57d7bSbt150084 mutex_exit(&ixgbe->gen_lock); 1229da57d7bSbt150084 1239da57d7bSbt150084 return (0); 1249da57d7bSbt150084 } 1259da57d7bSbt150084 1269da57d7bSbt150084 /* 1279da57d7bSbt150084 * Add/remove the addresses to/from the set of multicast 1289da57d7bSbt150084 * addresses for which the device will receive packets. 1299da57d7bSbt150084 */ 1309da57d7bSbt150084 int 1319da57d7bSbt150084 ixgbe_m_multicst(void *arg, boolean_t add, const uint8_t *mcst_addr) 1329da57d7bSbt150084 { 1339da57d7bSbt150084 ixgbe_t *ixgbe = (ixgbe_t *)arg; 1349da57d7bSbt150084 int result; 1359da57d7bSbt150084 1369da57d7bSbt150084 mutex_enter(&ixgbe->gen_lock); 1379da57d7bSbt150084 1389da57d7bSbt150084 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) { 1399da57d7bSbt150084 mutex_exit(&ixgbe->gen_lock); 1409da57d7bSbt150084 return (ECANCELED); 1419da57d7bSbt150084 } 1429da57d7bSbt150084 1439da57d7bSbt150084 result = (add) ? ixgbe_multicst_add(ixgbe, mcst_addr) 1449da57d7bSbt150084 : ixgbe_multicst_remove(ixgbe, mcst_addr); 1459da57d7bSbt150084 1469da57d7bSbt150084 mutex_exit(&ixgbe->gen_lock); 1479da57d7bSbt150084 1489da57d7bSbt150084 return (result); 1499da57d7bSbt150084 } 1509da57d7bSbt150084 1519da57d7bSbt150084 /* 1529da57d7bSbt150084 * Pass on M_IOCTL messages passed to the DLD, and support 1539da57d7bSbt150084 * private IOCTLs for debugging and ndd. 1549da57d7bSbt150084 */ 1559da57d7bSbt150084 void 1569da57d7bSbt150084 ixgbe_m_ioctl(void *arg, queue_t *q, mblk_t *mp) 1579da57d7bSbt150084 { 1589da57d7bSbt150084 ixgbe_t *ixgbe = (ixgbe_t *)arg; 1599da57d7bSbt150084 struct iocblk *iocp; 1609da57d7bSbt150084 enum ioc_reply status; 1619da57d7bSbt150084 1629da57d7bSbt150084 iocp = (struct iocblk *)(uintptr_t)mp->b_rptr; 1639da57d7bSbt150084 iocp->ioc_error = 0; 1649da57d7bSbt150084 165ea65739eSchenlu chen - Sun Microsystems - Beijing China mutex_enter(&ixgbe->gen_lock); 166ea65739eSchenlu chen - Sun Microsystems - Beijing China if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) { 167ea65739eSchenlu chen - Sun Microsystems - Beijing China mutex_exit(&ixgbe->gen_lock); 168ea65739eSchenlu chen - Sun Microsystems - Beijing China miocnak(q, mp, 0, EINVAL); 169ea65739eSchenlu chen - Sun Microsystems - Beijing China return; 170ea65739eSchenlu chen - Sun Microsystems - Beijing China } 171ea65739eSchenlu chen - Sun Microsystems - Beijing China mutex_exit(&ixgbe->gen_lock); 172ea65739eSchenlu chen - Sun Microsystems - Beijing China 1739da57d7bSbt150084 switch (iocp->ioc_cmd) { 1749da57d7bSbt150084 case LB_GET_INFO_SIZE: 1759da57d7bSbt150084 case LB_GET_INFO: 1769da57d7bSbt150084 case LB_GET_MODE: 1779da57d7bSbt150084 case LB_SET_MODE: 1789da57d7bSbt150084 status = ixgbe_loopback_ioctl(ixgbe, iocp, mp); 1799da57d7bSbt150084 break; 1809da57d7bSbt150084 1819da57d7bSbt150084 default: 1829da57d7bSbt150084 status = IOC_INVAL; 1839da57d7bSbt150084 break; 1849da57d7bSbt150084 } 1859da57d7bSbt150084 1869da57d7bSbt150084 /* 1879da57d7bSbt150084 * Decide how to reply 1889da57d7bSbt150084 */ 1899da57d7bSbt150084 switch (status) { 1909da57d7bSbt150084 default: 1919da57d7bSbt150084 case IOC_INVAL: 1929da57d7bSbt150084 /* 1939da57d7bSbt150084 * Error, reply with a NAK and EINVAL or the specified error 1949da57d7bSbt150084 */ 1959da57d7bSbt150084 miocnak(q, mp, 0, iocp->ioc_error == 0 ? 1969da57d7bSbt150084 EINVAL : iocp->ioc_error); 1979da57d7bSbt150084 break; 1989da57d7bSbt150084 1999da57d7bSbt150084 case IOC_DONE: 2009da57d7bSbt150084 /* 2019da57d7bSbt150084 * OK, reply already sent 2029da57d7bSbt150084 */ 2039da57d7bSbt150084 break; 2049da57d7bSbt150084 2059da57d7bSbt150084 case IOC_ACK: 2069da57d7bSbt150084 /* 2079da57d7bSbt150084 * OK, reply with an ACK 2089da57d7bSbt150084 */ 2099da57d7bSbt150084 miocack(q, mp, 0, 0); 2109da57d7bSbt150084 break; 2119da57d7bSbt150084 2129da57d7bSbt150084 case IOC_REPLY: 2139da57d7bSbt150084 /* 2149da57d7bSbt150084 * OK, send prepared reply as ACK or NAK 2159da57d7bSbt150084 */ 2169da57d7bSbt150084 mp->b_datap->db_type = iocp->ioc_error == 0 ? 2179da57d7bSbt150084 M_IOCACK : M_IOCNAK; 2189da57d7bSbt150084 qreply(q, mp); 2199da57d7bSbt150084 break; 2209da57d7bSbt150084 } 2219da57d7bSbt150084 } 2229da57d7bSbt150084 2239da57d7bSbt150084 /* 2249da57d7bSbt150084 * Obtain the MAC's capabilities and associated data from 2259da57d7bSbt150084 * the driver. 2269da57d7bSbt150084 */ 2279da57d7bSbt150084 boolean_t 2289da57d7bSbt150084 ixgbe_m_getcapab(void *arg, mac_capab_t cap, void *cap_data) 2299da57d7bSbt150084 { 2309da57d7bSbt150084 ixgbe_t *ixgbe = (ixgbe_t *)arg; 2319da57d7bSbt150084 2329da57d7bSbt150084 switch (cap) { 2339da57d7bSbt150084 case MAC_CAPAB_HCKSUM: { 2349da57d7bSbt150084 uint32_t *tx_hcksum_flags = cap_data; 2359da57d7bSbt150084 2369da57d7bSbt150084 /* 2379da57d7bSbt150084 * We advertise our capabilities only if tx hcksum offload is 2389da57d7bSbt150084 * enabled. On receive, the stack will accept checksummed 2399da57d7bSbt150084 * packets anyway, even if we haven't said we can deliver 2409da57d7bSbt150084 * them. 2419da57d7bSbt150084 */ 2429da57d7bSbt150084 if (!ixgbe->tx_hcksum_enable) 2439da57d7bSbt150084 return (B_FALSE); 2449da57d7bSbt150084 2459da57d7bSbt150084 *tx_hcksum_flags = HCKSUM_INET_PARTIAL | HCKSUM_IPHDRCKSUM; 2469da57d7bSbt150084 break; 2479da57d7bSbt150084 } 248c971fb7eSgg161487 case MAC_CAPAB_LSO: { 249c971fb7eSgg161487 mac_capab_lso_t *cap_lso = cap_data; 250c971fb7eSgg161487 251c971fb7eSgg161487 if (ixgbe->lso_enable) { 252c971fb7eSgg161487 cap_lso->lso_flags = LSO_TX_BASIC_TCP_IPV4; 253c971fb7eSgg161487 cap_lso->lso_basic_tcp_ipv4.lso_max = IXGBE_LSO_MAXLEN; 254c971fb7eSgg161487 break; 255c971fb7eSgg161487 } else { 256c971fb7eSgg161487 return (B_FALSE); 257c971fb7eSgg161487 } 258c971fb7eSgg161487 } 259da14cebeSEric Cheng case MAC_CAPAB_RINGS: { 260da14cebeSEric Cheng mac_capab_rings_t *cap_rings = cap_data; 2619da57d7bSbt150084 262da14cebeSEric Cheng switch (cap_rings->mr_type) { 263da14cebeSEric Cheng case MAC_RING_TYPE_RX: 264da14cebeSEric Cheng cap_rings->mr_group_type = MAC_GROUP_TYPE_STATIC; 265da14cebeSEric Cheng cap_rings->mr_rnum = ixgbe->num_rx_rings; 266da14cebeSEric Cheng cap_rings->mr_gnum = ixgbe->num_rx_groups; 267da14cebeSEric Cheng cap_rings->mr_rget = ixgbe_fill_ring; 268da14cebeSEric Cheng cap_rings->mr_gget = ixgbe_fill_group; 269da14cebeSEric Cheng cap_rings->mr_gaddring = NULL; 270da14cebeSEric Cheng cap_rings->mr_gremring = NULL; 271da14cebeSEric Cheng break; 272da14cebeSEric Cheng case MAC_RING_TYPE_TX: 273da14cebeSEric Cheng cap_rings->mr_group_type = MAC_GROUP_TYPE_STATIC; 274da14cebeSEric Cheng cap_rings->mr_rnum = ixgbe->num_tx_rings; 275da14cebeSEric Cheng cap_rings->mr_gnum = 0; 276da14cebeSEric Cheng cap_rings->mr_rget = ixgbe_fill_ring; 277da14cebeSEric Cheng cap_rings->mr_gget = NULL; 278da14cebeSEric Cheng break; 279da14cebeSEric Cheng default: 280da14cebeSEric Cheng break; 281da14cebeSEric Cheng } 2829da57d7bSbt150084 break; 2839da57d7bSbt150084 } 284*59596c01SRobert Mustacchi case MAC_CAPAB_TRANSCEIVER: { 285*59596c01SRobert Mustacchi mac_capab_transceiver_t *mct = cap_data; 286*59596c01SRobert Mustacchi 287*59596c01SRobert Mustacchi /* 288*59596c01SRobert Mustacchi * Rather than try and guess based on the media type whether or 289*59596c01SRobert Mustacchi * not we have a transceiver we can read, we instead will let 290*59596c01SRobert Mustacchi * the actual function calls figure that out for us. 291*59596c01SRobert Mustacchi */ 292*59596c01SRobert Mustacchi mct->mct_flags = 0; 293*59596c01SRobert Mustacchi mct->mct_ntransceivers = 1; 294*59596c01SRobert Mustacchi mct->mct_info = ixgbe_transceiver_info; 295*59596c01SRobert Mustacchi mct->mct_read = ixgbe_transceiver_read; 296*59596c01SRobert Mustacchi return (B_TRUE); 297*59596c01SRobert Mustacchi } 2989da57d7bSbt150084 default: 2999da57d7bSbt150084 return (B_FALSE); 3009da57d7bSbt150084 } 3019da57d7bSbt150084 return (B_TRUE); 3029da57d7bSbt150084 } 303ea65739eSchenlu chen - Sun Microsystems - Beijing China 304ea65739eSchenlu chen - Sun Microsystems - Beijing China int 305ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe_m_setprop(void *arg, const char *pr_name, mac_prop_id_t pr_num, 306ea65739eSchenlu chen - Sun Microsystems - Beijing China uint_t pr_valsize, const void *pr_val) 307ea65739eSchenlu chen - Sun Microsystems - Beijing China { 308ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe_t *ixgbe = (ixgbe_t *)arg; 309ea65739eSchenlu chen - Sun Microsystems - Beijing China struct ixgbe_hw *hw = &ixgbe->hw; 310ea65739eSchenlu chen - Sun Microsystems - Beijing China int err = 0; 311ea65739eSchenlu chen - Sun Microsystems - Beijing China uint32_t flow_control; 312ea65739eSchenlu chen - Sun Microsystems - Beijing China uint32_t cur_mtu, new_mtu; 313ea65739eSchenlu chen - Sun Microsystems - Beijing China uint32_t rx_size; 314ea65739eSchenlu chen - Sun Microsystems - Beijing China uint32_t tx_size; 3157e579c30SDale Ghent ixgbe_link_speed speeds = 0; 316ea65739eSchenlu chen - Sun Microsystems - Beijing China 317ea65739eSchenlu chen - Sun Microsystems - Beijing China mutex_enter(&ixgbe->gen_lock); 318ea65739eSchenlu chen - Sun Microsystems - Beijing China if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) { 319ea65739eSchenlu chen - Sun Microsystems - Beijing China mutex_exit(&ixgbe->gen_lock); 320ea65739eSchenlu chen - Sun Microsystems - Beijing China return (ECANCELED); 321ea65739eSchenlu chen - Sun Microsystems - Beijing China } 322ea65739eSchenlu chen - Sun Microsystems - Beijing China 3237e579c30SDale Ghent /* 3247e579c30SDale Ghent * We cannot always rely on the common code maintaining 3257e579c30SDale Ghent * hw->phy.speeds_supported, therefore we fall back to use the recorded 3267e579c30SDale Ghent * supported speeds which were obtained during instance init in 3277e579c30SDale Ghent * ixgbe_init_params(). 3287e579c30SDale Ghent */ 3297e579c30SDale Ghent speeds = hw->phy.speeds_supported; 3307e579c30SDale Ghent if (speeds == 0) 3317e579c30SDale Ghent speeds = ixgbe->speeds_supported; 3327e579c30SDale Ghent 333ea65739eSchenlu chen - Sun Microsystems - Beijing China if (ixgbe->loopback_mode != IXGBE_LB_NONE && 334ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe_param_locked(pr_num)) { 335ea65739eSchenlu chen - Sun Microsystems - Beijing China /* 336ea65739eSchenlu chen - Sun Microsystems - Beijing China * All en_* parameters are locked (read-only) 337ea65739eSchenlu chen - Sun Microsystems - Beijing China * while the device is in any sort of loopback mode. 338ea65739eSchenlu chen - Sun Microsystems - Beijing China */ 339ea65739eSchenlu chen - Sun Microsystems - Beijing China mutex_exit(&ixgbe->gen_lock); 340ea65739eSchenlu chen - Sun Microsystems - Beijing China return (EBUSY); 341ea65739eSchenlu chen - Sun Microsystems - Beijing China } 342ea65739eSchenlu chen - Sun Microsystems - Beijing China 3437e579c30SDale Ghent /* 3447e579c30SDale Ghent * We allow speed changes only on baseT PHYs. MAC_PROP_EN_* are marked 3457e579c30SDale Ghent * read-only on non-baseT PHYs. 3467e579c30SDale Ghent */ 347ea65739eSchenlu chen - Sun Microsystems - Beijing China switch (pr_num) { 348ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_EN_10GFDX_CAP: 3497e579c30SDale Ghent if (hw->phy.media_type == ixgbe_media_type_copper && 3507e579c30SDale Ghent speeds & IXGBE_LINK_SPEED_10GB_FULL) { 3517e579c30SDale Ghent ixgbe->param_en_10000fdx_cap = *(uint8_t *)pr_val; 3527e579c30SDale Ghent goto setup_link; 3537e579c30SDale Ghent } else { 354ea65739eSchenlu chen - Sun Microsystems - Beijing China err = ENOTSUP; 355ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 3567e579c30SDale Ghent } 3577e579c30SDale Ghent case MAC_PROP_EN_5000FDX_CAP: 3587e579c30SDale Ghent if (hw->phy.media_type == ixgbe_media_type_copper && 3597e579c30SDale Ghent speeds & IXGBE_LINK_SPEED_5GB_FULL) { 3607e579c30SDale Ghent ixgbe->param_en_5000fdx_cap = *(uint8_t *)pr_val; 361ea65739eSchenlu chen - Sun Microsystems - Beijing China goto setup_link; 3627e579c30SDale Ghent } else { 3637e579c30SDale Ghent err = ENOTSUP; 3647e579c30SDale Ghent break; 3657e579c30SDale Ghent } 3667e579c30SDale Ghent case MAC_PROP_EN_2500FDX_CAP: 3677e579c30SDale Ghent if (hw->phy.media_type == ixgbe_media_type_copper && 3687e579c30SDale Ghent speeds & IXGBE_LINK_SPEED_2_5GB_FULL) { 3697e579c30SDale Ghent ixgbe->param_en_2500fdx_cap = *(uint8_t *)pr_val; 3707e579c30SDale Ghent goto setup_link; 3717e579c30SDale Ghent } else { 3727e579c30SDale Ghent err = ENOTSUP; 3737e579c30SDale Ghent break; 374ea65739eSchenlu chen - Sun Microsystems - Beijing China } 375ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_EN_1000FDX_CAP: 3767e579c30SDale Ghent if (hw->phy.media_type == ixgbe_media_type_copper && 3777e579c30SDale Ghent speeds & IXGBE_LINK_SPEED_1GB_FULL) { 3787e579c30SDale Ghent ixgbe->param_en_1000fdx_cap = *(uint8_t *)pr_val; 3797e579c30SDale Ghent goto setup_link; 3807e579c30SDale Ghent } else { 381ea65739eSchenlu chen - Sun Microsystems - Beijing China err = ENOTSUP; 382ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 383ea65739eSchenlu chen - Sun Microsystems - Beijing China } 384ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_EN_100FDX_CAP: 3857e579c30SDale Ghent if (hw->phy.media_type == ixgbe_media_type_copper && 3867e579c30SDale Ghent speeds & IXGBE_LINK_SPEED_100_FULL) { 3877e579c30SDale Ghent ixgbe->param_en_100fdx_cap = *(uint8_t *)pr_val; 3887e579c30SDale Ghent goto setup_link; 3897e579c30SDale Ghent } else { 390ea65739eSchenlu chen - Sun Microsystems - Beijing China err = ENOTSUP; 391ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 392ea65739eSchenlu chen - Sun Microsystems - Beijing China } 393ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_AUTONEG: 394ea65739eSchenlu chen - Sun Microsystems - Beijing China if (ixgbe->hw.phy.media_type != ixgbe_media_type_copper) { 395ea65739eSchenlu chen - Sun Microsystems - Beijing China err = ENOTSUP; 396ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 397ea65739eSchenlu chen - Sun Microsystems - Beijing China } else { 398ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->param_adv_autoneg_cap = *(uint8_t *)pr_val; 399ea65739eSchenlu chen - Sun Microsystems - Beijing China goto setup_link; 400ea65739eSchenlu chen - Sun Microsystems - Beijing China } 401ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_FLOWCTRL: 402ea65739eSchenlu chen - Sun Microsystems - Beijing China bcopy(pr_val, &flow_control, sizeof (flow_control)); 403ea65739eSchenlu chen - Sun Microsystems - Beijing China 404ea65739eSchenlu chen - Sun Microsystems - Beijing China switch (flow_control) { 405ea65739eSchenlu chen - Sun Microsystems - Beijing China default: 406ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 407ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 408ea65739eSchenlu chen - Sun Microsystems - Beijing China case LINK_FLOWCTRL_NONE: 409ea65739eSchenlu chen - Sun Microsystems - Beijing China hw->fc.requested_mode = ixgbe_fc_none; 410ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 411ea65739eSchenlu chen - Sun Microsystems - Beijing China case LINK_FLOWCTRL_RX: 412ea65739eSchenlu chen - Sun Microsystems - Beijing China hw->fc.requested_mode = ixgbe_fc_rx_pause; 413ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 414ea65739eSchenlu chen - Sun Microsystems - Beijing China case LINK_FLOWCTRL_TX: 415ea65739eSchenlu chen - Sun Microsystems - Beijing China hw->fc.requested_mode = ixgbe_fc_tx_pause; 416ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 417ea65739eSchenlu chen - Sun Microsystems - Beijing China case LINK_FLOWCTRL_BI: 418ea65739eSchenlu chen - Sun Microsystems - Beijing China hw->fc.requested_mode = ixgbe_fc_full; 419ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 420ea65739eSchenlu chen - Sun Microsystems - Beijing China } 421ea65739eSchenlu chen - Sun Microsystems - Beijing China setup_link: 422ea65739eSchenlu chen - Sun Microsystems - Beijing China if (err == 0) { 423ea65739eSchenlu chen - Sun Microsystems - Beijing China if (ixgbe_driver_setup_link(ixgbe, B_TRUE) != 424ea65739eSchenlu chen - Sun Microsystems - Beijing China IXGBE_SUCCESS) 425ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 426ea65739eSchenlu chen - Sun Microsystems - Beijing China } 427ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 428ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_ADV_10GFDX_CAP: 4297e579c30SDale Ghent case MAC_PROP_ADV_5000FDX_CAP: 4307e579c30SDale Ghent case MAC_PROP_ADV_2500FDX_CAP: 431ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_ADV_1000FDX_CAP: 432ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_ADV_100FDX_CAP: 433ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_STATUS: 434ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_SPEED: 435ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_DUPLEX: 436ea65739eSchenlu chen - Sun Microsystems - Beijing China err = ENOTSUP; /* read-only prop. Can't set this. */ 437ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 438ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_MTU: 439ea65739eSchenlu chen - Sun Microsystems - Beijing China cur_mtu = ixgbe->default_mtu; 440ea65739eSchenlu chen - Sun Microsystems - Beijing China bcopy(pr_val, &new_mtu, sizeof (new_mtu)); 441ea65739eSchenlu chen - Sun Microsystems - Beijing China if (new_mtu == cur_mtu) { 442ea65739eSchenlu chen - Sun Microsystems - Beijing China err = 0; 443ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 444ea65739eSchenlu chen - Sun Microsystems - Beijing China } 445ea65739eSchenlu chen - Sun Microsystems - Beijing China 4461fedc51fSWinson Wang - Sun Microsystems - Beijing China if (new_mtu < DEFAULT_MTU || new_mtu > ixgbe->capab->max_mtu) { 447ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 448ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 449ea65739eSchenlu chen - Sun Microsystems - Beijing China } 450ea65739eSchenlu chen - Sun Microsystems - Beijing China 451ea65739eSchenlu chen - Sun Microsystems - Beijing China if (ixgbe->ixgbe_state & IXGBE_STARTED) { 452ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EBUSY; 453ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 454ea65739eSchenlu chen - Sun Microsystems - Beijing China } 455ea65739eSchenlu chen - Sun Microsystems - Beijing China 456ea65739eSchenlu chen - Sun Microsystems - Beijing China err = mac_maxsdu_update(ixgbe->mac_hdl, new_mtu); 457ea65739eSchenlu chen - Sun Microsystems - Beijing China if (err == 0) { 458ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->default_mtu = new_mtu; 459ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->max_frame_size = ixgbe->default_mtu + 460ea65739eSchenlu chen - Sun Microsystems - Beijing China sizeof (struct ether_vlan_header) + ETHERFCSL; 461ea65739eSchenlu chen - Sun Microsystems - Beijing China 462ea65739eSchenlu chen - Sun Microsystems - Beijing China /* 463ea65739eSchenlu chen - Sun Microsystems - Beijing China * Set rx buffer size 464ea65739eSchenlu chen - Sun Microsystems - Beijing China */ 465ea65739eSchenlu chen - Sun Microsystems - Beijing China rx_size = ixgbe->max_frame_size + IPHDR_ALIGN_ROOM; 466ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->rx_buf_size = ((rx_size >> 10) + ((rx_size & 467ea65739eSchenlu chen - Sun Microsystems - Beijing China (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10; 468ea65739eSchenlu chen - Sun Microsystems - Beijing China 469ea65739eSchenlu chen - Sun Microsystems - Beijing China /* 470ea65739eSchenlu chen - Sun Microsystems - Beijing China * Set tx buffer size 471ea65739eSchenlu chen - Sun Microsystems - Beijing China */ 472ea65739eSchenlu chen - Sun Microsystems - Beijing China tx_size = ixgbe->max_frame_size; 473ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->tx_buf_size = ((tx_size >> 10) + ((tx_size & 474ea65739eSchenlu chen - Sun Microsystems - Beijing China (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10; 475ea65739eSchenlu chen - Sun Microsystems - Beijing China } 476ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 477ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_PRIVATE: 478ea65739eSchenlu chen - Sun Microsystems - Beijing China err = ixgbe_set_priv_prop(ixgbe, pr_name, pr_valsize, pr_val); 479ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 480ea65739eSchenlu chen - Sun Microsystems - Beijing China default: 481238d8f47SDale Ghent err = ENOTSUP; 482ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 483ea65739eSchenlu chen - Sun Microsystems - Beijing China } 484ea65739eSchenlu chen - Sun Microsystems - Beijing China mutex_exit(&ixgbe->gen_lock); 485ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 486ea65739eSchenlu chen - Sun Microsystems - Beijing China } 487ea65739eSchenlu chen - Sun Microsystems - Beijing China 488ea65739eSchenlu chen - Sun Microsystems - Beijing China int 489ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num, 4900dc2366fSVenugopal Iyer uint_t pr_valsize, void *pr_val) 491ea65739eSchenlu chen - Sun Microsystems - Beijing China { 492ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe_t *ixgbe = (ixgbe_t *)arg; 493ea65739eSchenlu chen - Sun Microsystems - Beijing China struct ixgbe_hw *hw = &ixgbe->hw; 494ea65739eSchenlu chen - Sun Microsystems - Beijing China int err = 0; 495ea65739eSchenlu chen - Sun Microsystems - Beijing China uint32_t flow_control; 496ea65739eSchenlu chen - Sun Microsystems - Beijing China uint64_t tmp = 0; 4977e579c30SDale Ghent ixgbe_link_speed speeds = 0; 4987e579c30SDale Ghent 4997e579c30SDale Ghent /* 5007e579c30SDale Ghent * We cannot always rely on the common code maintaining 5017e579c30SDale Ghent * hw->phy.speeds_supported, therefore we fall back to use the recorded 5027e579c30SDale Ghent * supported speeds which were obtained during instance init in 5037e579c30SDale Ghent * ixgbe_init_params(). 5047e579c30SDale Ghent */ 5057e579c30SDale Ghent speeds = hw->phy.speeds_supported; 5067e579c30SDale Ghent if (speeds == 0) 5077e579c30SDale Ghent speeds = ixgbe->speeds_supported; 508ea65739eSchenlu chen - Sun Microsystems - Beijing China 509ea65739eSchenlu chen - Sun Microsystems - Beijing China switch (pr_num) { 510ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_DUPLEX: 5110dc2366fSVenugopal Iyer ASSERT(pr_valsize >= sizeof (link_duplex_t)); 512ea65739eSchenlu chen - Sun Microsystems - Beijing China bcopy(&ixgbe->link_duplex, pr_val, 513ea65739eSchenlu chen - Sun Microsystems - Beijing China sizeof (link_duplex_t)); 514ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 515ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_SPEED: 5160dc2366fSVenugopal Iyer ASSERT(pr_valsize >= sizeof (uint64_t)); 517ea65739eSchenlu chen - Sun Microsystems - Beijing China tmp = ixgbe->link_speed * 1000000ull; 518ea65739eSchenlu chen - Sun Microsystems - Beijing China bcopy(&tmp, pr_val, sizeof (tmp)); 519ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 520ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_AUTONEG: 5210dc2366fSVenugopal Iyer *(uint8_t *)pr_val = ixgbe->param_adv_autoneg_cap; 522ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 523ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_FLOWCTRL: 5240dc2366fSVenugopal Iyer ASSERT(pr_valsize >= sizeof (uint32_t)); 5250dc2366fSVenugopal Iyer 526ea65739eSchenlu chen - Sun Microsystems - Beijing China switch (hw->fc.requested_mode) { 527ea65739eSchenlu chen - Sun Microsystems - Beijing China case ixgbe_fc_none: 528ea65739eSchenlu chen - Sun Microsystems - Beijing China flow_control = LINK_FLOWCTRL_NONE; 529ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 530ea65739eSchenlu chen - Sun Microsystems - Beijing China case ixgbe_fc_rx_pause: 531ea65739eSchenlu chen - Sun Microsystems - Beijing China flow_control = LINK_FLOWCTRL_RX; 532ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 533ea65739eSchenlu chen - Sun Microsystems - Beijing China case ixgbe_fc_tx_pause: 534ea65739eSchenlu chen - Sun Microsystems - Beijing China flow_control = LINK_FLOWCTRL_TX; 535ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 536ea65739eSchenlu chen - Sun Microsystems - Beijing China case ixgbe_fc_full: 537ea65739eSchenlu chen - Sun Microsystems - Beijing China flow_control = LINK_FLOWCTRL_BI; 538ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 539ea65739eSchenlu chen - Sun Microsystems - Beijing China } 540ea65739eSchenlu chen - Sun Microsystems - Beijing China bcopy(&flow_control, pr_val, sizeof (flow_control)); 541ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 542ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_ADV_10GFDX_CAP: 5437e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_10GB_FULL) 5440dc2366fSVenugopal Iyer *(uint8_t *)pr_val = ixgbe->param_adv_10000fdx_cap; 5457e579c30SDale Ghent else 5467e579c30SDale Ghent err = ENOTSUP; 547ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 548ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_EN_10GFDX_CAP: 5497e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_10GB_FULL) 5500dc2366fSVenugopal Iyer *(uint8_t *)pr_val = ixgbe->param_en_10000fdx_cap; 5517e579c30SDale Ghent else 5527e579c30SDale Ghent err = ENOTSUP; 5537e579c30SDale Ghent break; 5547e579c30SDale Ghent case MAC_PROP_ADV_5000FDX_CAP: 5557e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_5GB_FULL) 5567e579c30SDale Ghent *(uint8_t *)pr_val = ixgbe->param_adv_5000fdx_cap; 5577e579c30SDale Ghent else 5587e579c30SDale Ghent err = ENOTSUP; 5597e579c30SDale Ghent break; 5607e579c30SDale Ghent case MAC_PROP_EN_5000FDX_CAP: 5617e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_5GB_FULL) 5627e579c30SDale Ghent *(uint8_t *)pr_val = ixgbe->param_en_5000fdx_cap; 5637e579c30SDale Ghent else 5647e579c30SDale Ghent err = ENOTSUP; 5657e579c30SDale Ghent break; 5667e579c30SDale Ghent case MAC_PROP_ADV_2500FDX_CAP: 5677e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_2_5GB_FULL) 5687e579c30SDale Ghent *(uint8_t *)pr_val = ixgbe->param_adv_2500fdx_cap; 5697e579c30SDale Ghent else 5707e579c30SDale Ghent err = ENOTSUP; 5717e579c30SDale Ghent break; 5727e579c30SDale Ghent case MAC_PROP_EN_2500FDX_CAP: 5737e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_2_5GB_FULL) 5747e579c30SDale Ghent *(uint8_t *)pr_val = ixgbe->param_en_2500fdx_cap; 5757e579c30SDale Ghent else 5767e579c30SDale Ghent err = ENOTSUP; 577ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 578ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_ADV_1000FDX_CAP: 5797e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_1GB_FULL) 5800dc2366fSVenugopal Iyer *(uint8_t *)pr_val = ixgbe->param_adv_1000fdx_cap; 5817e579c30SDale Ghent else 5827e579c30SDale Ghent err = ENOTSUP; 583ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 584ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_EN_1000FDX_CAP: 5857e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_1GB_FULL) 5860dc2366fSVenugopal Iyer *(uint8_t *)pr_val = ixgbe->param_en_1000fdx_cap; 5877e579c30SDale Ghent else 5887e579c30SDale Ghent err = ENOTSUP; 589ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 590ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_ADV_100FDX_CAP: 5917e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_100_FULL) 5920dc2366fSVenugopal Iyer *(uint8_t *)pr_val = ixgbe->param_adv_100fdx_cap; 5937e579c30SDale Ghent else 5947e579c30SDale Ghent err = ENOTSUP; 595ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 596ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_EN_100FDX_CAP: 5977e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_100_FULL) 5980dc2366fSVenugopal Iyer *(uint8_t *)pr_val = ixgbe->param_en_100fdx_cap; 5997e579c30SDale Ghent else 6007e579c30SDale Ghent err = ENOTSUP; 601ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 602ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_PRIVATE: 603ea65739eSchenlu chen - Sun Microsystems - Beijing China err = ixgbe_get_priv_prop(ixgbe, pr_name, 6040dc2366fSVenugopal Iyer pr_valsize, pr_val); 605ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 606ea65739eSchenlu chen - Sun Microsystems - Beijing China default: 607238d8f47SDale Ghent err = ENOTSUP; 608ea65739eSchenlu chen - Sun Microsystems - Beijing China break; 609ea65739eSchenlu chen - Sun Microsystems - Beijing China } 610ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 611ea65739eSchenlu chen - Sun Microsystems - Beijing China } 612ea65739eSchenlu chen - Sun Microsystems - Beijing China 6130dc2366fSVenugopal Iyer void 6140dc2366fSVenugopal Iyer ixgbe_m_propinfo(void *arg, const char *pr_name, mac_prop_id_t pr_num, 6150dc2366fSVenugopal Iyer mac_prop_info_handle_t prh) 6160dc2366fSVenugopal Iyer { 6170dc2366fSVenugopal Iyer ixgbe_t *ixgbe = (ixgbe_t *)arg; 6187e579c30SDale Ghent struct ixgbe_hw *hw = &ixgbe->hw; 6190dc2366fSVenugopal Iyer uint_t perm; 6207e579c30SDale Ghent uint8_t value; 6217e579c30SDale Ghent ixgbe_link_speed speeds = 0; 6227e579c30SDale Ghent 6237e579c30SDale Ghent /* 6247e579c30SDale Ghent * We cannot always rely on the common code maintaining 6257e579c30SDale Ghent * hw->phy.speeds_supported, therefore we fall back to use the 6267e579c30SDale Ghent * recorded supported speeds which were obtained during instance init in 6277e579c30SDale Ghent * ixgbe_init_params(). 6287e579c30SDale Ghent */ 6297e579c30SDale Ghent speeds = hw->phy.speeds_supported; 6307e579c30SDale Ghent if (speeds == 0) 6317e579c30SDale Ghent speeds = ixgbe->speeds_supported; 6320dc2366fSVenugopal Iyer 6330dc2366fSVenugopal Iyer switch (pr_num) { 6340dc2366fSVenugopal Iyer case MAC_PROP_DUPLEX: 6350dc2366fSVenugopal Iyer case MAC_PROP_SPEED: 6365b6dd21fSchenlu chen - Sun Microsystems - Beijing China mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ); 6375b6dd21fSchenlu chen - Sun Microsystems - Beijing China break; 6385b6dd21fSchenlu chen - Sun Microsystems - Beijing China 6390dc2366fSVenugopal Iyer case MAC_PROP_ADV_100FDX_CAP: 6400dc2366fSVenugopal Iyer mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ); 6417e579c30SDale Ghent value = (speeds & IXGBE_LINK_SPEED_100_FULL) ? 1 : 0; 6427e579c30SDale Ghent mac_prop_info_set_default_uint8(prh, value); 6430dc2366fSVenugopal Iyer break; 6440dc2366fSVenugopal Iyer 6457e579c30SDale Ghent case MAC_PROP_ADV_1000FDX_CAP: 6467e579c30SDale Ghent mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ); 6477e579c30SDale Ghent value = (speeds & IXGBE_LINK_SPEED_1GB_FULL) ? 1 : 0; 6487e579c30SDale Ghent mac_prop_info_set_default_uint8(prh, value); 6497e579c30SDale Ghent break; 6507e579c30SDale Ghent 6517e579c30SDale Ghent case MAC_PROP_ADV_2500FDX_CAP: 6527e579c30SDale Ghent mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ); 6537e579c30SDale Ghent value = (speeds & IXGBE_LINK_SPEED_2_5GB_FULL) ? 1 : 0; 6547e579c30SDale Ghent mac_prop_info_set_default_uint8(prh, value); 6557e579c30SDale Ghent break; 6567e579c30SDale Ghent 6577e579c30SDale Ghent case MAC_PROP_ADV_5000FDX_CAP: 6587e579c30SDale Ghent mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ); 6597e579c30SDale Ghent value = (speeds & IXGBE_LINK_SPEED_5GB_FULL) ? 1 : 0; 6607e579c30SDale Ghent mac_prop_info_set_default_uint8(prh, value); 6617e579c30SDale Ghent break; 6627e579c30SDale Ghent 6637e579c30SDale Ghent case MAC_PROP_ADV_10GFDX_CAP: 6647e579c30SDale Ghent mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ); 6657e579c30SDale Ghent value = (speeds & IXGBE_LINK_SPEED_10GB_FULL) ? 1 : 0; 6667e579c30SDale Ghent mac_prop_info_set_default_uint8(prh, value); 6677e579c30SDale Ghent break; 6687e579c30SDale Ghent 6697e579c30SDale Ghent /* 6707e579c30SDale Ghent * We allow speed changes only on baseT PHYs. MAC_PROP_EN_* are marked 6717e579c30SDale Ghent * read-only on non-baseT (SFP) PHYs. 6727e579c30SDale Ghent */ 6730dc2366fSVenugopal Iyer case MAC_PROP_AUTONEG: 6747e579c30SDale Ghent perm = (hw->phy.media_type == ixgbe_media_type_copper) ? 6750dc2366fSVenugopal Iyer MAC_PROP_PERM_RW : MAC_PROP_PERM_READ; 6760dc2366fSVenugopal Iyer mac_prop_info_set_perm(prh, perm); 6775b6dd21fSchenlu chen - Sun Microsystems - Beijing China mac_prop_info_set_default_uint8(prh, 1); 6780dc2366fSVenugopal Iyer break; 6790dc2366fSVenugopal Iyer 6807e579c30SDale Ghent case MAC_PROP_EN_10GFDX_CAP: 6817e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_10GB_FULL) { 6827e579c30SDale Ghent perm = (hw->phy.media_type == ixgbe_media_type_copper) ? 6837e579c30SDale Ghent MAC_PROP_PERM_RW : MAC_PROP_PERM_READ; 6847e579c30SDale Ghent mac_prop_info_set_perm(prh, perm); 6857e579c30SDale Ghent mac_prop_info_set_default_uint8(prh, 1); 6867e579c30SDale Ghent } 6877e579c30SDale Ghent break; 6887e579c30SDale Ghent 6897e579c30SDale Ghent case MAC_PROP_EN_5000FDX_CAP: 6907e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_5GB_FULL) { 6917e579c30SDale Ghent perm = (hw->phy.media_type == ixgbe_media_type_copper) ? 6927e579c30SDale Ghent MAC_PROP_PERM_RW : MAC_PROP_PERM_READ; 6937e579c30SDale Ghent mac_prop_info_set_perm(prh, perm); 6947e579c30SDale Ghent mac_prop_info_set_default_uint8(prh, 1); 6957e579c30SDale Ghent } 6967e579c30SDale Ghent break; 6977e579c30SDale Ghent 6987e579c30SDale Ghent case MAC_PROP_EN_2500FDX_CAP: 6997e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_2_5GB_FULL) { 7007e579c30SDale Ghent perm = (hw->phy.media_type == ixgbe_media_type_copper) ? 7017e579c30SDale Ghent MAC_PROP_PERM_RW : MAC_PROP_PERM_READ; 7027e579c30SDale Ghent mac_prop_info_set_perm(prh, perm); 7037e579c30SDale Ghent mac_prop_info_set_default_uint8(prh, 1); 7047e579c30SDale Ghent } 7057e579c30SDale Ghent break; 7067e579c30SDale Ghent 7077e579c30SDale Ghent case MAC_PROP_EN_1000FDX_CAP: 7087e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_1GB_FULL) { 7097e579c30SDale Ghent perm = (hw->phy.media_type == ixgbe_media_type_copper) ? 7107e579c30SDale Ghent MAC_PROP_PERM_RW : MAC_PROP_PERM_READ; 7117e579c30SDale Ghent mac_prop_info_set_perm(prh, perm); 7127e579c30SDale Ghent mac_prop_info_set_default_uint8(prh, 1); 7137e579c30SDale Ghent } 7147e579c30SDale Ghent break; 7157e579c30SDale Ghent 7167e579c30SDale Ghent case MAC_PROP_EN_100FDX_CAP: 7177e579c30SDale Ghent if (speeds & IXGBE_LINK_SPEED_100_FULL) { 7187e579c30SDale Ghent perm = (hw->phy.media_type == ixgbe_media_type_copper) ? 7197e579c30SDale Ghent MAC_PROP_PERM_RW : MAC_PROP_PERM_READ; 7207e579c30SDale Ghent mac_prop_info_set_perm(prh, perm); 7217e579c30SDale Ghent mac_prop_info_set_default_uint8(prh, 1); 7227e579c30SDale Ghent } 7237e579c30SDale Ghent break; 7247e579c30SDale Ghent 7250dc2366fSVenugopal Iyer case MAC_PROP_FLOWCTRL: 7260dc2366fSVenugopal Iyer mac_prop_info_set_default_link_flowctrl(prh, 7270dc2366fSVenugopal Iyer LINK_FLOWCTRL_NONE); 7280dc2366fSVenugopal Iyer break; 7290dc2366fSVenugopal Iyer 7300dc2366fSVenugopal Iyer case MAC_PROP_MTU: 7310dc2366fSVenugopal Iyer mac_prop_info_set_range_uint32(prh, 7320dc2366fSVenugopal Iyer DEFAULT_MTU, ixgbe->capab->max_mtu); 7330dc2366fSVenugopal Iyer break; 7340dc2366fSVenugopal Iyer 7350dc2366fSVenugopal Iyer case MAC_PROP_PRIVATE: { 7360dc2366fSVenugopal Iyer char valstr[64]; 7370dc2366fSVenugopal Iyer int value; 7380dc2366fSVenugopal Iyer 7390dc2366fSVenugopal Iyer bzero(valstr, sizeof (valstr)); 7400dc2366fSVenugopal Iyer 7410dc2366fSVenugopal Iyer if (strcmp(pr_name, "_adv_pause_cap") == 0 || 7420dc2366fSVenugopal Iyer strcmp(pr_name, "_adv_asym_pause_cap") == 0) { 7430dc2366fSVenugopal Iyer mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ); 7440dc2366fSVenugopal Iyer return; 7450dc2366fSVenugopal Iyer } 7460dc2366fSVenugopal Iyer 7470dc2366fSVenugopal Iyer if (strcmp(pr_name, "_tx_copy_thresh") == 0) { 7480dc2366fSVenugopal Iyer value = DEFAULT_TX_COPY_THRESHOLD; 7490dc2366fSVenugopal Iyer } else if (strcmp(pr_name, "_tx_recycle_thresh") == 0) { 7500dc2366fSVenugopal Iyer value = DEFAULT_TX_RECYCLE_THRESHOLD; 7510dc2366fSVenugopal Iyer } else if (strcmp(pr_name, "_tx_overload_thresh") == 0) { 7520dc2366fSVenugopal Iyer value = DEFAULT_TX_OVERLOAD_THRESHOLD; 7530dc2366fSVenugopal Iyer } else if (strcmp(pr_name, "_tx_resched_thresh") == 0) { 7540dc2366fSVenugopal Iyer value = DEFAULT_TX_RESCHED_THRESHOLD; 7550dc2366fSVenugopal Iyer } else if (strcmp(pr_name, "_rx_copy_thresh") == 0) { 7560dc2366fSVenugopal Iyer value = DEFAULT_RX_COPY_THRESHOLD; 7570dc2366fSVenugopal Iyer } else if (strcmp(pr_name, "_rx_limit_per_intr") == 0) { 7580dc2366fSVenugopal Iyer value = DEFAULT_RX_LIMIT_PER_INTR; 7590dc2366fSVenugopal Iyer } if (strcmp(pr_name, "_intr_throttling") == 0) { 7600dc2366fSVenugopal Iyer value = ixgbe->capab->def_intr_throttle; 7610dc2366fSVenugopal Iyer } else { 7620dc2366fSVenugopal Iyer return; 7630dc2366fSVenugopal Iyer } 7640dc2366fSVenugopal Iyer 7650dc2366fSVenugopal Iyer (void) snprintf(valstr, sizeof (valstr), "%x", value); 7660dc2366fSVenugopal Iyer } 7670dc2366fSVenugopal Iyer } 7680dc2366fSVenugopal Iyer } 7690dc2366fSVenugopal Iyer 770ea65739eSchenlu chen - Sun Microsystems - Beijing China boolean_t 771ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe_param_locked(mac_prop_id_t pr_num) 772ea65739eSchenlu chen - Sun Microsystems - Beijing China { 773ea65739eSchenlu chen - Sun Microsystems - Beijing China /* 774ea65739eSchenlu chen - Sun Microsystems - Beijing China * All en_* parameters are locked (read-only) while 775ea65739eSchenlu chen - Sun Microsystems - Beijing China * the device is in any sort of loopback mode ... 776ea65739eSchenlu chen - Sun Microsystems - Beijing China */ 777ea65739eSchenlu chen - Sun Microsystems - Beijing China switch (pr_num) { 778ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_EN_10GFDX_CAP: 7797e579c30SDale Ghent case MAC_PROP_EN_5000FDX_CAP: 7807e579c30SDale Ghent case MAC_PROP_EN_2500FDX_CAP: 781ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_EN_1000FDX_CAP: 782ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_EN_100FDX_CAP: 783ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_AUTONEG: 784ea65739eSchenlu chen - Sun Microsystems - Beijing China case MAC_PROP_FLOWCTRL: 785ea65739eSchenlu chen - Sun Microsystems - Beijing China return (B_TRUE); 786ea65739eSchenlu chen - Sun Microsystems - Beijing China } 787ea65739eSchenlu chen - Sun Microsystems - Beijing China return (B_FALSE); 788ea65739eSchenlu chen - Sun Microsystems - Beijing China } 789ea65739eSchenlu chen - Sun Microsystems - Beijing China 790ea65739eSchenlu chen - Sun Microsystems - Beijing China /* ARGSUSED */ 791ea65739eSchenlu chen - Sun Microsystems - Beijing China int 792ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe_set_priv_prop(ixgbe_t *ixgbe, const char *pr_name, 793ea65739eSchenlu chen - Sun Microsystems - Beijing China uint_t pr_valsize, const void *pr_val) 794ea65739eSchenlu chen - Sun Microsystems - Beijing China { 795ea65739eSchenlu chen - Sun Microsystems - Beijing China int err = 0; 796ea65739eSchenlu chen - Sun Microsystems - Beijing China long result; 797ea65739eSchenlu chen - Sun Microsystems - Beijing China struct ixgbe_hw *hw = &ixgbe->hw; 798ea65739eSchenlu chen - Sun Microsystems - Beijing China int i; 799ea65739eSchenlu chen - Sun Microsystems - Beijing China 800ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_tx_copy_thresh") == 0) { 801ea65739eSchenlu chen - Sun Microsystems - Beijing China if (pr_val == NULL) { 802ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 803ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 804ea65739eSchenlu chen - Sun Microsystems - Beijing China } 805ea65739eSchenlu chen - Sun Microsystems - Beijing China (void) ddi_strtol(pr_val, (char **)NULL, 0, &result); 806ea65739eSchenlu chen - Sun Microsystems - Beijing China if (result < MIN_TX_COPY_THRESHOLD || 807ea65739eSchenlu chen - Sun Microsystems - Beijing China result > MAX_TX_COPY_THRESHOLD) 808ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 809ea65739eSchenlu chen - Sun Microsystems - Beijing China else { 810ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->tx_copy_thresh = (uint32_t)result; 811ea65739eSchenlu chen - Sun Microsystems - Beijing China } 812ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 813ea65739eSchenlu chen - Sun Microsystems - Beijing China } 814ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_tx_recycle_thresh") == 0) { 815ea65739eSchenlu chen - Sun Microsystems - Beijing China if (pr_val == NULL) { 816ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 817ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 818ea65739eSchenlu chen - Sun Microsystems - Beijing China } 819ea65739eSchenlu chen - Sun Microsystems - Beijing China (void) ddi_strtol(pr_val, (char **)NULL, 0, &result); 820ea65739eSchenlu chen - Sun Microsystems - Beijing China if (result < MIN_TX_RECYCLE_THRESHOLD || 821ea65739eSchenlu chen - Sun Microsystems - Beijing China result > MAX_TX_RECYCLE_THRESHOLD) 822ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 823ea65739eSchenlu chen - Sun Microsystems - Beijing China else { 824ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->tx_recycle_thresh = (uint32_t)result; 825ea65739eSchenlu chen - Sun Microsystems - Beijing China } 826ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 827ea65739eSchenlu chen - Sun Microsystems - Beijing China } 828ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_tx_overload_thresh") == 0) { 829ea65739eSchenlu chen - Sun Microsystems - Beijing China if (pr_val == NULL) { 830ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 831ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 832ea65739eSchenlu chen - Sun Microsystems - Beijing China } 833ea65739eSchenlu chen - Sun Microsystems - Beijing China (void) ddi_strtol(pr_val, (char **)NULL, 0, &result); 834ea65739eSchenlu chen - Sun Microsystems - Beijing China if (result < MIN_TX_OVERLOAD_THRESHOLD || 835ea65739eSchenlu chen - Sun Microsystems - Beijing China result > MAX_TX_OVERLOAD_THRESHOLD) 836ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 837ea65739eSchenlu chen - Sun Microsystems - Beijing China else { 838ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->tx_overload_thresh = (uint32_t)result; 839ea65739eSchenlu chen - Sun Microsystems - Beijing China } 840ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 841ea65739eSchenlu chen - Sun Microsystems - Beijing China } 842ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_tx_resched_thresh") == 0) { 843ea65739eSchenlu chen - Sun Microsystems - Beijing China if (pr_val == NULL) { 844ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 845ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 846ea65739eSchenlu chen - Sun Microsystems - Beijing China } 847ea65739eSchenlu chen - Sun Microsystems - Beijing China (void) ddi_strtol(pr_val, (char **)NULL, 0, &result); 848ea65739eSchenlu chen - Sun Microsystems - Beijing China if (result < MIN_TX_RESCHED_THRESHOLD || 849ea65739eSchenlu chen - Sun Microsystems - Beijing China result > MAX_TX_RESCHED_THRESHOLD) 850ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 851ea65739eSchenlu chen - Sun Microsystems - Beijing China else { 852ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->tx_resched_thresh = (uint32_t)result; 853ea65739eSchenlu chen - Sun Microsystems - Beijing China } 854ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 855ea65739eSchenlu chen - Sun Microsystems - Beijing China } 856ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_rx_copy_thresh") == 0) { 857ea65739eSchenlu chen - Sun Microsystems - Beijing China if (pr_val == NULL) { 858ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 859ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 860ea65739eSchenlu chen - Sun Microsystems - Beijing China } 861ea65739eSchenlu chen - Sun Microsystems - Beijing China (void) ddi_strtol(pr_val, (char **)NULL, 0, &result); 862ea65739eSchenlu chen - Sun Microsystems - Beijing China if (result < MIN_RX_COPY_THRESHOLD || 863ea65739eSchenlu chen - Sun Microsystems - Beijing China result > MAX_RX_COPY_THRESHOLD) 864ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 865ea65739eSchenlu chen - Sun Microsystems - Beijing China else { 866ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->rx_copy_thresh = (uint32_t)result; 867ea65739eSchenlu chen - Sun Microsystems - Beijing China } 868ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 869ea65739eSchenlu chen - Sun Microsystems - Beijing China } 870ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_rx_limit_per_intr") == 0) { 871ea65739eSchenlu chen - Sun Microsystems - Beijing China if (pr_val == NULL) { 872ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 873ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 874ea65739eSchenlu chen - Sun Microsystems - Beijing China } 875ea65739eSchenlu chen - Sun Microsystems - Beijing China (void) ddi_strtol(pr_val, (char **)NULL, 0, &result); 876ea65739eSchenlu chen - Sun Microsystems - Beijing China if (result < MIN_RX_LIMIT_PER_INTR || 877ea65739eSchenlu chen - Sun Microsystems - Beijing China result > MAX_RX_LIMIT_PER_INTR) 878ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 879ea65739eSchenlu chen - Sun Microsystems - Beijing China else { 880ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->rx_limit_per_intr = (uint32_t)result; 881ea65739eSchenlu chen - Sun Microsystems - Beijing China } 882ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 883ea65739eSchenlu chen - Sun Microsystems - Beijing China } 884ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_intr_throttling") == 0) { 885ea65739eSchenlu chen - Sun Microsystems - Beijing China if (pr_val == NULL) { 886ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 887ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 888ea65739eSchenlu chen - Sun Microsystems - Beijing China } 889ea65739eSchenlu chen - Sun Microsystems - Beijing China (void) ddi_strtol(pr_val, (char **)NULL, 0, &result); 890ea65739eSchenlu chen - Sun Microsystems - Beijing China 891ea65739eSchenlu chen - Sun Microsystems - Beijing China if (result < ixgbe->capab->min_intr_throttle || 892ea65739eSchenlu chen - Sun Microsystems - Beijing China result > ixgbe->capab->max_intr_throttle) 893ea65739eSchenlu chen - Sun Microsystems - Beijing China err = EINVAL; 894ea65739eSchenlu chen - Sun Microsystems - Beijing China else { 895ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->intr_throttling[0] = (uint32_t)result; 896ea65739eSchenlu chen - Sun Microsystems - Beijing China 897ea65739eSchenlu chen - Sun Microsystems - Beijing China /* 8987e579c30SDale Ghent * 82599, X540 and X550 require the interrupt throttling 89969b5a878SDan McDonald * rate is a multiple of 8. This is enforced by the 90069b5a878SDan McDonald * register definiton. 901ea65739eSchenlu chen - Sun Microsystems - Beijing China */ 90269b5a878SDan McDonald if (hw->mac.type == ixgbe_mac_82599EB || 9037e579c30SDale Ghent hw->mac.type == ixgbe_mac_X540 || 9047e579c30SDale Ghent hw->mac.type == ixgbe_mac_X550 || 9057e579c30SDale Ghent hw->mac.type == ixgbe_mac_X550EM_x) { 906ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->intr_throttling[0] = 907ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->intr_throttling[0] & 0xFF8; 90869b5a878SDan McDonald } 909ea65739eSchenlu chen - Sun Microsystems - Beijing China 910ea65739eSchenlu chen - Sun Microsystems - Beijing China for (i = 0; i < MAX_INTR_VECTOR; i++) 911ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->intr_throttling[i] = 912ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->intr_throttling[0]; 913ea65739eSchenlu chen - Sun Microsystems - Beijing China 914ea65739eSchenlu chen - Sun Microsystems - Beijing China /* Set interrupt throttling rate */ 915ea65739eSchenlu chen - Sun Microsystems - Beijing China for (i = 0; i < ixgbe->intr_cnt; i++) 916ea65739eSchenlu chen - Sun Microsystems - Beijing China IXGBE_WRITE_REG(hw, IXGBE_EITR(i), 917ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe->intr_throttling[i]); 918ea65739eSchenlu chen - Sun Microsystems - Beijing China } 919ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 920ea65739eSchenlu chen - Sun Microsystems - Beijing China } 921ea65739eSchenlu chen - Sun Microsystems - Beijing China return (ENOTSUP); 922ea65739eSchenlu chen - Sun Microsystems - Beijing China } 923ea65739eSchenlu chen - Sun Microsystems - Beijing China 924ea65739eSchenlu chen - Sun Microsystems - Beijing China int 925ea65739eSchenlu chen - Sun Microsystems - Beijing China ixgbe_get_priv_prop(ixgbe_t *ixgbe, const char *pr_name, 9260dc2366fSVenugopal Iyer uint_t pr_valsize, void *pr_val) 927ea65739eSchenlu chen - Sun Microsystems - Beijing China { 928ea65739eSchenlu chen - Sun Microsystems - Beijing China int err = ENOTSUP; 929ea65739eSchenlu chen - Sun Microsystems - Beijing China int value; 930ea65739eSchenlu chen - Sun Microsystems - Beijing China 931ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_adv_pause_cap") == 0) { 9320dc2366fSVenugopal Iyer value = ixgbe->param_adv_pause_cap; 933ea65739eSchenlu chen - Sun Microsystems - Beijing China err = 0; 934ea65739eSchenlu chen - Sun Microsystems - Beijing China goto done; 935ea65739eSchenlu chen - Sun Microsystems - Beijing China } 936ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_adv_asym_pause_cap") == 0) { 9370dc2366fSVenugopal Iyer value = ixgbe->param_adv_asym_pause_cap; 938ea65739eSchenlu chen - Sun Microsystems - Beijing China err = 0; 939ea65739eSchenlu chen - Sun Microsystems - Beijing China goto done; 940ea65739eSchenlu chen - Sun Microsystems - Beijing China } 941ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_tx_copy_thresh") == 0) { 9420dc2366fSVenugopal Iyer value = ixgbe->tx_copy_thresh; 943ea65739eSchenlu chen - Sun Microsystems - Beijing China err = 0; 944ea65739eSchenlu chen - Sun Microsystems - Beijing China goto done; 945ea65739eSchenlu chen - Sun Microsystems - Beijing China } 946ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_tx_recycle_thresh") == 0) { 9470dc2366fSVenugopal Iyer value = ixgbe->tx_recycle_thresh; 948ea65739eSchenlu chen - Sun Microsystems - Beijing China err = 0; 949ea65739eSchenlu chen - Sun Microsystems - Beijing China goto done; 950ea65739eSchenlu chen - Sun Microsystems - Beijing China } 951ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_tx_overload_thresh") == 0) { 9520dc2366fSVenugopal Iyer value = ixgbe->tx_overload_thresh; 953ea65739eSchenlu chen - Sun Microsystems - Beijing China err = 0; 954ea65739eSchenlu chen - Sun Microsystems - Beijing China goto done; 955ea65739eSchenlu chen - Sun Microsystems - Beijing China } 956ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_tx_resched_thresh") == 0) { 9570dc2366fSVenugopal Iyer value = ixgbe->tx_resched_thresh; 958ea65739eSchenlu chen - Sun Microsystems - Beijing China err = 0; 959ea65739eSchenlu chen - Sun Microsystems - Beijing China goto done; 960ea65739eSchenlu chen - Sun Microsystems - Beijing China } 961ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_rx_copy_thresh") == 0) { 9620dc2366fSVenugopal Iyer value = ixgbe->rx_copy_thresh; 963ea65739eSchenlu chen - Sun Microsystems - Beijing China err = 0; 964ea65739eSchenlu chen - Sun Microsystems - Beijing China goto done; 965ea65739eSchenlu chen - Sun Microsystems - Beijing China } 966ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_rx_limit_per_intr") == 0) { 9670dc2366fSVenugopal Iyer value = ixgbe->rx_limit_per_intr; 968ea65739eSchenlu chen - Sun Microsystems - Beijing China err = 0; 969ea65739eSchenlu chen - Sun Microsystems - Beijing China goto done; 970ea65739eSchenlu chen - Sun Microsystems - Beijing China } 971ea65739eSchenlu chen - Sun Microsystems - Beijing China if (strcmp(pr_name, "_intr_throttling") == 0) { 9720dc2366fSVenugopal Iyer value = ixgbe->intr_throttling[0]; 973ea65739eSchenlu chen - Sun Microsystems - Beijing China err = 0; 974ea65739eSchenlu chen - Sun Microsystems - Beijing China goto done; 975ea65739eSchenlu chen - Sun Microsystems - Beijing China } 976ea65739eSchenlu chen - Sun Microsystems - Beijing China done: 977ea65739eSchenlu chen - Sun Microsystems - Beijing China if (err == 0) { 978ea65739eSchenlu chen - Sun Microsystems - Beijing China (void) snprintf(pr_val, pr_valsize, "%d", value); 979ea65739eSchenlu chen - Sun Microsystems - Beijing China } 980ea65739eSchenlu chen - Sun Microsystems - Beijing China return (err); 981ea65739eSchenlu chen - Sun Microsystems - Beijing China } 982