svn commit: r250218 - head/sys/dev/cxgbe/tom
Navdeep Parhar
np at FreeBSD.org
Fri May 3 18:37:51 UTC 2013
Author: np
Date: Fri May 3 18:37:50 2013
New Revision: 250218
URL: http://svnweb.freebsd.org/changeset/base/250218
Log:
cxgbe/tom: Do not use M_PROTO1 to mark rx zero-copy mbufs as special.
All the M_PROTOn flags are clobbered when an mbuf is appended to the
socket buffer.
MFC after: 1 week
Modified:
head/sys/dev/cxgbe/tom/t4_cpl_io.c
head/sys/dev/cxgbe/tom/t4_ddp.c
head/sys/dev/cxgbe/tom/t4_tom.h
Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri May 3 16:29:51 2013 (r250217)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri May 3 18:37:50 2013 (r250218)
@@ -827,15 +827,8 @@ do_peer_close(struct sge_iq *iq, const s
sb = &so->so_rcv;
SOCKBUF_LOCK(sb);
if (__predict_false(toep->ddp_flags & (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE))) {
- m = m_get(M_NOWAIT, MT_DATA);
- if (m == NULL)
- CXGBE_UNIMPLEMENTED("mbuf alloc failure");
-
- m->m_len = be32toh(cpl->rcv_nxt) - tp->rcv_nxt;
- m->m_flags |= M_DDP; /* Data is already where it should be */
- m->m_data = "nothing to see here";
+ m = get_ddp_mbuf(be32toh(cpl->rcv_nxt) - tp->rcv_nxt);
tp->rcv_nxt = be32toh(cpl->rcv_nxt);
-
toep->ddp_flags &= ~(DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE);
KASSERT(toep->sb_cc >= sb->sb_cc,
Modified: head/sys/dev/cxgbe/tom/t4_ddp.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_ddp.c Fri May 3 16:29:51 2013 (r250217)
+++ head/sys/dev/cxgbe/tom/t4_ddp.c Fri May 3 18:37:50 2013 (r250218)
@@ -217,13 +217,7 @@ insert_ddp_data(struct toepcb *toep, uin
INP_WLOCK_ASSERT(inp);
SOCKBUF_LOCK_ASSERT(sb);
- m = m_get(M_NOWAIT, MT_DATA);
- if (m == NULL)
- CXGBE_UNIMPLEMENTED("mbuf alloc failure");
- m->m_len = n;
- m->m_flags |= M_DDP; /* Data is already where it should be */
- m->m_data = "nothing to see here";
-
+ 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__));
@@ -457,13 +451,7 @@ handle_ddp_data(struct toepcb *toep, __b
KASSERT(tp->rcv_wnd >= len, ("%s: negative window size", __func__));
tp->rcv_wnd -= len;
#endif
-
- m = m_get(M_NOWAIT, MT_DATA);
- if (m == NULL)
- CXGBE_UNIMPLEMENTED("mbuf alloc failure");
- m->m_len = len;
- m->m_flags |= M_DDP; /* Data is already where it should be */
- m->m_data = "nothing to see here";
+ m = get_ddp_mbuf(len);
SOCKBUF_LOCK(sb);
if (report & F_DDP_BUF_COMPLETE)
@@ -1022,6 +1010,29 @@ soreceive_rcvoob(struct socket *so, stru
CXGBE_UNIMPLEMENTED(__func__);
}
+static char ddp_magic_str[] = "nothing to see here";
+
+struct mbuf *
+get_ddp_mbuf(int len)
+{
+ struct mbuf *m;
+
+ m = m_get(M_NOWAIT, MT_DATA);
+ if (m == NULL)
+ CXGBE_UNIMPLEMENTED("mbuf alloc failure");
+ m->m_len = len;
+ m->m_data = &ddp_magic_str[0];
+
+ return (m);
+}
+
+static inline int
+is_ddp_mbuf(struct mbuf *m)
+{
+
+ return (m->m_data == &ddp_magic_str[0]);
+}
+
/*
* Copy an mbuf chain into a uio limited by len if set.
*/
@@ -1040,7 +1051,7 @@ m_mbuftouio_ddp(struct uio *uio, struct
for (; m != NULL; m = m->m_next) {
length = min(m->m_len, total - progress);
- if (m->m_flags & M_DDP) {
+ if (is_ddp_mbuf(m)) {
enum uio_seg segflag = uio->uio_segflg;
uio->uio_segflg = UIO_NOCOPY;
Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tom.h Fri May 3 16:29:51 2013 (r250217)
+++ head/sys/dev/cxgbe/tom/t4_tom.h Fri May 3 18:37:50 2013 (r250218)
@@ -49,8 +49,6 @@
#define DDP_RSVD_WIN (16 * 1024U)
#define SB_DDP_INDICATE SB_IN_TOE /* soreceive must respond to indicate */
-#define M_DDP M_PROTO1
-
#define USE_DDP_RX_FLOW_CONTROL
/* TOE PCB flags */
@@ -279,6 +277,7 @@ void t4_init_ddp(struct adapter *, struc
void t4_uninit_ddp(struct adapter *, struct tom_data *);
int t4_soreceive_ddp(struct socket *, struct sockaddr **, struct uio *,
struct mbuf **, struct mbuf **, int *);
+struct mbuf *get_ddp_mbuf(int);
void enable_ddp(struct adapter *, struct toepcb *toep);
void release_ddp_resources(struct toepcb *toep);
void insert_ddp_data(struct toepcb *, uint32_t);
More information about the svn-src-head
mailing list