* [PATCH net-next] sunvnet: Initialize network_header and transport_header in vnet_rx_one()
@ 2016-01-18 21:12 Sowmini Varadhan
2016-01-18 22:20 ` David Miller
2016-01-19 19:48 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Sowmini Varadhan @ 2016-01-18 21:12 UTC (permalink / raw)
To: sowmini.varadhan, netdev; +Cc: rashmi.narasimhan, david.stevens, davem
vnet_fullcsum() accesses ip_hdr() and transport header to compute
the checksum for IPv4 packets, so these need to be initialized in
skb created in vnet_rx_one().
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
---
drivers/net/ethernet/sun/sunvnet.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index cc106d8..23fa298 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -389,17 +389,27 @@ static int vnet_rx_one(struct vnet_port *port, struct vio_net_desc *desc)
if (vio_version_after_eq(&port->vio, 1, 8)) {
struct vio_net_dext *dext = vio_net_ext(desc);
+ skb_reset_network_header(skb);
+
if (dext->flags & VNET_PKT_HCK_IPV4_HDRCKSUM) {
if (skb->protocol == ETH_P_IP) {
- struct iphdr *iph = (struct iphdr *)skb->data;
+ struct iphdr *iph = ip_hdr(skb);
iph->check = 0;
ip_send_check(iph);
}
}
if ((dext->flags & VNET_PKT_HCK_FULLCKSUM) &&
- skb->ip_summed == CHECKSUM_NONE)
- vnet_fullcsum(skb);
+ skb->ip_summed == CHECKSUM_NONE) {
+ if (skb->protocol == htons(ETH_P_IP)) {
+ struct iphdr *iph = ip_hdr(skb);
+ int ihl = iph->ihl * 4;
+
+ skb_reset_transport_header(skb);
+ skb_set_transport_header(skb, ihl);
+ vnet_fullcsum(skb);
+ }
+ }
if (dext->flags & VNET_PKT_HCK_IPV4_HDRCKSUM_OK) {
skb->ip_summed = CHECKSUM_PARTIAL;
skb->csum_level = 0;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] sunvnet: Initialize network_header and transport_header in vnet_rx_one()
2016-01-18 21:12 [PATCH net-next] sunvnet: Initialize network_header and transport_header in vnet_rx_one() Sowmini Varadhan
@ 2016-01-18 22:20 ` David Miller
2016-01-18 22:22 ` Sowmini Varadhan
2016-01-19 19:48 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2016-01-18 22:20 UTC (permalink / raw)
To: sowmini.varadhan; +Cc: netdev, rashmi.narasimhan, david.stevens
From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Date: Mon, 18 Jan 2016 16:12:09 -0500
> vnet_fullcsum() accesses ip_hdr() and transport header to compute
> the checksum for IPv4 packets, so these need to be initialized in
> skb created in vnet_rx_one().
>
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
If this is a bug fix, why are you targetting net-next?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] sunvnet: Initialize network_header and transport_header in vnet_rx_one()
2016-01-18 22:20 ` David Miller
@ 2016-01-18 22:22 ` Sowmini Varadhan
0 siblings, 0 replies; 4+ messages in thread
From: Sowmini Varadhan @ 2016-01-18 22:22 UTC (permalink / raw)
To: David Miller; +Cc: netdev, rashmi.narasimhan, david.stevens
On (01/18/16 17:20), David Miller wrote:
> > Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
>
> If this is a bug fix, why are you targetting net-next?
It is a bug fix, but I was not sure if it should go into net or net-next,
so I erred on the side of caution.
--Sowmini
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] sunvnet: Initialize network_header and transport_header in vnet_rx_one()
2016-01-18 21:12 [PATCH net-next] sunvnet: Initialize network_header and transport_header in vnet_rx_one() Sowmini Varadhan
2016-01-18 22:20 ` David Miller
@ 2016-01-19 19:48 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-01-19 19:48 UTC (permalink / raw)
To: sowmini.varadhan; +Cc: netdev, rashmi.narasimhan, david.stevens
From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Date: Mon, 18 Jan 2016 16:12:09 -0500
> vnet_fullcsum() accesses ip_hdr() and transport header to compute
> the checksum for IPv4 packets, so these need to be initialized in
> skb created in vnet_rx_one().
>
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Applied to 'net', thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-20 3:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-18 21:12 [PATCH net-next] sunvnet: Initialize network_header and transport_header in vnet_rx_one() Sowmini Varadhan
2016-01-18 22:20 ` David Miller
2016-01-18 22:22 ` Sowmini Varadhan
2016-01-19 19:48 ` 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).