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 June 02, 2016
  15 .Dt MC_SETPROP 9E
  16 .Os
  17 .Sh NAME
  18 .Nm mc_setprop
  19 .Nd set device properties
  20 .Sh SYNOPSIS
  21 .In sys/mac_provider.h
  22 .Ft int
  23 .Fo prefix_m_setprop
  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 "const 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


  96 Some devices may opt to not allow a property that is designated as read/write to
  97 be set.
  98 When such a property is encountered, the driver should return the appropriate
  99 error.
 100 .Pp
 101 The device
 102 driver can access its device soft state by casting the
 103 .Fa device
 104 pointer to the appropriate structure.
 105 As this may be called while other operations are ongoing, the device driver
 106 should employ the appropriate locking while writing the properties.
 107 .Sh RETURN VALUES
 108 Upon successful completion, the device driver should have copied the
 109 value of the property into
 110 .Fa pr_val
 111 and return
 112 .Sy 0 .
 113 Otherwise, a positive error should be returned to indicate failure.
 114 .Sh EXAMPLES
 115 The following examples shows how a device driver might structure its
 116 .Fn mc_setporp
 117 entry point.
 118 .Bd -literal
 119 #include <sys/mac_provider.h>
 120 
 121 /*
 122  * Note, this example merely shows the structure of this function.
 123  * Different devices will manage their state in different ways. Like other
 124  * examples, this assumes that the device has state in a structure called
 125  * example_t and that there is a lock which keeps track of that state.
 126  *
 127  * For the purpose of this example, we assume that this device supports 100 Mb,
 128  * 1 GB, and 10 Gb full duplex speeds.
 129  */
 130 
 131 static int
 132 exmple_m_setprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
 133     uint_t pr_valsize, const void *pr_val)
 134 {
 135         uint32_t new_mtu;
 136         int ret = 0;
 137         example_t *ep = arg;
 138 
 139         mutex_enter(&ep->ep_lock);
 140         switch (pr_num) {
 141         /*
 142          * These represent properties that can never be changed, regardless of
 143          * the type of PHY on the device (copper, fiber, etc.)
 144          */
 145         case MAC_PROP_DUPLEX:
 146         case MAC_PROP_SPEED:
 147         case MAC_PROP_STATUS:
 148         case MAC_PROP_ADV_100FDX_CAP:
 149         case MAC_PROP_ADV_1000FDX_CAP:
 150         case MAC_PROP_ADV_10GFDX_CAP:
 151                 ret = ENOTSUP;
 152                 break;


   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_SETPROP 9E
  16 .Os
  17 .Sh NAME
  18 .Nm mc_setprop
  19 .Nd set device properties
  20 .Sh SYNOPSIS
  21 .In sys/mac_provider.h
  22 .Ft int
  23 .Fo prefix_m_setprop
  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 "const 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


  96 Some devices may opt to not allow a property that is designated as read/write to
  97 be set.
  98 When such a property is encountered, the driver should return the appropriate
  99 error.
 100 .Pp
 101 The device
 102 driver can access its device soft state by casting the
 103 .Fa device
 104 pointer to the appropriate structure.
 105 As this may be called while other operations are ongoing, the device driver
 106 should employ the appropriate locking while writing the properties.
 107 .Sh RETURN VALUES
 108 Upon successful completion, the device driver should have copied the
 109 value of the property into
 110 .Fa pr_val
 111 and return
 112 .Sy 0 .
 113 Otherwise, a positive error should be returned to indicate failure.
 114 .Sh EXAMPLES
 115 The following examples shows how a device driver might structure its
 116 .Fn mc_setprop
 117 entry point.
 118 .Bd -literal
 119 #include <sys/mac_provider.h>
 120 
 121 /*
 122  * Note, this example merely shows the structure of this function.
 123  * Different devices will manage their state in different ways. Like other
 124  * examples, this assumes that the device has state in a structure called
 125  * example_t and that there is a lock which keeps track of that state.
 126  *
 127  * For the purpose of this example, we assume that this device supports 100 Mb,
 128  * 1 GB, and 10 Gb full duplex speeds.
 129  */
 130 
 131 static int
 132 example_m_setprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
 133     uint_t pr_valsize, const void *pr_val)
 134 {
 135         uint32_t new_mtu;
 136         int ret = 0;
 137         example_t *ep = arg;
 138 
 139         mutex_enter(&ep->ep_lock);
 140         switch (pr_num) {
 141         /*
 142          * These represent properties that can never be changed, regardless of
 143          * the type of PHY on the device (copper, fiber, etc.)
 144          */
 145         case MAC_PROP_DUPLEX:
 146         case MAC_PROP_SPEED:
 147         case MAC_PROP_STATUS:
 148         case MAC_PROP_ADV_100FDX_CAP:
 149         case MAC_PROP_ADV_1000FDX_CAP:
 150         case MAC_PROP_ADV_10GFDX_CAP:
 151                 ret = ENOTSUP;
 152                 break;