Changeset View
Changeset View
Standalone View
Standalone View
sys/net/iflib.c
Show First 20 Lines • Show All 4,302 Lines • ▼ Show 20 Lines | iflib_vlan_register(void *arg, if_t ifp, uint16_t vtag) | ||||
if ((vtag == 0) || (vtag > 4095)) | if ((vtag == 0) || (vtag > 4095)) | ||||
return; | return; | ||||
if (iflib_in_detach(ctx)) | if (iflib_in_detach(ctx)) | ||||
return; | return; | ||||
CTX_LOCK(ctx); | CTX_LOCK(ctx); | ||||
/* Driver may need all untagged packets to be flushed */ | |||||
if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) | |||||
iflib_stop(ctx); | |||||
IFDI_VLAN_REGISTER(ctx, vtag); | IFDI_VLAN_REGISTER(ctx, vtag); | ||||
/* Re-init to load the changes */ | /* Re-init to load the changes, if required */ | ||||
if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) | if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) | ||||
iflib_if_init_locked(ctx); | iflib_init_locked(ctx); | ||||
CTX_UNLOCK(ctx); | CTX_UNLOCK(ctx); | ||||
} | } | ||||
static void | static void | ||||
iflib_vlan_unregister(void *arg, if_t ifp, uint16_t vtag) | iflib_vlan_unregister(void *arg, if_t ifp, uint16_t vtag) | ||||
{ | { | ||||
if_ctx_t ctx = if_getsoftc(ifp); | if_ctx_t ctx = if_getsoftc(ifp); | ||||
if ((void *)ctx != arg) | if ((void *)ctx != arg) | ||||
return; | return; | ||||
if ((vtag == 0) || (vtag > 4095)) | if ((vtag == 0) || (vtag > 4095)) | ||||
return; | return; | ||||
CTX_LOCK(ctx); | CTX_LOCK(ctx); | ||||
/* Driver may need all tagged packets to be flushed */ | |||||
if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) | |||||
iflib_stop(ctx); | |||||
IFDI_VLAN_UNREGISTER(ctx, vtag); | IFDI_VLAN_UNREGISTER(ctx, vtag); | ||||
jacob.e.keller_intel.com: I know we've received some complaints about start/stop for adding VLANs. I wonder if we should… | |||||
Not Done Inline ActionsWe talked about this in an iflib meeting about a month ago, I think. Eg, that there were various events that some nics might want a restart on, but that others would be OK with. We were talking about having an event code that would be passed to an iflib method. The method would return true or false (restart needed or not) based on the event. By default, if a driver did not implement the method, he would get a default method that would always return true (restart needed). gallatin: We talked about this in an iflib meeting about a month ago, I think. Eg, that there were… | |||||
Not Done Inline ActionsYea, I like that idea. jacob.e.keller_intel.com: Yea, I like that idea. | |||||
/* Re-init to load the changes */ | /* Re-init to load the changes, if required */ | ||||
if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) | if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) | ||||
iflib_if_init_locked(ctx); | iflib_init_locked(ctx); | ||||
CTX_UNLOCK(ctx); | CTX_UNLOCK(ctx); | ||||
} | } | ||||
static void | static void | ||||
iflib_led_func(void *arg, int onoff) | iflib_led_func(void *arg, int onoff) | ||||
{ | { | ||||
if_ctx_t ctx = arg; | if_ctx_t ctx = arg; | ||||
▲ Show 20 Lines • Show All 2,499 Lines • Show Last 20 Lines |
I know we've received some complaints about start/stop for adding VLANs. I wonder if we should just have a flag that indicates if you need or (more precisely) don't need to stop the interface after adding a VLAN.
Then, drivers which could add VLANs without a re-init would set that flag, and drivers which don't have the flag would stop the interface first, and then re-init after.