Commit 5f2f3cad authored by Sowmini Varadhan's avatar Sowmini Varadhan Committed by David S. Miller

sunvnet: Initialize network_header and transport_header in vnet_rx_one()

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: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b4ace4f1
...@@ -389,17 +389,27 @@ static int vnet_rx_one(struct vnet_port *port, struct vio_net_desc *desc) ...@@ -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)) { if (vio_version_after_eq(&port->vio, 1, 8)) {
struct vio_net_dext *dext = vio_net_ext(desc); struct vio_net_dext *dext = vio_net_ext(desc);
skb_reset_network_header(skb);
if (dext->flags & VNET_PKT_HCK_IPV4_HDRCKSUM) { if (dext->flags & VNET_PKT_HCK_IPV4_HDRCKSUM) {
if (skb->protocol == ETH_P_IP) { if (skb->protocol == ETH_P_IP) {
struct iphdr *iph = (struct iphdr *)skb->data; struct iphdr *iph = ip_hdr(skb);
iph->check = 0; iph->check = 0;
ip_send_check(iph); ip_send_check(iph);
} }
} }
if ((dext->flags & VNET_PKT_HCK_FULLCKSUM) && if ((dext->flags & VNET_PKT_HCK_FULLCKSUM) &&
skb->ip_summed == CHECKSUM_NONE) 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); vnet_fullcsum(skb);
}
}
if (dext->flags & VNET_PKT_HCK_IPV4_HDRCKSUM_OK) { if (dext->flags & VNET_PKT_HCK_IPV4_HDRCKSUM_OK) {
skb->ip_summed = CHECKSUM_PARTIAL; skb->ip_summed = CHECKSUM_PARTIAL;
skb->csum_level = 0; skb->csum_level = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment