mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-28 16:43:09 +00:00
Add a function to set if_get_counter method for an ifnet. To be used
in the drivers that are already converted to "Juniper drvapi". This can be revisited in future.
This commit is contained in:
parent
c63a110d6d
commit
35853c2c60
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271770
@ -4095,6 +4095,13 @@ void if_setqflushfn(if_t ifp, if_qflush_fn_t flush_fn)
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
if_setgetcounterfn(if_t ifp, if_get_counter_t fn)
|
||||
{
|
||||
|
||||
ifp->if_get_counter = fn;
|
||||
}
|
||||
|
||||
/* Revisit these - These are inline functions originally. */
|
||||
int
|
||||
drbr_inuse_drv(if_t ifh, struct buf_ring *br)
|
||||
|
@ -609,6 +609,7 @@ void if_setioctlfn(if_t ifp, int (*)(if_t, u_long, caddr_t));
|
||||
void if_setstartfn(if_t ifp, void (*)(if_t));
|
||||
void if_settransmitfn(if_t ifp, if_transmit_fn_t);
|
||||
void if_setqflushfn(if_t ifp, if_qflush_fn_t);
|
||||
void if_setgetcounterfn(if_t ifp, if_get_counter_t);
|
||||
|
||||
/* Revisit the below. These are inline functions originally */
|
||||
int drbr_inuse_drv(if_t ifp, struct buf_ring *br);
|
||||
|
@ -237,6 +237,7 @@ static ng_rcvdata_t ng_ppp_rcvdata;
|
||||
static ng_disconnect_t ng_ppp_disconnect;
|
||||
|
||||
static ng_rcvdata_t ng_ppp_rcvdata_inet;
|
||||
static ng_rcvdata_t ng_ppp_rcvdata_inet_fast;
|
||||
static ng_rcvdata_t ng_ppp_rcvdata_ipv6;
|
||||
static ng_rcvdata_t ng_ppp_rcvdata_ipx;
|
||||
static ng_rcvdata_t ng_ppp_rcvdata_atalk;
|
||||
@ -792,6 +793,19 @@ ng_ppp_rcvdata_inet(hook_p hook, item_p item)
|
||||
return (ng_ppp_hcomp_xmit(NG_HOOK_NODE(hook), item, PROT_IP));
|
||||
}
|
||||
|
||||
/*
|
||||
* Receive data on a hook inet and pass it directly to first link.
|
||||
*/
|
||||
static int
|
||||
ng_ppp_rcvdata_inet_fast(hook_p hook, item_p item)
|
||||
{
|
||||
const node_p node = NG_HOOK_NODE(hook);
|
||||
const priv_p priv = NG_NODE_PRIVATE(node);
|
||||
|
||||
return (ng_ppp_link_xmit(node, item, PROT_IP, priv->activeLinks[0],
|
||||
NGI_M(item)->m_pkthdr.len));
|
||||
}
|
||||
|
||||
/*
|
||||
* Receive data on a hook ipv6.
|
||||
*/
|
||||
@ -2530,6 +2544,20 @@ ng_ppp_update(node_p node, int newConf)
|
||||
link->seq = MP_NOSEQ;
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->hooks[HOOK_INDEX_INET] != NULL) {
|
||||
if (priv->conf.enableIP == 1 &&
|
||||
priv->numActiveLinks == 1 &&
|
||||
priv->conf.enableMultilink == 0 &&
|
||||
priv->conf.enableCompression == 0 &&
|
||||
priv->conf.enableEncryption == 0 &&
|
||||
priv->conf.enableVJCompression == 0)
|
||||
NG_HOOK_SET_RCVDATA(priv->hooks[HOOK_INDEX_INET],
|
||||
ng_ppp_rcvdata_inet_fast);
|
||||
else
|
||||
NG_HOOK_SET_RCVDATA(priv->hooks[HOOK_INDEX_INET],
|
||||
ng_ppp_rcvdata_inet);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user