Print this page
6601 Various GLD drivers return EINVAL instead of ENOTSUP for unused mac_prop_id_t's
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.

  23  */
  24 
  25 /*
  26  * SunOs MT STREAMS NIU/Neptune 10Gb Ethernet Device Driver.
  27  */
  28 #include        <sys/nxge/nxge_impl.h>
  29 #include        <sys/nxge/nxge_hio.h>
  30 #include        <sys/nxge/nxge_rxdma.h>
  31 #include        <sys/pcie.h>
  32 
  33 uint32_t        nxge_use_partition = 0;         /* debug partition flag */
  34 uint32_t        nxge_dma_obp_props_only = 1;    /* use obp published props */
  35 uint32_t        nxge_use_rdc_intr = 1;          /* debug to assign rdc intr */
  36 /*
  37  * PSARC/2007/453 MSI-X interrupt limit override
  38  */
  39 uint32_t        nxge_msi_enable = 2;
  40 
  41 /*
  42  * Software workaround for a Neptune (PCI-E)


5119                     "<== nxge_set_priv_prop: name %s (value %d)",
5120                     pr_name, result));
5121 
5122                 return (err);
5123         }
5124         /*
5125          * Commands like "ndd -set /dev/nxge0 adv_10gfdx_cap 1" cause the
5126          * following code to be executed.
5127          */
5128         if (strcmp(pr_name, "_adv_10gfdx_cap") == 0) {
5129                 err = nxge_param_set_mac(nxgep, NULL, NULL, (char *)pr_val,
5130                     (caddr_t)&param_arr[param_anar_10gfdx]);
5131                 return (err);
5132         }
5133         if (strcmp(pr_name, "_adv_pause_cap") == 0) {
5134                 err = nxge_param_set_mac(nxgep, NULL, NULL, (char *)pr_val,
5135                     (caddr_t)&param_arr[param_anar_pause]);
5136                 return (err);
5137         }
5138 
5139         return (EINVAL);
5140 }
5141 
5142 static int
5143 nxge_get_priv_prop(p_nxge_t nxgep, const char *pr_name, uint_t pr_valsize,
5144     void *pr_val)
5145 {
5146         p_nxge_param_t  param_arr = nxgep->param_arr;
5147         char            valstr[MAXNAMELEN];
5148         int             err = EINVAL;
5149         uint_t          strsize;
5150 
5151         NXGE_DEBUG_MSG((nxgep, NXGE_CTL,
5152             "==> nxge_get_priv_prop: property %s", pr_name));
5153 
5154         /* function number */
5155         if (strcmp(pr_name, "_function_number") == 0) {
5156                 (void) snprintf(valstr, sizeof (valstr), "%d",
5157                     nxgep->function_num);
5158                 NXGE_DEBUG_MSG((nxgep, NXGE_CTL,
5159                     "==> nxge_get_priv_prop: name %s "
5160                     "(value %d valstr %s)",
5161                     pr_name, nxgep->function_num, valstr));
5162 
5163                 err = 0;
5164                 goto done;
5165         }
5166 
5167         /* Neptune firmware version */
5168         if (strcmp(pr_name, "_fw_version") == 0) {




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
  24  */
  25 
  26 /*
  27  * SunOs MT STREAMS NIU/Neptune 10Gb Ethernet Device Driver.
  28  */
  29 #include        <sys/nxge/nxge_impl.h>
  30 #include        <sys/nxge/nxge_hio.h>
  31 #include        <sys/nxge/nxge_rxdma.h>
  32 #include        <sys/pcie.h>
  33 
  34 uint32_t        nxge_use_partition = 0;         /* debug partition flag */
  35 uint32_t        nxge_dma_obp_props_only = 1;    /* use obp published props */
  36 uint32_t        nxge_use_rdc_intr = 1;          /* debug to assign rdc intr */
  37 /*
  38  * PSARC/2007/453 MSI-X interrupt limit override
  39  */
  40 uint32_t        nxge_msi_enable = 2;
  41 
  42 /*
  43  * Software workaround for a Neptune (PCI-E)


5120                     "<== nxge_set_priv_prop: name %s (value %d)",
5121                     pr_name, result));
5122 
5123                 return (err);
5124         }
5125         /*
5126          * Commands like "ndd -set /dev/nxge0 adv_10gfdx_cap 1" cause the
5127          * following code to be executed.
5128          */
5129         if (strcmp(pr_name, "_adv_10gfdx_cap") == 0) {
5130                 err = nxge_param_set_mac(nxgep, NULL, NULL, (char *)pr_val,
5131                     (caddr_t)&param_arr[param_anar_10gfdx]);
5132                 return (err);
5133         }
5134         if (strcmp(pr_name, "_adv_pause_cap") == 0) {
5135                 err = nxge_param_set_mac(nxgep, NULL, NULL, (char *)pr_val,
5136                     (caddr_t)&param_arr[param_anar_pause]);
5137                 return (err);
5138         }
5139 
5140         return (ENOTSUP);
5141 }
5142 
5143 static int
5144 nxge_get_priv_prop(p_nxge_t nxgep, const char *pr_name, uint_t pr_valsize,
5145     void *pr_val)
5146 {
5147         p_nxge_param_t  param_arr = nxgep->param_arr;
5148         char            valstr[MAXNAMELEN];
5149         int             err = ENOTSUP;
5150         uint_t          strsize;
5151 
5152         NXGE_DEBUG_MSG((nxgep, NXGE_CTL,
5153             "==> nxge_get_priv_prop: property %s", pr_name));
5154 
5155         /* function number */
5156         if (strcmp(pr_name, "_function_number") == 0) {
5157                 (void) snprintf(valstr, sizeof (valstr), "%d",
5158                     nxgep->function_num);
5159                 NXGE_DEBUG_MSG((nxgep, NXGE_CTL,
5160                     "==> nxge_get_priv_prop: name %s "
5161                     "(value %d valstr %s)",
5162                     pr_name, nxgep->function_num, valstr));
5163 
5164                 err = 0;
5165                 goto done;
5166         }
5167 
5168         /* Neptune firmware version */
5169         if (strcmp(pr_name, "_fw_version") == 0) {