Changeset View
Standalone View
sys/net/if.c
Show First 20 Lines • Show All 4,610 Lines • ▼ Show 20 Lines | |||||
if_setsendqlen(if_t ifp, int tx_desc_count) | if_setsendqlen(if_t ifp, int tx_desc_count) | ||||
{ | { | ||||
IFQ_SET_MAXLEN(&((struct ifnet *)ifp)->if_snd, tx_desc_count); | IFQ_SET_MAXLEN(&((struct ifnet *)ifp)->if_snd, tx_desc_count); | ||||
((struct ifnet *)ifp)->if_snd.ifq_drv_maxlen = tx_desc_count; | ((struct ifnet *)ifp)->if_snd.ifq_drv_maxlen = tx_desc_count; | ||||
return (0); | return (0); | ||||
} | } | ||||
void | |||||
if_setnetmapadapter(if_t ifp, struct netmap_adapter *na) | |||||
{ | |||||
ifp->if_netmap = na; | |||||
} | |||||
struct netmap_adapter * | |||||
if_getnetmapadapter(if_t ifp) | |||||
{ | |||||
return (ifp->if_netmap); | |||||
} | |||||
int | int | ||||
if_vlantrunkinuse(if_t ifp) | if_vlantrunkinuse(if_t ifp) | ||||
{ | { | ||||
return ((struct ifnet *)ifp)->if_vlantrunk != NULL?1:0; | return ((struct ifnet *)ifp)->if_vlantrunk != NULL?1:0; | ||||
} | } | ||||
int | int | ||||
if_init(if_t ifp, void *ctx) | if_init(if_t ifp, void *ctx) | ||||
▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void | void | ||||
if_setinputfn(if_t ifp, if_input_fn_t input_fn) | if_setinputfn(if_t ifp, if_input_fn_t input_fn) | ||||
{ | { | ||||
((struct ifnet *)ifp)->if_input = input_fn; | ((struct ifnet *)ifp)->if_input = input_fn; | ||||
} | } | ||||
if_input_fn_t | |||||
if_getinputfn(if_t ifp) | |||||
melifaro: Nit: ‘const if_t’ for all accessors? | |||||
Done Inline ActionsThought about it, but 'const if_t' and 'if_t' mean the same thing, really. The 'const' goes on the pointer, not on the struct. The const makes no difference. jhibbits: Thought about it, but 'const if_t' and 'if_t' mean the same thing, really. The 'const' goes on… | |||||
Not Done Inline ActionsI agree - it's certainly true for the drivers part, where there is no visibility over the struct ifnet internals. melifaro: I agree - it's certainly true for the drivers part, where there is no visibility over the… | |||||
{ | |||||
return (ifp->if_input); | |||||
} | |||||
void | void | ||||
if_setioctlfn(if_t ifp, if_ioctl_fn_t ioctl_fn) | if_setioctlfn(if_t ifp, if_ioctl_fn_t ioctl_fn) | ||||
{ | { | ||||
((struct ifnet *)ifp)->if_ioctl = (void *)ioctl_fn; | ((struct ifnet *)ifp)->if_ioctl = (void *)ioctl_fn; | ||||
} | } | ||||
void | void | ||||
if_setoutputfn(if_t ifp, if_output_fn_t output_fn) | if_setoutputfn(if_t ifp, if_output_fn_t output_fn) | ||||
{ | { | ||||
((struct ifnet *)ifp)->if_output = output_fn; | ((struct ifnet *)ifp)->if_output = output_fn; | ||||
} | } | ||||
void | void | ||||
if_setstartfn(if_t ifp, if_start_fn_t start_fn) | if_setstartfn(if_t ifp, if_start_fn_t start_fn) | ||||
{ | { | ||||
((struct ifnet *)ifp)->if_start = (void *)start_fn; | ((struct ifnet *)ifp)->if_start = (void *)start_fn; | ||||
} | } | ||||
if_start_fn_t | |||||
if_getstartfn(if_t ifp) | |||||
{ | |||||
return (ifp->if_start); | |||||
} | |||||
void | void | ||||
if_settransmitfn(if_t ifp, if_transmit_fn_t start_fn) | if_settransmitfn(if_t ifp, if_transmit_fn_t start_fn) | ||||
{ | { | ||||
((struct ifnet *)ifp)->if_transmit = start_fn; | ((struct ifnet *)ifp)->if_transmit = start_fn; | ||||
} | } | ||||
if_transmit_fn_t | |||||
if_gettransmitfn(if_t ifp) | |||||
{ | |||||
return (ifp->if_transmit); | |||||
} | |||||
void | void | ||||
if_setqflushfn(if_t ifp, if_qflush_fn_t flush_fn) | if_setqflushfn(if_t ifp, if_qflush_fn_t flush_fn) | ||||
{ | { | ||||
((struct ifnet *)ifp)->if_qflush = flush_fn; | ((struct ifnet *)ifp)->if_qflush = flush_fn; | ||||
} | } | ||||
void | void | ||||
if_setsndtagallocfn(if_t ifp, if_snd_tag_alloc_t alloc_fn) | if_setsndtagallocfn(if_t ifp, if_snd_tag_alloc_t alloc_fn) | ||||
{ | { | ||||
((struct ifnet *)ifp)->if_snd_tag_alloc = alloc_fn; | ((struct ifnet *)ifp)->if_snd_tag_alloc = alloc_fn; | ||||
} | } | ||||
void | void | ||||
if_setgetcounterfn(if_t ifp, if_get_counter_t fn) | if_setgetcounterfn(if_t ifp, if_get_counter_t fn) | ||||
{ | { | ||||
ifp->if_get_counter = fn; | ifp->if_get_counter = fn; | ||||
} | } | ||||
void | void | ||||
if_setreassignfn(if_t ifp, if_reassign_fn_t fn) | |||||
{ | |||||
ifp->if_reassign = fn; | |||||
} | |||||
void | |||||
if_setratelimitqueryfn(if_t ifp, if_ratelimit_query_t fn) | |||||
{ | |||||
ifp->if_ratelimit_query = fn; | |||||
} | |||||
void | |||||
if_setdebugnet_methods(if_t ifp, struct debugnet_methods *m) | if_setdebugnet_methods(if_t ifp, struct debugnet_methods *m) | ||||
{ | { | ||||
ifp->if_debugnet_methods = m; | ifp->if_debugnet_methods = m; | ||||
} | } | ||||
struct label * | struct label * | ||||
if_getmaclabel(if_t ifp) | if_getmaclabel(if_t ifp) | ||||
{ | { | ||||
Show All 18 Lines | if_getllsoftc(if_t ifp) | ||||
return (ifp->if_llsoftc); | return (ifp->if_llsoftc); | ||||
} | } | ||||
void | void | ||||
if_setllsoftc(if_t ifp, void *llsoftc) | if_setllsoftc(if_t ifp, void *llsoftc) | ||||
{ | { | ||||
ifp->if_llsoftc = llsoftc; | ifp->if_llsoftc = llsoftc; | ||||
}; | }; | ||||
int | |||||
if_getlinkstate(if_t ifp) | |||||
{ | |||||
return (ifp->if_link_state); | |||||
} | |||||
const uint8_t * | |||||
if_getbroadcastaddr(if_t ifp) | |||||
{ | |||||
return (ifp->if_broadcastaddr); | |||||
} | |||||
int | |||||
if_getnumadomain(if_t ifp) | |||||
{ | |||||
return (ifp->if_numa_domain); | |||||
} | |||||
uint64_t | |||||
if_getcounter(if_t ifp, ift_counter counter) | |||||
{ | |||||
return (ifp->if_get_counter(ifp, counter)); | |||||
} | |||||
struct vnet * | |||||
if_getvnet(if_t ifp) | |||||
{ | |||||
return (ifp->if_vnet); | |||||
} | |||||
void * | |||||
if_getafdata(if_t ifp, int af) | |||||
{ | |||||
return (ifp->if_afdata[af]); | |||||
} | |||||
u_int | |||||
if_getfib(if_t ifp) | |||||
{ | |||||
return (ifp->if_fib); | |||||
} | |||||
struct bpf_if * | |||||
if_getbpf(if_t ifp) | |||||
{ | |||||
return (ifp->if_bpf); | |||||
} | |||||
struct ifvlantrunk * | |||||
if_getvlantrunk(if_t ifp) | |||||
{ | |||||
return (ifp->if_vlantrunk); | |||||
} | |||||
uint8_t | |||||
if_getpcp(if_t ifp) | |||||
{ | |||||
return (ifp->if_pcp); | |||||
} | |||||
#ifdef DDB | #ifdef DDB | ||||
static void | static void | ||||
if_show_ifnet(struct ifnet *ifp) | if_show_ifnet(struct ifnet *ifp) | ||||
{ | { | ||||
if (ifp == NULL) | if (ifp == NULL) | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |
Nit: ‘const if_t’ for all accessors?