本文整理汇总了C++中INP_WLOCK_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ INP_WLOCK_ASSERT函数的具体用法?C++ INP_WLOCK_ASSERT怎么用?C++ INP_WLOCK_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了INP_WLOCK_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: undo_offload_socket
/* This is _not_ the normal way to "unoffload" a socket. */
void
undo_offload_socket(struct socket *so)
{
struct inpcb *inp = sotoinpcb(so);
struct tcpcb *tp = intotcpcb(inp);
struct toepcb *toep = tp->t_toe;
struct tom_data *td = toep->td;
struct sockbuf *sb;
INP_WLOCK_ASSERT(inp);
sb = &so->so_snd;
SOCKBUF_LOCK(sb);
sb->sb_flags &= ~SB_NOCOALESCE;
SOCKBUF_UNLOCK(sb);
sb = &so->so_rcv;
SOCKBUF_LOCK(sb);
sb->sb_flags &= ~SB_NOCOALESCE;
SOCKBUF_UNLOCK(sb);
tp->tod = NULL;
tp->t_toe = NULL;
tp->t_flags &= ~TF_TOE;
toep->inp = NULL;
toep->flags &= ~TPF_ATTACHED;
if (in_pcbrele_wlocked(inp))
panic("%s: inp freed.", __func__);
mtx_lock(&td->toep_list_lock);
TAILQ_REMOVE(&td->toep_list, toep, link);
mtx_unlock(&td->toep_list_lock);
}
示例2: in_pcbgroup_update
/*
* Two update paths: one in which the 4-tuple on an inpcb has been updated
* and therefore connection groups may need to change (or a wildcard entry
* may needed to be installed), and another in which the 4-tuple has been
* set as a result of a packet received, in which case we may be able to use
* the hash on the mbuf to avoid doing a software hash calculation for RSS.
*
* In each case: first, let the wildcard code have a go at placing it as a
* wildcard socket. If it was a wildcard, or if the connection has been
* dropped, then no pcbgroup is required (so potentially clear it);
* otherwise, calculate and update the pcbgroup for the inpcb.
*/
void
in_pcbgroup_update(struct inpcb *inp)
{
struct inpcbinfo *pcbinfo;
struct inpcbgroup *newpcbgroup;
INP_WLOCK_ASSERT(inp);
pcbinfo = inp->inp_pcbinfo;
if (!in_pcbgroup_enabled(pcbinfo))
return;
in_pcbwild_update_internal(inp);
if (!(inp->inp_flags2 & INP_PCBGROUPWILD) &&
!(inp->inp_flags & INP_DROPPED)) {
#ifdef INET6
if (inp->inp_vflag & INP_IPV6)
newpcbgroup = in6_pcbgroup_byinpcb(inp);
else
#endif
newpcbgroup = in_pcbgroup_byinpcb(inp);
} else
newpcbgroup = NULL;
in_pcbgroup_update_internal(pcbinfo, newpcbgroup, inp);
}
示例3: handle_ddp_close
void
handle_ddp_close(struct toepcb *toep, struct tcpcb *tp, struct sockbuf *sb,
__be32 rcv_nxt)
{
struct mbuf *m;
int len;
SOCKBUF_LOCK_ASSERT(sb);
INP_WLOCK_ASSERT(toep->inp);
len = be32toh(rcv_nxt) - tp->rcv_nxt;
/* Signal handle_ddp() to break out of its sleep loop. */
toep->ddp_flags &= ~(DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE);
if (len == 0)
return;
tp->rcv_nxt += len;
KASSERT(toep->sb_cc >= sbused(sb),
("%s: sb %p has more data (%d) than last time (%d).",
__func__, sb, sbused(sb), toep->sb_cc));
toep->rx_credits += toep->sb_cc - sbused(sb);
#ifdef USE_DDP_RX_FLOW_CONTROL
toep->rx_credits -= len; /* adjust for F_RX_FC_DDP */
#endif
m = get_ddp_mbuf(len);
sbappendstream_locked(sb, m, 0);
toep->sb_cc = sbused(sb);
}
示例4: t4_rcvd
void
t4_rcvd(struct toedev *tod, struct tcpcb *tp)
{
struct adapter *sc = tod->tod_softc;
struct inpcb *inp = tp->t_inpcb;
struct socket *so = inp->inp_socket;
struct sockbuf *sb = &so->so_rcv;
struct toepcb *toep = tp->t_toe;
int credits;
INP_WLOCK_ASSERT(inp);
SOCKBUF_LOCK(sb);
KASSERT(toep->sb_cc >= sb->sb_cc,
("%s: sb %p has more data (%d) than last time (%d).",
__func__, sb, sb->sb_cc, toep->sb_cc));
toep->rx_credits += toep->sb_cc - sb->sb_cc;
toep->sb_cc = sb->sb_cc;
credits = toep->rx_credits;
SOCKBUF_UNLOCK(sb);
if (credits > 0 &&
(credits + 16384 >= tp->rcv_wnd || credits >= 15 * 1024)) {
credits = send_rx_credits(sc, toep, credits);
SOCKBUF_LOCK(sb);
toep->rx_credits -= credits;
SOCKBUF_UNLOCK(sb);
tp->rcv_wnd += credits;
tp->rcv_adv += credits;
}
}
示例5: tcp_offload_connect
/*
* Provide an opportunity for a TOE driver to offload.
*/
int
tcp_offload_connect(struct socket *so, struct sockaddr *nam)
{
struct ifnet *ifp;
struct toedev *tod;
struct rtentry *rt;
int error = EOPNOTSUPP;
INP_WLOCK_ASSERT(sotoinpcb(so));
KASSERT(nam->sa_family == AF_INET || nam->sa_family == AF_INET6,
("%s: called with sa_family %d", __func__, nam->sa_family));
if (registered_toedevs == 0)
return (error);
rt = rtalloc1(nam, 0, 0);
if (rt)
RT_UNLOCK(rt);
else
return (EHOSTUNREACH);
ifp = rt->rt_ifp;
if (nam->sa_family == AF_INET && !(ifp->if_capenable & IFCAP_TOE4))
goto done;
if (nam->sa_family == AF_INET6 && !(ifp->if_capenable & IFCAP_TOE6))
goto done;
tod = TOEDEV(ifp);
if (tod != NULL)
error = tod->tod_connect(tod, so, rt, nam);
done:
RTFREE(rt);
return (error);
}
示例6: toepcb_release
/*
* Called after the last CPL for the toepcb has been received.
*
* The inp must be wlocked on entry and is unlocked (or maybe destroyed) by the
* time this function exits.
*/
static int
toepcb_release(struct toepcb *toep)
{
struct inpcb *inp = toep->tp_inp;
struct toedev *tod = toep->tp_tod;
struct tom_data *td = t3_tomdata(tod);
int rc;
INP_WLOCK_ASSERT(inp);
KASSERT(!(toep->tp_flags & TP_CPL_DONE),
("%s: double release?", __func__));
CTR2(KTR_CXGB, "%s: tid %d", __func__, toep->tp_tid);
toep->tp_flags |= TP_CPL_DONE;
toep->tp_inp = NULL;
mtx_lock(&td->toep_list_lock);
TAILQ_REMOVE(&td->toep_list, toep, link);
mtx_unlock(&td->toep_list_lock);
if (!(toep->tp_flags & TP_ATTACHED))
t3_release_offload_resources(toep);
rc = in_pcbrele_wlocked(inp);
if (!rc)
INP_WUNLOCK(inp);
return (rc);
}
示例7: t4_rcvd_locked
void
t4_rcvd_locked(struct toedev *tod, struct tcpcb *tp)
{
struct adapter *sc = tod->tod_softc;
struct inpcb *inp = tp->t_inpcb;
struct socket *so = inp->inp_socket;
struct sockbuf *sb = &so->so_rcv;
struct toepcb *toep = tp->t_toe;
int credits;
INP_WLOCK_ASSERT(inp);
SOCKBUF_LOCK_ASSERT(sb);
KASSERT(toep->sb_cc >= sbused(sb),
("%s: sb %p has more data (%d) than last time (%d).",
__func__, sb, sbused(sb), toep->sb_cc));
toep->rx_credits += toep->sb_cc - sbused(sb);
toep->sb_cc = sbused(sb);
if (toep->rx_credits > 0 &&
(tp->rcv_wnd <= 32 * 1024 || toep->rx_credits >= 64 * 1024 ||
(toep->rx_credits >= 16 * 1024 && tp->rcv_wnd <= 128 * 1024) ||
toep->sb_cc + tp->rcv_wnd < sb->sb_lowat)) {
credits = send_rx_credits(sc, toep, toep->rx_credits);
toep->rx_credits -= credits;
tp->rcv_wnd += credits;
tp->rcv_adv += credits;
}
}
示例8: insert_ddp_data
/* XXX: handle_ddp_data code duplication */
void
insert_ddp_data(struct toepcb *toep, uint32_t n)
{
struct inpcb *inp = toep->inp;
struct tcpcb *tp = intotcpcb(inp);
struct sockbuf *sb = &inp->inp_socket->so_rcv;
struct mbuf *m;
INP_WLOCK_ASSERT(inp);
SOCKBUF_LOCK_ASSERT(sb);
m = get_ddp_mbuf(n);
tp->rcv_nxt += n;
#ifndef USE_DDP_RX_FLOW_CONTROL
KASSERT(tp->rcv_wnd >= n, ("%s: negative window size", __func__));
tp->rcv_wnd -= n;
#endif
KASSERT(toep->sb_cc >= sbused(sb),
("%s: sb %p has more data (%d) than last time (%d).",
__func__, sb, sbused(sb), toep->sb_cc));
toep->rx_credits += toep->sb_cc - sbused(sb);
#ifdef USE_DDP_RX_FLOW_CONTROL
toep->rx_credits -= n; /* adjust for F_RX_FC_DDP */
#endif
sbappendstream_locked(sb, m, 0);
toep->sb_cc = sbused(sb);
}
示例9: toepcb_detach
/*
* One sided detach. The tcpcb is going away and we need to unhook the toepcb
* hanging off it. If the TOE driver is also done with the toepcb we'll release
* all offload resources.
*/
static void
toepcb_detach(struct inpcb *inp)
{
struct toepcb *toep;
struct tcpcb *tp;
KASSERT(inp, ("%s: inp is NULL", __func__));
INP_WLOCK_ASSERT(inp);
tp = intotcpcb(inp);
toep = tp->t_toe;
KASSERT(toep != NULL, ("%s: toep is NULL", __func__));
KASSERT(toep->tp_flags & TP_ATTACHED, ("%s: not attached", __func__));
CTR6(KTR_CXGB, "%s: %s %u, toep %p, inp %p, tp %p", __func__,
tp->t_state == TCPS_SYN_SENT ? "atid" : "tid", toep->tp_tid,
toep, inp, tp);
tp->t_toe = NULL;
tp->t_flags &= ~TF_TOE;
toep->tp_flags &= ~TP_ATTACHED;
if (toep->tp_flags & TP_CPL_DONE)
t3_release_offload_resources(toep);
}
示例10: tcp_offload_listen_start
void
tcp_offload_listen_start(struct tcpcb *tp)
{
INP_WLOCK_ASSERT(tp->t_inpcb);
EVENTHANDLER_INVOKE(tcp_offload_listen_start, tp);
}
示例11: rip_delhash
static void
rip_delhash(struct inpcb *inp)
{
INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo);
INP_WLOCK_ASSERT(inp);
LIST_REMOVE(inp, inp_hash);
}
示例12: tcp_offload_detach
void
tcp_offload_detach(struct tcpcb *tp)
{
struct toedev *tod = tp->tod;
KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp));
INP_WLOCK_ASSERT(tp->t_inpcb);
tod->tod_pcb_detach(tod, tp);
}
示例13: tcp_offload_input
void
tcp_offload_input(struct tcpcb *tp, struct mbuf *m)
{
struct toedev *tod = tp->tod;
KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp));
INP_WLOCK_ASSERT(tp->t_inpcb);
tod->tod_input(tod, tp, m);
}
示例14: tcp_offload_ctloutput
void
tcp_offload_ctloutput(struct tcpcb *tp, int sopt_dir, int sopt_name)
{
struct toedev *tod = tp->tod;
KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp));
INP_WLOCK_ASSERT(tp->t_inpcb);
tod->tod_ctloutput(tod, tp, sopt_dir, sopt_name);
}
示例15: tcp_offload_tcp_info
void
tcp_offload_tcp_info(struct tcpcb *tp, struct tcp_info *ti)
{
struct toedev *tod = tp->tod;
KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp));
INP_WLOCK_ASSERT(tp->t_inpcb);
tod->tod_tcp_info(tod, tp, ti);
}