Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1277824 > unrolled thread
| Started by | Ameen <ameenali023@gmail.com> |
|---|---|
| First post | 2015-11-25 23:00 +0100 |
| Last post | 2015-11-30 05:10 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 2/2] Minor improvement for smsc95xx netusb driver performance. Ameen <ameenali023@gmail.com> - 2015-11-25 23:00 +0100
Re: [PATCH 2/2] Minor improvement for smsc95xx netusb driver performance. David Miller <davem@davemloft.net> - 2015-11-30 05:10 +0100
| From | Ameen <ameenali023@gmail.com> |
|---|---|
| Date | 2015-11-25 23:00 +0100 |
| Subject | [PATCH 2/2] Minor improvement for smsc95xx netusb driver performance. |
| Message-ID | <qyQgy-3rg-11@gated-at.bofh.it> |
Reduce number of memcpy's by 1-2 improve transmit performance by 2-4%.
or reduce CPU usage on a comparable value.
Signed-off-by: Ameen Ali <AmeenAli023@gmail.com>
---
drivers/net/usb/smsc95xx.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 66b3ab9..fff07cc 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1830,7 +1830,9 @@ static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev,
{
bool csum = skb->ip_summed == CHECKSUM_PARTIAL;
int overhead = csum ? SMSC95XX_TX_OVERHEAD_CSUM : SMSC95XX_TX_OVERHEAD;
- u32 tx_cmd_a, tx_cmd_b;
+ struct tx_commands_t {
+ u32 cmd_a, cmd_b, csum_preamble;
+ } tx_cmds;
/* We do not advertise SG, so skbs should be already linearized */
BUG_ON(skb_shinfo(skb)->nr_frags);
@@ -1855,26 +1857,24 @@ static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev,
+ skb->csum_offset)) = csum_fold(calc);
csum = false;
+ overhead = SMSC95XX_TX_OVERHEAD;
} else {
- u32 csum_preamble = smsc95xx_calc_csum_preamble(skb);
+ tx_cmds.csum_preamble = smsc95xx_calc_csum_preamble(skb);
skb_push(skb, 4);
- cpu_to_le32s(&csum_preamble);
- memcpy(skb->data, &csum_preamble, 4);
+ cpu_to_le32s(&tx_cmds.csum_preamble);
}
}
- skb_push(skb, 4);
- tx_cmd_b = (u32)(skb->len - 4);
+ tx_cmds.cmd_a = (u32)skb->len | TX_CMD_A_FIRST_SEG_ |
+ TX_CMD_A_LAST_SEG_;
+ cpu_to_le32s(&tx_cmds.cmd_a);
+ tx_cmds.cmd_b = (u32)skb->len;
if (csum)
- tx_cmd_b |= TX_CMD_B_CSUM_ENABLE;
- cpu_to_le32s(&tx_cmd_b);
- memcpy(skb->data, &tx_cmd_b, 4);
+ tx_cmds.cmd_b |= TX_CMD_B_CSUM_ENABLE;
- skb_push(skb, 4);
- tx_cmd_a = (u32)(skb->len - 8) | TX_CMD_A_FIRST_SEG_ |
- TX_CMD_A_LAST_SEG_;
- cpu_to_le32s(&tx_cmd_a);
- memcpy(skb->data, &tx_cmd_a, 4);
+ cpu_to_le32s(&tx_cmds.cmd_b);
+ skb_push(skb, 8);
+ memcpy(skb->data, &tx_cmds, overhead);
return skb;
}
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2015-11-30 05:10 +0100 |
| Subject | Re: [PATCH 2/2] Minor improvement for smsc95xx netusb driver performance. |
| Message-ID | <qAnWN-6Zu-3@gated-at.bofh.it> |
| In reply to | #1277824 |
From: Ameen <ameenali023@gmail.com> Date: Wed, 25 Nov 2015 23:55:26 +0200 > if (csum) > - tx_cmd_b |= TX_CMD_B_CSUM_ENABLE; > - cpu_to_le32s(&tx_cmd_b); > - memcpy(skb->data, &tx_cmd_b, 4); > + tx_cmds.cmd_b |= TX_CMD_B_CSUM_ENABLE; You've corrupted the indentation here. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web