@@ -197,12 +197,13 @@ rmnet_map_ipv4_ul_csum_header(void *iphdr,
struct rmnet_map_ul_csum_header *ul_header,
struct sk_buff *skb)
{
- struct iphdr *ip4h = (struct iphdr *)iphdr;
- __be16 *hdr = (__be16 *)ul_header, offset;
+ __be16 *hdr = (__be16 *)ul_header;
+ struct iphdr *ip4h = iphdr;
+ u16 offset;
+
+ offset = skb_transport_header(skb) - (unsigned char *)iphdr;
+ ul_header->csum_start_offset = htons(offset);
- offset = htons((__force u16)(skb_transport_header(skb) -
- (unsigned char *)iphdr));
- ul_header->csum_start_offset = offset;
ul_header->csum_insert_offset = skb->csum_offset;
ul_header->csum_enabled = 1;
if (ip4h->protocol == IPPROTO_UDP)
@@ -239,12 +240,13 @@ rmnet_map_ipv6_ul_csum_header(void *ip6hdr,
struct rmnet_map_ul_csum_header *ul_header,
struct sk_buff *skb)
{
- struct ipv6hdr *ip6h = (struct ipv6hdr *)ip6hdr;
- __be16 *hdr = (__be16 *)ul_header, offset;
+ __be16 *hdr = (__be16 *)ul_header;
+ struct ipv6hdr *ip6h = ip6hdr;
+ u16 offset;
+
+ offset = skb_transport_header(skb) - (unsigned char *)ip6hdr;
+ ul_header->csum_start_offset = htons(offset);
- offset = htons((__force u16)(skb_transport_header(skb) -
- (unsigned char *)ip6hdr));
- ul_header->csum_start_offset = offset;
ul_header->csum_insert_offset = skb->csum_offset;
ul_header->csum_enabled = 1;