svn commit: r278937 - head/sys/dev/sfxge
Andrew Rybchenko
arybchik at FreeBSD.org
Wed Feb 18 06:18:52 UTC 2015
Author: arybchik
Date: Wed Feb 18 06:18:51 2015
New Revision: 278937
URL: https://svnweb.freebsd.org/changeset/base/278937
Log:
sfxge: add TCP segment size to sfxge_tso_state
It avoids access to m_pkthdr when TSO packet is started and also makes
tso_start_new_packet() function smaller.
Sponsored by: Solarflare Communications, Inc.
Approved by: gnn (mentor)
Modified:
head/sys/dev/sfxge/sfxge_tx.c
Modified: head/sys/dev/sfxge/sfxge_tx.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_tx.c Wed Feb 18 05:53:04 2015 (r278936)
+++ head/sys/dev/sfxge/sfxge_tx.c Wed Feb 18 06:18:51 2015 (r278937)
@@ -791,6 +791,7 @@ struct sfxge_tso_state {
ssize_t nh_off; /* Offset of network header */
ssize_t tcph_off; /* Offset of TCP header */
unsigned header_len; /* Number of bytes of header */
+ unsigned seg_size; /* TCP segment size */
};
static const struct ip *tso_iph(const struct sfxge_tso_state *tso)
@@ -892,6 +893,7 @@ static void tso_start(struct sfxge_tso_s
}
tso->header_len = tso->tcph_off + 4 * tso_tcph(tso)->th_off;
+ tso->seg_size = mbuf->m_pkthdr.tso_segsz;
tso->seqnum = ntohl(tso_tcph(tso)->th_seq);
@@ -1008,11 +1010,10 @@ static int tso_start_new_packet(struct s
m_copydata(tso->mbuf, 0, tso->header_len, header);
tsoh_th->th_seq = htonl(tso->seqnum);
- tso->seqnum += tso->mbuf->m_pkthdr.tso_segsz;
- if (tso->out_len > tso->mbuf->m_pkthdr.tso_segsz) {
+ tso->seqnum += tso->seg_size;
+ if (tso->out_len > tso->seg_size) {
/* This packet will not finish the TSO burst. */
- ip_length = tso->header_len - tso->nh_off +
- tso->mbuf->m_pkthdr.tso_segsz;
+ ip_length = tso->header_len - tso->nh_off + tso->seg_size;
tsoh_th->th_flags &= ~(TH_FIN | TH_PUSH);
} else {
/* This packet will be the last in the TSO burst. */
@@ -1034,7 +1035,7 @@ static int tso_start_new_packet(struct s
/* Make the header visible to the hardware. */
bus_dmamap_sync(txq->packet_dma_tag, map, BUS_DMASYNC_PREWRITE);
- tso->packet_space = tso->mbuf->m_pkthdr.tso_segsz;
+ tso->packet_space = tso->seg_size;
txq->tso_packets++;
/* Form a descriptor for this header. */
More information about the svn-src-all
mailing list