Print this page
12309 errors in section 9e of the manual


  49      the value of the pr_name argument and use strcmp(9F) on it, comparing it
  50      to each of its private properties to identify which one it is.
  51 
  52      Not all properties are supposed to be writable.  Some devices may opt to
  53      not allow a property that is designated as read/write to be set.  When
  54      such a property is encountered, the driver should return the appropriate
  55      error.
  56 
  57      The device driver can access its device soft state by casting the device
  58      pointer to the appropriate structure.  As this may be called while other
  59      operations are ongoing, the device driver should employ the appropriate
  60      locking while writing the properties.
  61 
  62 RETURN VALUES
  63      Upon successful completion, the device driver should have copied the
  64      value of the property into pr_val and return 0.  Otherwise, a positive
  65      error should be returned to indicate failure.
  66 
  67 EXAMPLES
  68      The following examples shows how a device driver might structure its
  69      mc_setporp() entry point.
  70 
  71      #include <sys/mac_provider.h>
  72 
  73      /*
  74       * Note, this example merely shows the structure of this function.
  75       * Different devices will manage their state in different ways. Like other
  76       * examples, this assumes that the device has state in a structure called
  77       * example_t and that there is a lock which keeps track of that state.
  78       *
  79       * For the purpose of this example, we assume that this device supports 100 Mb,
  80       * 1 GB, and 10 Gb full duplex speeds.
  81       */
  82 
  83      static int
  84      exmple_m_setprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
  85          uint_t pr_valsize, const void *pr_val)
  86      {
  87              uint32_t new_mtu;
  88              int ret = 0;
  89              example_t *ep = arg;
  90 
  91              mutex_enter(&ep->ep_lock);
  92              switch (pr_num) {
  93              /*
  94               * These represent properties that can never be changed, regardless of
  95               * the type of PHY on the device (copper, fiber, etc.)
  96               */
  97              case MAC_PROP_DUPLEX:
  98              case MAC_PROP_SPEED:
  99              case MAC_PROP_STATUS:
 100              case MAC_PROP_ADV_100FDX_CAP:
 101              case MAC_PROP_ADV_1000FDX_CAP:
 102              case MAC_PROP_ADV_10GFDX_CAP:
 103                      ret = ENOTSUP;
 104                      break;


 172                         the property.
 173 
 174      ENOTSUP            This error should be used whenever an unknown or
 175                         unsupported property is encountered.  It should also
 176                         be used when the property is not writable.
 177 
 178      EOVERFLOW          This error should be used when pr_valsize is smaller
 179                         than the required size for a given value.
 180 
 181      EBUSY              This error should be used when a property can't be set
 182                         because the device has started.  Note that device
 183                         driver writers are encouraged to design device drivers
 184                         such that this error is not possible.
 185 
 186      ECANCELLED         The device is in a state that does not allow it to
 187                         handle data; for example, it's suspended.
 188 
 189 SEE ALSO
 190      mac(9E), mac_register(9F), strcmp(9F), mac_register(9S)
 191 
 192 illumos                          June 2, 2016                          illumos


  49      the value of the pr_name argument and use strcmp(9F) on it, comparing it
  50      to each of its private properties to identify which one it is.
  51 
  52      Not all properties are supposed to be writable.  Some devices may opt to
  53      not allow a property that is designated as read/write to be set.  When
  54      such a property is encountered, the driver should return the appropriate
  55      error.
  56 
  57      The device driver can access its device soft state by casting the device
  58      pointer to the appropriate structure.  As this may be called while other
  59      operations are ongoing, the device driver should employ the appropriate
  60      locking while writing the properties.
  61 
  62 RETURN VALUES
  63      Upon successful completion, the device driver should have copied the
  64      value of the property into pr_val and return 0.  Otherwise, a positive
  65      error should be returned to indicate failure.
  66 
  67 EXAMPLES
  68      The following examples shows how a device driver might structure its
  69      mc_setprop() entry point.
  70 
  71      #include <sys/mac_provider.h>
  72 
  73      /*
  74       * Note, this example merely shows the structure of this function.
  75       * Different devices will manage their state in different ways. Like other
  76       * examples, this assumes that the device has state in a structure called
  77       * example_t and that there is a lock which keeps track of that state.
  78       *
  79       * For the purpose of this example, we assume that this device supports 100 Mb,
  80       * 1 GB, and 10 Gb full duplex speeds.
  81       */
  82 
  83      static int
  84      example_m_setprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
  85          uint_t pr_valsize, const void *pr_val)
  86      {
  87              uint32_t new_mtu;
  88              int ret = 0;
  89              example_t *ep = arg;
  90 
  91              mutex_enter(&ep->ep_lock);
  92              switch (pr_num) {
  93              /*
  94               * These represent properties that can never be changed, regardless of
  95               * the type of PHY on the device (copper, fiber, etc.)
  96               */
  97              case MAC_PROP_DUPLEX:
  98              case MAC_PROP_SPEED:
  99              case MAC_PROP_STATUS:
 100              case MAC_PROP_ADV_100FDX_CAP:
 101              case MAC_PROP_ADV_1000FDX_CAP:
 102              case MAC_PROP_ADV_10GFDX_CAP:
 103                      ret = ENOTSUP;
 104                      break;


 172                         the property.
 173 
 174      ENOTSUP            This error should be used whenever an unknown or
 175                         unsupported property is encountered.  It should also
 176                         be used when the property is not writable.
 177 
 178      EOVERFLOW          This error should be used when pr_valsize is smaller
 179                         than the required size for a given value.
 180 
 181      EBUSY              This error should be used when a property can't be set
 182                         because the device has started.  Note that device
 183                         driver writers are encouraged to design device drivers
 184                         such that this error is not possible.
 185 
 186      ECANCELLED         The device is in a state that does not allow it to
 187                         handle data; for example, it's suspended.
 188 
 189 SEE ALSO
 190      mac(9E), mac_register(9F), strcmp(9F), mac_register(9S)
 191 
 192 illumos                        February 15, 2020                       illumos