Print this page
12309 errors in section 9e of the manual
   1 .\"
   2 .\" This file and its contents are supplied under the terms of the
   3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
   4 .\" You may only use this file in accordance with the terms of version
   5 .\" 1.0 of the CDDL.
   6 .\"
   7 .\" A full copy of the text of the CDDL should have accompanied this
   8 .\" source.  A copy of the CDDL is also available via the Internet at
   9 .\" http://www.illumos.org/license/CDDL.
  10 .\"
  11 .\"
  12 .\" Copyright 2016 Joyent, Inc.
  13 .\"
  14 .Dd November 15, 2016
  15 .Dt MC_GETPROP 9E
  16 .Os
  17 .Sh NAME
  18 .Nm mc_getprop
  19 .Nd get device properties
  20 .Sh SYNOPSIS
  21 .In sys/mac_provider.h
  22 .Ft int
  23 .Fo prefix_m_getprop
  24 .Fa "void *driver"
  25 .Fa "const char *pr_name"
  26 .Fa "mac_prop_id_t pr_num"
  27 .Fa "uint_t pr_valsize"
  28 .Fa "void *pr_val"
  29 .Fc
  30 .Sh INTERFACE LEVEL
  31 illumos DDI specific
  32 .Sh PARAMETERS
  33 .Bl -tag -width Fa
  34 .It Fa driver


 128  * Note, this example merely shows the structure of this function.
 129  * Different devices will manage their state in different ways. Like other
 130  * examples, this assumes that the device has state in a structure called
 131  * example_t and that there is a lock which keeps track of that state.
 132  */
 133 static char *example_priv_props[] = {
 134         "_rx_intr_throttle",
 135         "_tx_intr_throttle",
 136         NULL
 137 };
 138 
 139 static int
 140 example_m_getprop_private(example_t *ep, const char *pr_name, uint_t pr_valsize,
 141     void *pr_val)
 142 {
 143         uint32_t val;
 144 
 145         ASSERT(MUTEX_HELD(&ep->ep_lock));
 146         if (strcmp(pr_name, example_priv_props[0] == 0) {
 147                 val = ep->ep_rx_itr;
 148         } else if (strcmp(pr_name, exampe_priv_props[1] == 0) {
 149                 val = ep->ep_tx_itr;
 150         } else {
 151                 return (ENOTSUP);
 152         }
 153 
 154         /*
 155          * Due to issues in the GLDv3, these must be returned as string
 156          * properties.
 157          */
 158         if (snprintf(pr_val, pr_valsize, "%d", val) >= pr_valsize)
 159                 return (EOVERFLOW);
 160 
 161         return (0);
 162 }
 163 
 164 static int
 165 example_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
 166     uint_t pr_valsize, void *pr_val)
 167 {
 168         int ret = 0;


   1 .\"
   2 .\" This file and its contents are supplied under the terms of the
   3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
   4 .\" You may only use this file in accordance with the terms of version
   5 .\" 1.0 of the CDDL.
   6 .\"
   7 .\" A full copy of the text of the CDDL should have accompanied this
   8 .\" source.  A copy of the CDDL is also available via the Internet at
   9 .\" http://www.illumos.org/license/CDDL.
  10 .\"
  11 .\"
  12 .\" Copyright 2016 Joyent, Inc.
  13 .\"
  14 .Dd February 15, 2020
  15 .Dt MC_GETPROP 9E
  16 .Os
  17 .Sh NAME
  18 .Nm mc_getprop
  19 .Nd get device properties
  20 .Sh SYNOPSIS
  21 .In sys/mac_provider.h
  22 .Ft int
  23 .Fo prefix_m_getprop
  24 .Fa "void *driver"
  25 .Fa "const char *pr_name"
  26 .Fa "mac_prop_id_t pr_num"
  27 .Fa "uint_t pr_valsize"
  28 .Fa "void *pr_val"
  29 .Fc
  30 .Sh INTERFACE LEVEL
  31 illumos DDI specific
  32 .Sh PARAMETERS
  33 .Bl -tag -width Fa
  34 .It Fa driver


 128  * Note, this example merely shows the structure of this function.
 129  * Different devices will manage their state in different ways. Like other
 130  * examples, this assumes that the device has state in a structure called
 131  * example_t and that there is a lock which keeps track of that state.
 132  */
 133 static char *example_priv_props[] = {
 134         "_rx_intr_throttle",
 135         "_tx_intr_throttle",
 136         NULL
 137 };
 138 
 139 static int
 140 example_m_getprop_private(example_t *ep, const char *pr_name, uint_t pr_valsize,
 141     void *pr_val)
 142 {
 143         uint32_t val;
 144 
 145         ASSERT(MUTEX_HELD(&ep->ep_lock));
 146         if (strcmp(pr_name, example_priv_props[0] == 0) {
 147                 val = ep->ep_rx_itr;
 148         } else if (strcmp(pr_name, example_priv_props[1] == 0) {
 149                 val = ep->ep_tx_itr;
 150         } else {
 151                 return (ENOTSUP);
 152         }
 153 
 154         /*
 155          * Due to issues in the GLDv3, these must be returned as string
 156          * properties.
 157          */
 158         if (snprintf(pr_val, pr_valsize, "%d", val) >= pr_valsize)
 159                 return (EOVERFLOW);
 160 
 161         return (0);
 162 }
 163 
 164 static int
 165 example_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
 166     uint_t pr_valsize, void *pr_val)
 167 {
 168         int ret = 0;