svn commit: r280537 - stable/10/sys/dev/sfxge
Andrew Rybchenko
arybchik at FreeBSD.org
Wed Mar 25 10:41:10 UTC 2015
Author: arybchik
Date: Wed Mar 25 10:41:09 2015
New Revision: 280537
URL: https://svnweb.freebsd.org/changeset/base/280537
Log:
MFC: 278937
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:
stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_tx.c Wed Mar 25 10:40:17 2015 (r280536)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c Wed Mar 25 10:41:09 2015 (r280537)
@@ -790,6 +790,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)
@@ -891,6 +892,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);
@@ -1007,11 +1009,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. */
@@ -1033,7 +1034,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-stable-10
mailing list