diff options
Diffstat (limited to 'drivers/net/ehea/ehea_main.c')
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index b1c90a4fe31e..0dc701e611e5 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -1262,7 +1262,7 @@ static int ehea_clean_portres(struct ehea_port *port, struct ehea_port_res *pr) | |||
1262 | static inline void write_ip_start_end(struct ehea_swqe *swqe, | 1262 | static inline void write_ip_start_end(struct ehea_swqe *swqe, |
1263 | const struct sk_buff *skb) | 1263 | const struct sk_buff *skb) |
1264 | { | 1264 | { |
1265 | swqe->ip_start = (u8)(((u64)skb->nh.iph) - ((u64)skb->data)); | 1265 | swqe->ip_start = skb_network_offset(skb); |
1266 | swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1); | 1266 | swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1); |
1267 | } | 1267 | } |
1268 | 1268 | ||
@@ -1688,6 +1688,7 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev, | |||
1688 | struct ehea_swqe *swqe, u32 lkey) | 1688 | struct ehea_swqe *swqe, u32 lkey) |
1689 | { | 1689 | { |
1690 | if (skb->protocol == htons(ETH_P_IP)) { | 1690 | if (skb->protocol == htons(ETH_P_IP)) { |
1691 | const struct iphdr *iph = ip_hdr(skb); | ||
1691 | /* IPv4 */ | 1692 | /* IPv4 */ |
1692 | swqe->tx_control |= EHEA_SWQE_CRC | 1693 | swqe->tx_control |= EHEA_SWQE_CRC |
1693 | | EHEA_SWQE_IP_CHECKSUM | 1694 | | EHEA_SWQE_IP_CHECKSUM |
@@ -1697,15 +1698,15 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev, | |||
1697 | 1698 | ||
1698 | write_ip_start_end(swqe, skb); | 1699 | write_ip_start_end(swqe, skb); |
1699 | 1700 | ||
1700 | if (skb->nh.iph->protocol == IPPROTO_UDP) { | 1701 | if (iph->protocol == IPPROTO_UDP) { |
1701 | if ((skb->nh.iph->frag_off & IP_MF) || | 1702 | if ((iph->frag_off & IP_MF) || |
1702 | (skb->nh.iph->frag_off & IP_OFFSET)) | 1703 | (iph->frag_off & IP_OFFSET)) |
1703 | /* IP fragment, so don't change cs */ | 1704 | /* IP fragment, so don't change cs */ |
1704 | swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM; | 1705 | swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM; |
1705 | else | 1706 | else |
1706 | write_udp_offset_end(swqe, skb); | 1707 | write_udp_offset_end(swqe, skb); |
1707 | 1708 | ||
1708 | } else if (skb->nh.iph->protocol == IPPROTO_TCP) { | 1709 | } else if (iph->protocol == IPPROTO_TCP) { |
1709 | write_tcp_offset_end(swqe, skb); | 1710 | write_tcp_offset_end(swqe, skb); |
1710 | } | 1711 | } |
1711 | 1712 | ||
@@ -1731,10 +1732,11 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev, | |||
1731 | int i; | 1732 | int i; |
1732 | 1733 | ||
1733 | if (skb->protocol == htons(ETH_P_IP)) { | 1734 | if (skb->protocol == htons(ETH_P_IP)) { |
1735 | const struct iphdr *iph = ip_hdr(skb); | ||
1734 | /* IPv4 */ | 1736 | /* IPv4 */ |
1735 | write_ip_start_end(swqe, skb); | 1737 | write_ip_start_end(swqe, skb); |
1736 | 1738 | ||
1737 | if (skb->nh.iph->protocol == IPPROTO_TCP) { | 1739 | if (iph->protocol == IPPROTO_TCP) { |
1738 | swqe->tx_control |= EHEA_SWQE_CRC | 1740 | swqe->tx_control |= EHEA_SWQE_CRC |
1739 | | EHEA_SWQE_IP_CHECKSUM | 1741 | | EHEA_SWQE_IP_CHECKSUM |
1740 | | EHEA_SWQE_TCP_CHECKSUM | 1742 | | EHEA_SWQE_TCP_CHECKSUM |
@@ -1742,9 +1744,9 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev, | |||
1742 | 1744 | ||
1743 | write_tcp_offset_end(swqe, skb); | 1745 | write_tcp_offset_end(swqe, skb); |
1744 | 1746 | ||
1745 | } else if (skb->nh.iph->protocol == IPPROTO_UDP) { | 1747 | } else if (iph->protocol == IPPROTO_UDP) { |
1746 | if ((skb->nh.iph->frag_off & IP_MF) || | 1748 | if ((iph->frag_off & IP_MF) || |
1747 | (skb->nh.iph->frag_off & IP_OFFSET)) | 1749 | (iph->frag_off & IP_OFFSET)) |
1748 | /* IP fragment, so don't change cs */ | 1750 | /* IP fragment, so don't change cs */ |
1749 | swqe->tx_control |= EHEA_SWQE_CRC | 1751 | swqe->tx_control |= EHEA_SWQE_CRC |
1750 | | EHEA_SWQE_IMM_DATA_PRESENT; | 1752 | | EHEA_SWQE_IMM_DATA_PRESENT; |