2007-03-14 02:37:44 +00:00
|
|
|
/**************************************************************************
|
|
|
|
|
|
|
|
Copyright (c) 2007, Chelsio Inc.
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
this list of conditions and the following disclaimer.
|
|
|
|
|
2007-05-25 09:48:20 +00:00
|
|
|
2. Neither the name of the Chelsio Corporation nor the names of its
|
2007-03-14 02:37:44 +00:00
|
|
|
contributors may be used to endorse or promote products derived from
|
|
|
|
this software without specific prior written permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/module.h>
|
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <machine/bus.h>
|
|
|
|
#include <machine/resource.h>
|
|
|
|
#include <sys/bus_dma.h>
|
|
|
|
#include <sys/rman.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#include <sys/taskqueue.h>
|
|
|
|
|
|
|
|
#include <netinet/in_systm.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/ip.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
|
2007-05-28 22:57:27 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_DEFINED
|
|
|
|
#include <cxgb_include.h>
|
|
|
|
#else
|
|
|
|
#include <dev/cxgb/cxgb_include.h>
|
|
|
|
#endif
|
2007-03-14 02:37:44 +00:00
|
|
|
|
|
|
|
#include <machine/in_cksum.h>
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef M_LRO
|
|
|
|
#define M_LRO 0x0200
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2007-04-08 15:04:19 +00:00
|
|
|
#define MBUF_HEADER_CHECK(m) do { \
|
2007-04-08 22:56:18 +00:00
|
|
|
if ((m->m_len == 0) || (m->m_pkthdr.len == 0) \
|
|
|
|
|| ((m->m_flags & M_PKTHDR) == 0)) \
|
2007-03-14 02:37:44 +00:00
|
|
|
panic("lro_flush_session - mbuf len=%d pktlen=%d flags=0x%x\n", \
|
2007-04-08 15:04:19 +00:00
|
|
|
m->m_len, m->m_pkthdr.len, m->m_flags); \
|
2007-04-08 22:56:18 +00:00
|
|
|
if ((m->m_flags & M_PKTHDR) == 0) \
|
2007-03-14 02:37:44 +00:00
|
|
|
panic("first mbuf is not packet header - flags=0x%x\n", \
|
2007-04-08 15:04:19 +00:00
|
|
|
m->m_flags); \
|
2007-04-08 22:56:18 +00:00
|
|
|
if ((m->m_len < ETHER_HDR_LEN) || (m->m_pkthdr.len < ETHER_HDR_LEN)) \
|
2007-03-14 02:37:44 +00:00
|
|
|
panic("packet too small len=%d pktlen=%d\n", \
|
2007-04-08 15:04:19 +00:00
|
|
|
m->m_len, m->m_pkthdr.len);\
|
2007-03-14 02:37:44 +00:00
|
|
|
} while (0)
|
|
|
|
#else
|
|
|
|
#define MBUF_HEADER_CHECK(m)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define IPH_OFFSET (2 + sizeof (struct cpl_rx_pkt) + ETHER_HDR_LEN)
|
2007-05-25 09:48:20 +00:00
|
|
|
#define LRO_SESSION_IDX_HINT_HASH(hash) (hash & (MAX_LRO_SES - 1))
|
|
|
|
#define LRO_IDX_INC(idx) idx = (idx + 1) & (MAX_LRO_SES - 1)
|
2007-03-14 02:37:44 +00:00
|
|
|
|
|
|
|
static __inline int
|
2007-05-25 09:48:20 +00:00
|
|
|
lro_match(struct mbuf *m, struct ip *ih, struct tcphdr *th)
|
2007-03-14 02:37:44 +00:00
|
|
|
{
|
2007-06-13 05:36:00 +00:00
|
|
|
struct ip *sih = (struct ip *)(mtod(m, uint8_t *) + IPH_OFFSET);
|
2007-03-14 02:37:44 +00:00
|
|
|
struct tcphdr *sth = (struct tcphdr *) (sih + 1);
|
|
|
|
|
2007-06-13 05:36:00 +00:00
|
|
|
return (th->th_sport == sth->th_sport &&
|
|
|
|
th->th_dport == sth->th_dport &&
|
|
|
|
ih->ip_src.s_addr == sih->ip_src.s_addr &&
|
2007-03-14 02:37:44 +00:00
|
|
|
ih->ip_dst.s_addr == sih->ip_dst.s_addr);
|
|
|
|
}
|
|
|
|
|
2007-05-25 09:48:20 +00:00
|
|
|
static __inline struct t3_lro_session *
|
|
|
|
lro_lookup(struct lro_state *l, int idx, struct ip *ih, struct tcphdr *th)
|
2007-03-14 02:37:44 +00:00
|
|
|
{
|
2007-05-25 09:48:20 +00:00
|
|
|
struct t3_lro_session *s = NULL;
|
|
|
|
int active = l->nactive;
|
|
|
|
|
|
|
|
while (active) {
|
|
|
|
s = &l->sess[idx];
|
|
|
|
if (s->head) {
|
|
|
|
if (lro_match(s->head, ih, th))
|
|
|
|
break;
|
|
|
|
active--;
|
2007-03-14 02:37:44 +00:00
|
|
|
}
|
|
|
|
LRO_IDX_INC(idx);
|
|
|
|
}
|
|
|
|
|
2007-05-25 09:48:20 +00:00
|
|
|
return (s);
|
2007-03-14 02:37:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static __inline int
|
|
|
|
can_lro_packet(struct cpl_rx_pkt *cpl, unsigned int rss_hi)
|
|
|
|
{
|
|
|
|
struct ether_header *eh = (struct ether_header *)(cpl + 1);
|
|
|
|
struct ip *ih = (struct ip *)(eh + 1);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX VLAN support?
|
|
|
|
*/
|
|
|
|
if (__predict_false(G_HASHTYPE(ntohl(rss_hi)) != RSS_HASH_4_TUPLE ||
|
|
|
|
(*((uint8_t *)cpl + 1) & 0x90) != 0x10 ||
|
|
|
|
cpl->csum != 0xffff || eh->ether_type != ntohs(ETHERTYPE_IP) ||
|
|
|
|
ih->ip_hl != (sizeof (*ih) >> 2))) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
can_lro_tcpsegment(struct tcphdr *th)
|
|
|
|
{
|
|
|
|
int olen = (th->th_off << 2) - sizeof (*th);
|
|
|
|
u8 control_bits = *((u8 *)th + 13);
|
|
|
|
|
|
|
|
if (__predict_false((control_bits & 0xB7) != 0x10))
|
|
|
|
goto no_lro;
|
|
|
|
|
|
|
|
if (olen) {
|
|
|
|
uint32_t *ptr = (u32 *)(th + 1);
|
|
|
|
if (__predict_false(olen != TCPOLEN_TSTAMP_APPA ||
|
|
|
|
*ptr != ntohl((TCPOPT_NOP << 24) |
|
|
|
|
(TCPOPT_NOP << 16) |
|
|
|
|
(TCPOPT_TIMESTAMP << 8) |
|
|
|
|
TCPOLEN_TIMESTAMP)))
|
|
|
|
goto no_lro;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
no_lro:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline void
|
2007-05-25 09:48:20 +00:00
|
|
|
lro_new_session_init(struct t3_lro_session *s, struct mbuf *m)
|
2007-03-14 02:37:44 +00:00
|
|
|
{
|
2007-06-13 05:36:00 +00:00
|
|
|
struct ip *ih = (struct ip *)(mtod(m, uint8_t *) + IPH_OFFSET);
|
2007-03-14 02:37:44 +00:00
|
|
|
struct tcphdr *th = (struct tcphdr *) (ih + 1);
|
|
|
|
int ip_len = ntohs(ih->ip_len);
|
|
|
|
|
2007-04-08 15:04:19 +00:00
|
|
|
DPRINTF("%s(s=%p, m=%p)\n", __FUNCTION__, s, m);
|
2007-03-14 02:37:44 +00:00
|
|
|
|
2007-05-25 09:48:20 +00:00
|
|
|
s->head = m;
|
2007-04-08 15:04:19 +00:00
|
|
|
|
|
|
|
MBUF_HEADER_CHECK(m);
|
2007-03-14 02:37:44 +00:00
|
|
|
s->ip_len = ip_len;
|
|
|
|
s->seq = ntohl(th->th_seq) + ip_len - sizeof(*ih) - (th->th_off << 2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-05-25 09:48:20 +00:00
|
|
|
lro_flush_session(struct sge_qset *qs, struct t3_lro_session *s, struct mbuf *m)
|
2007-03-14 02:37:44 +00:00
|
|
|
{
|
2007-05-25 09:48:20 +00:00
|
|
|
struct lro_state *l = &qs->lro;
|
|
|
|
struct mbuf *sm = s->head;
|
2007-06-13 05:36:00 +00:00
|
|
|
struct ip *ih = (struct ip *)(mtod(sm, uint8_t *) + IPH_OFFSET);
|
2007-03-14 02:37:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
DPRINTF("%s(qs=%p, s=%p, ", __FUNCTION__,
|
|
|
|
qs, s);
|
|
|
|
|
2007-04-08 15:04:19 +00:00
|
|
|
if (m)
|
|
|
|
DPRINTF("m=%p)\n", m);
|
2007-03-14 02:37:44 +00:00
|
|
|
else
|
2007-04-08 15:04:19 +00:00
|
|
|
DPRINTF("m=NULL)\n");
|
2007-03-14 02:37:44 +00:00
|
|
|
|
|
|
|
ih->ip_len = htons(s->ip_len);
|
|
|
|
ih->ip_sum = 0;
|
|
|
|
ih->ip_sum = in_cksum_hdr(ih);
|
|
|
|
|
2007-04-08 18:02:37 +00:00
|
|
|
MBUF_HEADER_CHECK(sm);
|
2007-03-14 02:37:44 +00:00
|
|
|
|
2007-04-08 15:04:19 +00:00
|
|
|
sm->m_flags |= M_LRO;
|
|
|
|
t3_rx_eth(qs->port, &qs->rspq, sm, 2);
|
2007-03-14 02:37:44 +00:00
|
|
|
|
2007-04-08 15:04:19 +00:00
|
|
|
if (m) {
|
2007-05-25 09:48:20 +00:00
|
|
|
s->head = m;
|
2007-04-08 15:04:19 +00:00
|
|
|
lro_new_session_init(s, m);
|
2007-03-14 02:37:44 +00:00
|
|
|
} else {
|
2007-05-25 09:48:20 +00:00
|
|
|
s->head = NULL;
|
|
|
|
l->nactive--;
|
2007-03-14 02:37:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
qs->port_stats[SGE_PSTATS_LRO_FLUSHED]++;
|
|
|
|
}
|
|
|
|
|
2007-05-25 09:48:20 +00:00
|
|
|
static __inline struct t3_lro_session *
|
2007-04-08 15:04:19 +00:00
|
|
|
lro_new_session(struct sge_qset *qs, struct mbuf *m, uint32_t rss_hash)
|
2007-03-14 02:37:44 +00:00
|
|
|
{
|
2007-05-25 09:48:20 +00:00
|
|
|
struct lro_state *l = &qs->lro;
|
2007-03-14 02:37:44 +00:00
|
|
|
int idx = LRO_SESSION_IDX_HINT_HASH(rss_hash);
|
2007-05-25 09:48:20 +00:00
|
|
|
struct t3_lro_session *s = &l->sess[idx];
|
2007-03-14 02:37:44 +00:00
|
|
|
|
2007-04-08 15:04:19 +00:00
|
|
|
DPRINTF("%s(qs=%p, m=%p, rss_hash=0x%x)\n", __FUNCTION__,
|
|
|
|
qs, m, rss_hash);
|
2007-03-14 02:37:44 +00:00
|
|
|
|
2007-05-25 09:48:20 +00:00
|
|
|
if (__predict_true(!s->head))
|
2007-03-14 02:37:44 +00:00
|
|
|
goto done;
|
|
|
|
|
2007-05-25 09:48:20 +00:00
|
|
|
if (l->nactive > MAX_LRO_SES)
|
2007-03-14 02:37:44 +00:00
|
|
|
panic("MAX_LRO_PER_QSET exceeded");
|
|
|
|
|
2007-05-25 09:48:20 +00:00
|
|
|
if (l->nactive == MAX_LRO_SES) {
|
2007-04-08 15:04:19 +00:00
|
|
|
lro_flush_session(qs, s, m);
|
2007-03-14 02:37:44 +00:00
|
|
|
qs->port_stats[SGE_PSTATS_LRO_X_STREAMS]++;
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
LRO_IDX_INC(idx);
|
2007-05-25 09:48:20 +00:00
|
|
|
s = &l->sess[idx];
|
|
|
|
if (!s->head)
|
2007-03-14 02:37:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
done:
|
2007-04-08 15:04:19 +00:00
|
|
|
lro_new_session_init(s, m);
|
2007-05-25 09:48:20 +00:00
|
|
|
l->nactive++;
|
2007-03-14 02:37:44 +00:00
|
|
|
|
2007-04-08 15:04:19 +00:00
|
|
|
return s;
|
2007-03-14 02:37:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static __inline int
|
2007-05-25 09:48:20 +00:00
|
|
|
lro_update_session(struct t3_lro_session *s, struct mbuf *m)
|
2007-03-14 02:37:44 +00:00
|
|
|
{
|
2007-05-25 09:48:20 +00:00
|
|
|
struct mbuf *sm = s->head;
|
2007-06-13 05:36:00 +00:00
|
|
|
struct cpl_rx_pkt *cpl = (struct cpl_rx_pkt *)(mtod(sm, uint8_t *) + 2);
|
|
|
|
struct cpl_rx_pkt *ncpl = (struct cpl_rx_pkt *)(mtod(m, uint8_t *) + 2);
|
|
|
|
struct ip *nih = (struct ip *)(mtod(m, uint8_t *) + IPH_OFFSET);
|
2007-03-14 02:37:44 +00:00
|
|
|
struct tcphdr *th, *nth = (struct tcphdr *)(nih + 1);
|
|
|
|
uint32_t seq = ntohl(nth->th_seq);
|
|
|
|
int plen, tcpiphlen, olen = (nth->th_off << 2) - sizeof (*nth);
|
|
|
|
|
|
|
|
|
2007-04-08 15:04:19 +00:00
|
|
|
DPRINTF("%s(s=%p, m=%p)\n", __FUNCTION__, s, m);
|
2007-03-14 02:37:44 +00:00
|
|
|
if (cpl->vlan_valid && cpl->vlan != ncpl->vlan) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (__predict_false(seq != s->seq)) {
|
|
|
|
DPRINTF("sequence mismatch\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2007-04-08 18:02:37 +00:00
|
|
|
MBUF_HEADER_CHECK(sm);
|
2007-06-13 05:36:00 +00:00
|
|
|
th = (struct tcphdr *)(mtod(sm, uint8_t *) + IPH_OFFSET + sizeof (struct ip));
|
2007-03-14 02:37:44 +00:00
|
|
|
|
|
|
|
if (olen) {
|
|
|
|
uint32_t *ptr = (uint32_t *)(th + 1);
|
|
|
|
uint32_t *nptr = (uint32_t *)(nth + 1);
|
|
|
|
|
|
|
|
if (__predict_false(ntohl(*(ptr + 1)) > ntohl(*(nptr + 1)) ||
|
|
|
|
!*(nptr + 2))) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
*(ptr + 1) = *(nptr + 1);
|
|
|
|
*(ptr + 2) = *(nptr + 2);
|
|
|
|
}
|
|
|
|
th->th_ack = nth->th_ack;
|
|
|
|
th->th_win = nth->th_win;
|
|
|
|
|
|
|
|
tcpiphlen = (nth->th_off << 2) + sizeof (*nih);
|
|
|
|
plen = ntohs(nih->ip_len) - tcpiphlen;
|
|
|
|
s->seq += plen;
|
|
|
|
s->ip_len += plen;
|
2007-04-08 15:04:19 +00:00
|
|
|
sm->m_pkthdr.len += plen;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX FIX ME
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2007-03-14 02:37:44 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* XXX this I *do not* understand */
|
|
|
|
if (plen > skb_shinfo(s->skb)->gso_size)
|
|
|
|
skb_shinfo(s->skb)->gso_size = plen;
|
|
|
|
#endif
|
|
|
|
#if __FreeBSD_version > 700000
|
2007-04-08 15:04:19 +00:00
|
|
|
if (plen > sm->m_pkthdr.tso_segsz)
|
|
|
|
sm->m_pkthdr.tso_segsz = plen;
|
2007-03-14 02:37:44 +00:00
|
|
|
#endif
|
|
|
|
DPRINTF("m_adj(%d)\n", (int)(IPH_OFFSET + tcpiphlen));
|
|
|
|
m_adj(m, IPH_OFFSET + tcpiphlen);
|
|
|
|
#if 0
|
|
|
|
if (__predict_false(!skb_shinfo(s->skb)->frag_list))
|
|
|
|
skb_shinfo(s->skb)->frag_list = skb;
|
|
|
|
|
|
|
|
#endif
|
2007-04-08 15:04:19 +00:00
|
|
|
|
2007-03-14 02:37:44 +00:00
|
|
|
#if 0
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX we really need to be able to
|
|
|
|
* support vectors of buffers in FreeBSD
|
|
|
|
*/
|
|
|
|
int nr = skb_shinfo(s->skb)->nr_frags;
|
|
|
|
skb_shinfo(s->skb)->frags[nr].page = frag->page;
|
|
|
|
skb_shinfo(s->skb)->frags[nr].page_offset =
|
|
|
|
frag->page_offset + IPH_OFFSET + tcpiphlen;
|
|
|
|
skb_shinfo(s->skb)->frags[nr].size = plen;
|
|
|
|
skb_shinfo(s->skb)->nr_frags = ++nr;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2007-04-08 15:04:19 +00:00
|
|
|
t3_rx_eth_lro(adapter_t *adap, struct sge_rspq *rq, struct mbuf *m,
|
2007-03-14 02:37:44 +00:00
|
|
|
int ethpad, uint32_t rss_hash, uint32_t rss_csum, int lro)
|
|
|
|
{
|
|
|
|
struct sge_qset *qs = rspq_to_qset(rq);
|
2007-06-13 05:36:00 +00:00
|
|
|
struct cpl_rx_pkt *cpl = (struct cpl_rx_pkt *)(mtod(m, uint8_t *) + ethpad);
|
2007-03-14 02:37:44 +00:00
|
|
|
struct ether_header *eh = (struct ether_header *)(cpl + 1);
|
|
|
|
struct ip *ih;
|
|
|
|
struct tcphdr *th;
|
2007-05-25 09:48:20 +00:00
|
|
|
struct t3_lro_session *s = NULL;
|
2007-03-14 02:37:44 +00:00
|
|
|
struct port_info *pi = qs->port;
|
|
|
|
|
|
|
|
if (lro == 0)
|
|
|
|
goto no_lro;
|
|
|
|
|
|
|
|
if (!can_lro_packet(cpl, rss_csum))
|
|
|
|
goto no_lro;
|
|
|
|
|
|
|
|
if (&adap->port[cpl->iff] != pi)
|
|
|
|
panic("bad port index %d\n", cpl->iff);
|
|
|
|
|
|
|
|
ih = (struct ip *)(eh + 1);
|
|
|
|
th = (struct tcphdr *)(ih + 1);
|
|
|
|
|
2007-05-25 09:48:20 +00:00
|
|
|
s = lro_lookup(&qs->lro,
|
2007-03-14 02:37:44 +00:00
|
|
|
LRO_SESSION_IDX_HINT_HASH(rss_hash), ih, th);
|
|
|
|
|
|
|
|
if (__predict_false(!can_lro_tcpsegment(th))) {
|
|
|
|
goto no_lro;
|
|
|
|
} else if (__predict_false(!s)) {
|
2007-04-08 15:04:19 +00:00
|
|
|
s = lro_new_session(qs, m, rss_hash);
|
2007-03-14 02:37:44 +00:00
|
|
|
} else {
|
2007-04-08 15:04:19 +00:00
|
|
|
if (lro_update_session(s, m)) {
|
|
|
|
lro_flush_session(qs, s, m);
|
2007-03-14 02:37:44 +00:00
|
|
|
}
|
2007-05-25 09:48:20 +00:00
|
|
|
if (__predict_false(s->head->m_pkthdr.len + pi->ifp->if_mtu > 65535)) {
|
2007-03-14 02:37:44 +00:00
|
|
|
lro_flush_session(qs, s, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
qs->port_stats[SGE_PSTATS_LRO_QUEUED]++;
|
|
|
|
return;
|
|
|
|
no_lro:
|
|
|
|
if (s)
|
|
|
|
lro_flush_session(qs, s, NULL);
|
|
|
|
|
|
|
|
if (m->m_len == 0 || m->m_pkthdr.len == 0 || (m->m_flags & M_PKTHDR) == 0)
|
|
|
|
DPRINTF("rx_eth_lro mbuf len=%d pktlen=%d flags=0x%x\n",
|
|
|
|
m->m_len, m->m_pkthdr.len, m->m_flags);
|
|
|
|
t3_rx_eth(pi, rq, m, ethpad);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2007-05-25 09:48:20 +00:00
|
|
|
t3_lro_flush(adapter_t *adap, struct sge_qset *qs, struct lro_state *state)
|
2007-03-14 02:37:44 +00:00
|
|
|
{
|
2007-05-25 09:48:20 +00:00
|
|
|
unsigned int idx = state->active_idx;
|
2007-03-14 02:37:44 +00:00
|
|
|
|
2007-05-25 09:48:20 +00:00
|
|
|
while (state->nactive) {
|
|
|
|
struct t3_lro_session *s = &state->sess[idx];
|
|
|
|
|
|
|
|
if (s->head)
|
2007-03-14 02:37:44 +00:00
|
|
|
lro_flush_session(qs, s, NULL);
|
|
|
|
LRO_IDX_INC(idx);
|
|
|
|
}
|
|
|
|
}
|