Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6116
b: refs/heads/master
c: 2600636
h: refs/heads/master
v: v3
  • Loading branch information
Dale Farnsworth authored and Jeff Garzik committed Aug 23, 2005
1 parent 2f718fc commit b133843
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 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: e960fc5c7d9144b1ce80dda9891ca7dfc656c078
refs/heads/master: 2600636065406dc14948ac2d2913c66c51be80d5
29 changes: 18 additions & 11 deletions trunk/drivers/net/mv643xx_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,16 +1157,20 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (!skb_shinfo(skb)->nr_frags) {
linear:
if (skb->ip_summed != CHECKSUM_HW) {
/* Errata BTS #50, IHL must be 5 if no HW checksum */
pkt_info.cmd_sts = ETH_TX_ENABLE_INTERRUPT |
ETH_TX_FIRST_DESC | ETH_TX_LAST_DESC;
ETH_TX_FIRST_DESC |
ETH_TX_LAST_DESC |
5 << ETH_TX_IHL_SHIFT;
pkt_info.l4i_chk = 0;
} else {
u32 ipheader = skb->nh.iph->ihl << 11;

pkt_info.cmd_sts = ETH_TX_ENABLE_INTERRUPT |
ETH_TX_FIRST_DESC | ETH_TX_LAST_DESC |
ETH_GEN_TCP_UDP_CHECKSUM |
ETH_GEN_IP_V_4_CHECKSUM | ipheader;
ETH_TX_FIRST_DESC |
ETH_TX_LAST_DESC |
ETH_GEN_TCP_UDP_CHECKSUM |
ETH_GEN_IP_V_4_CHECKSUM |
skb->nh.iph->ihl << ETH_TX_IHL_SHIFT;
/* CPU already calculated pseudo header checksum. */
if (skb->nh.iph->protocol == IPPROTO_UDP) {
pkt_info.cmd_sts |= ETH_UDP_FRAME;
Expand All @@ -1193,7 +1197,6 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
stats->tx_bytes += pkt_info.byte_cnt;
} else {
unsigned int frag;
u32 ipheader;

/* Since hardware can't handle unaligned fragments smaller
* than 9 bytes, if we find any, we linearize the skb
Expand Down Expand Up @@ -1222,12 +1225,16 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
DMA_TO_DEVICE);
pkt_info.l4i_chk = 0;
pkt_info.return_info = 0;
pkt_info.cmd_sts = ETH_TX_FIRST_DESC;

if (skb->ip_summed == CHECKSUM_HW) {
ipheader = skb->nh.iph->ihl << 11;
pkt_info.cmd_sts |= ETH_GEN_TCP_UDP_CHECKSUM |
ETH_GEN_IP_V_4_CHECKSUM | ipheader;
if (skb->ip_summed != CHECKSUM_HW)
/* Errata BTS #50, IHL must be 5 if no HW checksum */
pkt_info.cmd_sts = ETH_TX_FIRST_DESC |
5 << ETH_TX_IHL_SHIFT;
else {
pkt_info.cmd_sts = ETH_TX_FIRST_DESC |
ETH_GEN_TCP_UDP_CHECKSUM |
ETH_GEN_IP_V_4_CHECKSUM |
skb->nh.iph->ihl << ETH_TX_IHL_SHIFT;
/* CPU already calculated pseudo header checksum. */
if (skb->nh.iph->protocol == IPPROTO_UDP) {
pkt_info.cmd_sts |= ETH_UDP_FRAME;
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/net/mv643xx_eth.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
/* Checksum offload for Tx works for most packets, but
* fails if previous packet sent did not use hw csum
*/
#undef MV643XX_CHECKSUM_OFFLOAD_TX
#define MV643XX_CHECKSUM_OFFLOAD_TX
#define MV643XX_NAPI
#define MV643XX_TX_FAST_REFILL
#undef MV643XX_RX_QUEUE_FILL_ON_TASK /* Does not work, yet */
Expand Down Expand Up @@ -217,6 +217,8 @@
#define ETH_TX_ENABLE_INTERRUPT (BIT23)
#define ETH_AUTO_MODE (BIT30)

#define ETH_TX_IHL_SHIFT 11

/* typedefs */

typedef enum _eth_func_ret_status {
Expand Down

0 comments on commit b133843

Please sign in to comment.