* [PATCH 1/2] GRETH: RX/TX bytes were never increased
@ 2011-09-08 13:14 Daniel Hellstrom
2011-09-08 13:14 ` [PATCH 2/2] GRETH: avoid overwrite IP-stack's IP-frags checksum Daniel Hellstrom
2011-09-20 19:16 ` [PATCH 1/2] GRETH: RX/TX bytes were never increased David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Daniel Hellstrom @ 2011-09-08 13:14 UTC (permalink / raw)
To: davem; +Cc: netdev, kristoffer
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
---
drivers/net/greth.c | 5 +++++
drivers/net/greth.h | 1 +
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index 672f096..9d39fb9 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -426,6 +426,7 @@ greth_start_xmit(struct sk_buff *skb, struct net_device *dev)
dma_sync_single_for_device(greth->dev, dma_addr, skb->len, DMA_TO_DEVICE);
status = GRETH_BD_EN | GRETH_BD_IE | (skb->len & GRETH_BD_LEN);
+ greth->tx_bufs_length[greth->tx_next] = skb->len & GRETH_BD_LEN;
/* Wrap around descriptor ring */
if (greth->tx_next == GRETH_TXBD_NUM_MASK) {
@@ -639,6 +640,7 @@ static void greth_clean_tx(struct net_device *dev)
dev->stats.tx_fifo_errors++;
}
dev->stats.tx_packets++;
+ dev->stats.tx_bytes += greth->tx_bufs_length[greth->tx_last];
greth->tx_last = NEXT_TX(greth->tx_last);
greth->tx_free++;
}
@@ -693,6 +695,7 @@ static void greth_clean_tx_gbit(struct net_device *dev)
greth->tx_skbuff[greth->tx_last] = NULL;
greth_update_tx_stats(dev, stat);
+ dev->stats.tx_bytes += skb->len;
bdp = greth->tx_bd_base + greth->tx_last;
@@ -794,6 +797,7 @@ static int greth_rx(struct net_device *dev, int limit)
memcpy(skb_put(skb, pkt_len), phys_to_virt(dma_addr), pkt_len);
skb->protocol = eth_type_trans(skb, dev);
+ dev->stats.rx_bytes += pkt_len;
dev->stats.rx_packets++;
netif_receive_skb(skb);
}
@@ -908,6 +912,7 @@ static int greth_rx_gbit(struct net_device *dev, int limit)
skb->protocol = eth_type_trans(skb, dev);
dev->stats.rx_packets++;
+ dev->stats.rx_bytes += pkt_len;
netif_receive_skb(skb);
greth->rx_skbuff[greth->rx_cur] = newskb;
diff --git a/drivers/net/greth.h b/drivers/net/greth.h
index 9a0040d..232a622 100644
--- a/drivers/net/greth.h
+++ b/drivers/net/greth.h
@@ -103,6 +103,7 @@ struct greth_private {
unsigned char *tx_bufs[GRETH_TXBD_NUM];
unsigned char *rx_bufs[GRETH_RXBD_NUM];
+ u16 tx_bufs_length[GRETH_TXBD_NUM];
u16 tx_next;
u16 tx_last;
--
1.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] GRETH: avoid overwrite IP-stack's IP-frags checksum
2011-09-08 13:14 [PATCH 1/2] GRETH: RX/TX bytes were never increased Daniel Hellstrom
@ 2011-09-08 13:14 ` Daniel Hellstrom
2011-09-09 13:29 ` Eric Dumazet
2011-09-20 19:16 ` [PATCH 1/2] GRETH: RX/TX bytes were never increased David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Daniel Hellstrom @ 2011-09-08 13:14 UTC (permalink / raw)
To: davem; +Cc: netdev, kristoffer
The GRETH GBIT core does not do checksum offloading for IP
segmentation. This patch adds a check in the xmit function to
determine if the stack has calculated the checksum for us.
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
---
drivers/net/greth.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index 9d39fb9..27ba855 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -489,7 +489,8 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
if (nr_frags != 0)
status = GRETH_TXBD_MORE;
- status |= GRETH_TXBD_CSALL;
+ if (skb->ip_summed == CHECKSUM_PARTIAL)
+ status |= GRETH_TXBD_CSALL;
status |= skb_headlen(skb) & GRETH_BD_LEN;
if (greth->tx_next == GRETH_TXBD_NUM_MASK)
status |= GRETH_BD_WR;
@@ -512,7 +513,9 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
greth->tx_skbuff[curr_tx] = NULL;
bdp = greth->tx_bd_base + curr_tx;
- status = GRETH_TXBD_CSALL | GRETH_BD_EN;
+ status = GRETH_BD_EN;
+ if (skb->ip_summed == CHECKSUM_PARTIAL)
+ status | GRETH_TXBD_CSALL;
status |= frag->size & GRETH_BD_LEN;
/* Wrap around descriptor ring */
--
1.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] GRETH: avoid overwrite IP-stack's IP-frags checksum
2011-09-08 13:14 ` [PATCH 2/2] GRETH: avoid overwrite IP-stack's IP-frags checksum Daniel Hellstrom
@ 2011-09-09 13:29 ` Eric Dumazet
2011-09-09 14:41 ` Daniel Hellstrom
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2011-09-09 13:29 UTC (permalink / raw)
To: Daniel Hellstrom; +Cc: davem, netdev, kristoffer
Le jeudi 08 septembre 2011 à 15:14 +0200, Daniel Hellstrom a écrit :
> The GRETH GBIT core does not do checksum offloading for IP
> segmentation. This patch adds a check in the xmit function to
> determine if the stack has calculated the checksum for us.
>
> Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
> ---
> drivers/net/greth.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/greth.c b/drivers/net/greth.c
> index 9d39fb9..27ba855 100644
> --- a/drivers/net/greth.c
> +++ b/drivers/net/greth.c
> @@ -489,7 +489,8 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
> if (nr_frags != 0)
> status = GRETH_TXBD_MORE;
>
> - status |= GRETH_TXBD_CSALL;
> + if (skb->ip_summed == CHECKSUM_PARTIAL)
> + status |= GRETH_TXBD_CSALL;
> status |= skb_headlen(skb) & GRETH_BD_LEN;
> if (greth->tx_next == GRETH_TXBD_NUM_MASK)
> status |= GRETH_BD_WR;
> @@ -512,7 +513,9 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
> greth->tx_skbuff[curr_tx] = NULL;
> bdp = greth->tx_bd_base + curr_tx;
>
> - status = GRETH_TXBD_CSALL | GRETH_BD_EN;
> + status = GRETH_BD_EN;
> + if (skb->ip_summed == CHECKSUM_PARTIAL)
> + status | GRETH_TXBD_CSALL;
typo here ?
> status |= frag->size & GRETH_BD_LEN;
>
> /* Wrap around descriptor ring */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] GRETH: avoid overwrite IP-stack's IP-frags checksum
2011-09-09 13:29 ` Eric Dumazet
@ 2011-09-09 14:41 ` Daniel Hellstrom
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Hellstrom @ 2011-09-09 14:41 UTC (permalink / raw)
To: Eric Dumazet; +Cc: davem, netdev, kristoffer
On 09/09/2011 03:29 PM, Eric Dumazet wrote:
> Le jeudi 08 septembre 2011 à 15:14 +0200, Daniel Hellstrom a écrit :
>> The GRETH GBIT core does not do checksum offloading for IP
>> segmentation. This patch adds a check in the xmit function to
>> determine if the stack has calculated the checksum for us.
>>
>> Signed-off-by: Daniel Hellstrom<daniel@gaisler.com>
>> ---
>> drivers/net/greth.c | 7 +++++--
>> 1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/greth.c b/drivers/net/greth.c
>> index 9d39fb9..27ba855 100644
>> --- a/drivers/net/greth.c
>> +++ b/drivers/net/greth.c
>> @@ -489,7 +489,8 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
>> if (nr_frags != 0)
>> status = GRETH_TXBD_MORE;
>>
>> - status |= GRETH_TXBD_CSALL;
>> + if (skb->ip_summed == CHECKSUM_PARTIAL)
>> + status |= GRETH_TXBD_CSALL;
>> status |= skb_headlen(skb)& GRETH_BD_LEN;
>> if (greth->tx_next == GRETH_TXBD_NUM_MASK)
>> status |= GRETH_BD_WR;
>> @@ -512,7 +513,9 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev)
>> greth->tx_skbuff[curr_tx] = NULL;
>> bdp = greth->tx_bd_base + curr_tx;
>>
>> - status = GRETH_TXBD_CSALL | GRETH_BD_EN;
>> + status = GRETH_BD_EN;
>> + if (skb->ip_summed == CHECKSUM_PARTIAL)
>> + status | GRETH_TXBD_CSALL;
> typo here ?
Hi,
You're right, I had a missed space there so the code-style check failed at that line, then I fixed that by adding a space... but must have screwed it up. Will repost patch.
Thanks,
Daniel
>
>> status |= frag->size& GRETH_BD_LEN;
>>
>> /* Wrap around descriptor ring */
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] GRETH: RX/TX bytes were never increased
2011-09-08 13:14 [PATCH 1/2] GRETH: RX/TX bytes were never increased Daniel Hellstrom
2011-09-08 13:14 ` [PATCH 2/2] GRETH: avoid overwrite IP-stack's IP-frags checksum Daniel Hellstrom
@ 2011-09-20 19:16 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2011-09-20 19:16 UTC (permalink / raw)
To: daniel; +Cc: netdev, kristoffer
From: Daniel Hellstrom <daniel@gaisler.com>
Date: Thu, 8 Sep 2011 15:14:35 +0200
> Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-09-20 19:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-08 13:14 [PATCH 1/2] GRETH: RX/TX bytes were never increased Daniel Hellstrom
2011-09-08 13:14 ` [PATCH 2/2] GRETH: avoid overwrite IP-stack's IP-frags checksum Daniel Hellstrom
2011-09-09 13:29 ` Eric Dumazet
2011-09-09 14:41 ` Daniel Hellstrom
2011-09-20 19:16 ` [PATCH 1/2] GRETH: RX/TX bytes were never increased David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).