PERFORCE change 128808 for review
Kip Macy
kmacy at FreeBSD.org
Wed Nov 7 22:59:48 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=128808
Change 128808 by kmacy at kmacy:storage:toestack on 2007/11/08 06:58:50
fill in some "notyet" functionality
Affected files ...
.. //depot/projects/toestack/sys/dev/cxgb/cxgb_osdep.h#10 edit
.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#18 edit
Differences ...
==== //depot/projects/toestack/sys/dev/cxgb/cxgb_osdep.h#10 (text+ko) ====
@@ -72,11 +72,16 @@
#define m_get_sgl(m) ((bus_dma_segment_t *)(m)->m_pkthdr.header)
#define m_set_sgllen(m, len) ((m)->m_pkthdr.ether_vtag = len)
#define m_get_sgllen(m) ((m)->m_pkthdr.ether_vtag)
+
/*
* XXX FIXME
*/
#define m_set_toep(m, a) ((m)->m_pkthdr.header = (a))
#define m_get_toep(m) ((m)->m_pkthdr.header)
+#define m_set_handler(m, handler) ((m)->m_pkthdr.header = (handler))
+
+#define m_set_socket(m, a) ((m)->m_pkthdr.header = (a))
+#define m_get_socket(m) ((m)->m_pkthdr.header)
#define MT_DONTFREE 128
==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#18 (text+ko) ====
@@ -170,7 +170,21 @@
return cntrl;
}
+/*
+ * Populate a TID_RELEASE WR. The skb must be already propely sized.
+ */
+static inline void
+mk_tid_release(struct mbuf *m, const struct socket *so, unsigned int tid)
+{
+ struct cpl_tid_release *req;
+ m_set_priority(m, mkprio(CPL_PRIORITY_SETUP, so));
+ m->m_pkthdr.len = m->m_len = sizeof(*req);
+ req = mtod(m, struct cpl_tid_release *);
+ req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+ OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, tid));
+}
+
static inline void
make_tx_data_wr(struct socket *so, struct mbuf *m, int len, struct mbuf *tail)
{
@@ -868,7 +882,6 @@
return min(wnd, max_rcv_wnd);
}
-
/*
* Assign offload parameters to some socket fields. This code is used by
* both active and passive opens.
@@ -1951,12 +1964,11 @@
pass_accept_rpl_arp_failure(struct t3cdev *cdev, struct mbuf *m)
{
- printf("%s UNIMPLEMENTED\n", __FUNCTION__);
#ifdef notyet
TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
BLOG_SKB_CB(skb)->dev = TOE_DEV(skb->sk);
- handle_pass_open_arp_failure, skb->sk, skb);
#endif
+ handle_pass_open_arp_failure(m_get_socket(m), m);
}
/*
@@ -2086,11 +2098,10 @@
* by the TOE.
*/
static void
-process_pass_accept_req(struct socket *so, struct mbuf *m, struct toedev *tdev)
+process_pass_accept_req(struct socket *so, struct mbuf *m, struct toedev *tdev,
+ struct listen_ctx *lctx)
{
-#ifdef notyet
int rt_flags;
-#endif
struct socket *newso;
struct l2t_entry *e;
struct iff_mac tim;
@@ -2100,10 +2111,8 @@
unsigned int tid = GET_TID(req);
struct tom_data *d = TOM_DATA(tdev);
struct t3cdev *cdev = d->cdev;
- struct tcpcb *tp = sototcpcb(so);
+ struct tcpcb *newtp, *tp = sototcpcb(so);
struct toepcb *toep, *newtoep;
-
- UNIMPLEMENTED();
reply_mbuf = m_gethdr(M_NOWAIT, MT_DATA);
if (__predict_false(!reply_mbuf)) {
@@ -2118,17 +2127,15 @@
if (tp->t_state != TCPS_LISTEN)
goto reject;
-#ifdef notyet
- if (inet_csk_reqsk_queue_is_full(sk))
- goto reject;
- if (sk_acceptq_is_full(sk) && d->conf.soft_backlog_limit)
- goto reject;
-#endif
tim.mac_addr = req->dst_mac;
tim.vlan_tag = ntohs(req->vlan_tag);
if (cdev->ctl(cdev, GET_IFF_FROM_MAC, &tim) < 0 || !tim.dev)
goto reject;
#ifdef notyet
+ /*
+ * XXX do route lookup to confirm that we're still listening on this
+ * address
+ */
if (ip_route_input(skb, req->local_ip, req->peer_ip,
G_PASS_OPEN_TOS(ntohl(req->tos_tid)), tim.dev))
goto reject;
@@ -2136,16 +2143,25 @@
(RTCF_BROADCAST | RTCF_MULTICAST | RTCF_LOCAL);
dst_release(skb->dst); // done with the input route, release it
skb->dst = NULL;
- if (rt_flags != RTCF_LOCAL)
+
+ if ((rt_flags & RTF_LOCAL) == 0)
goto reject;
#endif
- newso = mk_pass_sock(so, tdev, tid, req);
- if (!newso)
+ /*
+ * XXX
+ */
+ rt_flags = RTF_LOCAL;
+ if ((rt_flags & RTF_LOCAL) == 0)
goto reject;
-#ifdef notyet
- inet_csk_reqsk_queue_added(sk, TCP_TIMEOUT_INIT);
- synq_add(sk, newsk);
-#endif
+
+
+ newso = sonewconn(so, SS_ISCONNECTED);
+ newtp = sototcpcb(so);
+ /*
+ * XXX need to inherit ULP mode
+ */
+ newtoep = toepcb_alloc(newtp);
+
/* Don't get a reference, newsk starts out with ref count 2 */
cxgb_insert_tid(cdev, d->client, newso, tid);
@@ -2155,11 +2171,9 @@
if (!ddp_mbuf)
newtoep->tp_ulp_mode = 0;
}
-#ifdef notyet
- reply_skb->sk = newsk;
-#endif
+
+ m_set_socket(reply_mbuf, newso);
set_arp_failure_handler(reply_mbuf, pass_accept_rpl_arp_failure);
-
e = newtoep->tp_l2t;
rpl = cplhdr(reply_mbuf);
@@ -2189,12 +2203,8 @@
reject:
if (tdev->ttid == TOE_ID_CHELSIO_T3)
mk_pass_accept_rpl(reply_mbuf, m);
- else {
-#ifdef notyet
- __skb_trim(reply_skb, 0);
+ else
mk_tid_release(reply_mbuf, NULL, tid);
-#endif
- }
cxgb_ofld_send(cdev, reply_mbuf);
m_free(m);
out:
@@ -2246,8 +2256,8 @@
}
#endif
- process_pass_accept_req(lso, m, &d->tdev);
- return 0;
+ process_pass_accept_req(lso, m, &d->tdev, listen_ctx);
+ return (0);
}
/*
More information about the p4-projects
mailing list