From 1d179332f8918a5f4e031dc068a469283b01c4c1 Mon Sep 17 00:00:00 2001 From: "shemminger@osdl.org" Date: Mon, 28 Aug 2006 10:00:50 -0700 Subject: [PATCH] sky2: optimize checksum offload information Since many packets have the same checksum starting offset and insertion location; the driver can save the last information and only tell hardware when it changes. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/sky2.c | 17 +++++++++++------ drivers/net/sky2.h | 2 ++ 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index fe60f0462c9..eafb6327d68 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -1280,12 +1280,17 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) if (skb->nh.iph->protocol == IPPROTO_UDP) ctrl |= UDPTCP; - le = get_tx_le(sky2); - le->tx.csum.start = cpu_to_le16(hdr); - le->tx.csum.offset = cpu_to_le16(offset); - le->length = 0; /* initial checksum value */ - le->ctrl = 1; /* one packet */ - le->opcode = OP_TCPLISW | HW_OWNER; + if (hdr != sky2->tx_csum_start || offset != sky2->tx_csum_offset) { + sky2->tx_csum_start = hdr; + sky2->tx_csum_offset = offset; + + le = get_tx_le(sky2); + le->tx.csum.start = cpu_to_le16(hdr); + le->tx.csum.offset = cpu_to_le16(offset); + le->length = 0; /* initial checksum value */ + le->ctrl = 1; /* one packet */ + le->opcode = OP_TCPLISW | HW_OWNER; + } } le = get_tx_le(sky2); diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index bb92f694247..fa8af9f503e 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h @@ -1843,6 +1843,8 @@ struct sky2_port { u32 tx_addr64; u16 tx_pending; u16 tx_last_mss; + u16 tx_csum_start; + u16 tx_csum_offset; struct ring_info *rx_ring ____cacheline_aligned_in_smp; struct sky2_rx_le *rx_le; -- cgit v1.2.3