Print this page
2553 mac address should be a dladm link property

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/mac/mac.c
          +++ new/usr/src/uts/common/io/mac/mac.c
↓ open down ↓ 2981 lines elided ↑ open up ↑
2982 2982                  break;
2983 2983          case MAC_PROP_WL_DELKEY:
2984 2984                  minsize = sizeof (wl_del_key_t);
2985 2985                  break;
2986 2986          case MAC_PROP_WL_KEY:
2987 2987                  minsize = sizeof (wl_key_t);
2988 2988                  break;
2989 2989          case MAC_PROP_WL_MLME:
2990 2990                  minsize = sizeof (wl_mlme_t);
2991 2991                  break;
     2992 +        case MAC_PROP_MACADDRESS:
     2993 +                minsize = sizeof (mac_addrprop_t);
2992 2994          }
2993 2995  
2994 2996          return (valsize >= minsize);
2995 2997  }
2996 2998  
2997 2999  /*
2998 3000   * mac_set_prop() sets MAC or hardware driver properties:
2999 3001   *
3000 3002   * - MAC-managed properties such as resource properties include maxbw,
3001 3003   *   priority, and cpu binding list, as well as the default port VID
↓ open down ↓ 56 lines elided ↑ open up ↑
3058 3060                  if (learnval == 0 && id == MAC_PROP_LDECAY)
3059 3061                          return (EINVAL);
3060 3062                  if (id == MAC_PROP_LLIMIT)
3061 3063                          mip->mi_llimit = learnval;
3062 3064                  else
3063 3065                          mip->mi_ldecay = learnval;
3064 3066                  err = 0;
3065 3067                  break;
3066 3068          }
3067 3069  
     3070 +        case MAC_PROP_MACADDRESS: {
     3071 +                mac_addrprop_t  *addrprop = val;
     3072 +
     3073 +                if (addrprop->ma_len != mip->mi_type->mt_addr_length)
     3074 +                        return (EINVAL);
     3075 +
     3076 +                err = mac_unicast_primary_set(mh, addrprop->ma_addr);
     3077 +                break;
     3078 +        }
     3079 +
3068 3080          default:
3069 3081                  /* For other driver properties, call driver's callback */
3070 3082                  if (mip->mi_callbacks->mc_callbacks & MC_SETPROP) {
3071 3083                          err = mip->mi_callbacks->mc_setprop(mip->mi_driver,
3072 3084                              name, id, valsize, val);
3073 3085                  }
3074 3086          }
3075 3087          return (err);
3076 3088  }
3077 3089  
↓ open down ↓ 95 lines elided ↑ open up ↑
3173 3185                  return (0);
3174 3186  
3175 3187          case MAC_PROP_RXRINGSRANGE:
3176 3188          case MAC_PROP_TXRINGSRANGE:
3177 3189                  /*
3178 3190                   * The value for these properties are returned through
3179 3191                   * the MAC_PROP_RESOURCE property.
3180 3192                   */
3181 3193                  return (0);
3182 3194  
     3195 +        case MAC_PROP_MACADDRESS: {
     3196 +                mac_addrprop_t  *addrprop = val;
     3197 +
     3198 +                if (valsize < sizeof (mac_addrprop_t))
     3199 +                        return (EINVAL);
     3200 +                mac_unicast_primary_get(mh, addrprop->ma_addr);
     3201 +                addrprop->ma_len = mip->mi_type->mt_addr_length;
     3202 +                return (0);
     3203 +        }
     3204 +
3183 3205          default:
3184 3206                  break;
3185 3207  
3186 3208          }
3187 3209  
3188 3210          /* If driver property, request from driver */
3189 3211          if (mip->mi_callbacks->mc_callbacks & MC_GETPROP) {
3190 3212                  err = mip->mi_callbacks->mc_getprop(mip->mi_driver, name, id,
3191 3213                      valsize, val);
3192 3214          }
↓ open down ↓ 133 lines elided ↑ open up ↑
3326 3348                                          _mac_set_range(range, 1, max - 1);
3327 3349                                  }
3328 3350                          }
3329 3351                  }
3330 3352                  return (0);
3331 3353  
3332 3354          case MAC_PROP_STATUS:
3333 3355                  if (perm != NULL)
3334 3356                          *perm = MAC_PROP_PERM_READ;
3335 3357                  return (0);
     3358 +
     3359 +        case MAC_PROP_MACADDRESS: {
     3360 +                mac_addrprop_t  *defaddr = default_val;
     3361 +
     3362 +                if (defaddr != NULL) {
     3363 +                        if (default_size < sizeof (mac_addrprop_t))
     3364 +                                return (EINVAL);
     3365 +                        bcopy(mip->mi_info.mi_unicst_addr, defaddr->ma_addr,
     3366 +                            mip->mi_type->mt_addr_length);
     3367 +                        defaddr->ma_len = mip->mi_type->mt_addr_length;
     3368 +                }
     3369 +                return (0);
     3370 +        }
3336 3371          }
3337 3372  
3338 3373          /*
3339 3374           * Get the property info from the driver if it implements the
3340 3375           * property info entry point.
3341 3376           */
3342 3377          bzero(&state, sizeof (state));
3343 3378  
3344 3379          if (mip->mi_callbacks->mc_callbacks & MC_PROPINFO) {
3345 3380                  state.pr_default = default_val;
↓ open down ↓ 4544 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX