Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 327697
b: refs/heads/master
c: 53cb13c
h: refs/heads/master
i:
  327695: 532576e
v: v3
  • Loading branch information
Ben Hutchings committed Aug 24, 2012
1 parent 5704914 commit 6ad3ca7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f7251a9ce936f1006fbfdef63dbe42ae5e0fee7c
refs/heads/master: 53cb13c680b98c637d95dd731b01bc284b3aa33d
20 changes: 11 additions & 9 deletions trunk/drivers/net/ethernet/sfc/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ void efx_remove_tx_queue(struct efx_tx_queue *tx_queue)
* @dma_flags: TX buffer flags for DMA mapping - %EFX_TX_BUF_MAP_SINGLE or 0
* @protocol: Network protocol (after any VLAN header)
* @header_len: Number of bytes of header
* @full_packet_size: Number of bytes to put in each outgoing segment
* @ip_base_len: IPv4 tot_len or IPv6 payload_len, before TCP payload
*
* The state used during segmentation. It is put into this data structure
* just to make it easy to pass into inline functions.
Expand All @@ -652,7 +652,7 @@ struct tso_state {

__be16 protocol;
unsigned header_len;
int full_packet_size;
unsigned int ip_base_len;
};


Expand Down Expand Up @@ -830,12 +830,14 @@ static void tso_start(struct tso_state *st, const struct sk_buff *skb)
*/
st->header_len = ((tcp_hdr(skb)->doff << 2u)
+ PTR_DIFF(tcp_hdr(skb), skb->data));
st->full_packet_size = st->header_len + skb_shinfo(skb)->gso_size;

if (st->protocol == htons(ETH_P_IP))
if (st->protocol == htons(ETH_P_IP)) {
st->ip_base_len = st->header_len - ETH_HDR_LEN(skb);
st->ipv4_id = ntohs(ip_hdr(skb)->id);
else
} else {
st->ip_base_len = tcp_hdr(skb)->doff << 2u;
st->ipv4_id = 0;
}
st->seqnum = ntohl(tcp_hdr(skb)->seq);

EFX_BUG_ON_PARANOID(tcp_hdr(skb)->urg);
Expand Down Expand Up @@ -966,15 +968,16 @@ static int tso_start_new_packet(struct efx_tx_queue *tx_queue,
st->seqnum += skb_shinfo(skb)->gso_size;
if (st->out_len > skb_shinfo(skb)->gso_size) {
/* This packet will not finish the TSO burst. */
ip_length = st->full_packet_size - ETH_HDR_LEN(skb);
st->packet_space = skb_shinfo(skb)->gso_size;
tsoh_th->fin = 0;
tsoh_th->psh = 0;
} else {
/* This packet will be the last in the TSO burst. */
ip_length = st->header_len - ETH_HDR_LEN(skb) + st->out_len;
st->packet_space = st->out_len;
tsoh_th->fin = tcp_hdr(skb)->fin;
tsoh_th->psh = tcp_hdr(skb)->psh;
}
ip_length = st->ip_base_len + st->packet_space;

if (st->protocol == htons(ETH_P_IP)) {
struct iphdr *tsoh_iph =
Expand All @@ -989,14 +992,13 @@ static int tso_start_new_packet(struct efx_tx_queue *tx_queue,
struct ipv6hdr *tsoh_iph =
(struct ipv6hdr *)(header + SKB_IPV6_OFF(skb));

tsoh_iph->payload_len = htons(ip_length - sizeof(*tsoh_iph));
tsoh_iph->payload_len = htons(ip_length);
}

rc = efx_tso_put_header(tx_queue, buffer, header);
if (unlikely(rc))
return rc;

st->packet_space = skb_shinfo(skb)->gso_size;
++tx_queue->tso_packets;

return 0;
Expand Down

0 comments on commit 6ad3ca7

Please sign in to comment.