kernel: bump kernel 4.4 to 4.4.129 for 17.01
[openwrt/openwrt.git] / target / linux / ar71xx / patches-4.4 / 910-unaligned_access_hacks.patch
index 82957f23b91f6b377cd64297a42a67ea9207e4cc..374f9be3b4b76984842d3673ea78b70aadc9476a 100644 (file)
@@ -42,7 +42,7 @@
        } while (word != stop);
  
        return csum_fold(csum);
-@@ -212,73 +216,6 @@ static inline __sum16 ip_compute_csum(co
+@@ -214,73 +218,6 @@ static inline __sum16 ip_compute_csum(co
        return csum_fold(csum_partial(buff, len, 0));
  }
  
  #include <linux/uaccess.h>
  #include <linux/ipv6.h>
  #include <linux/icmpv6.h>
-@@ -776,10 +777,10 @@ static void tcp_v6_send_response(const s
+@@ -786,10 +787,10 @@ static void tcp_v6_send_response(const s
        topt = (__be32 *)(t1 + 1);
  
        if (tsecr) {
   */
 --- a/net/ipv6/datagram.c
 +++ b/net/ipv6/datagram.c
-@@ -426,7 +426,7 @@ int ipv6_recv_error(struct sock *sk, str
+@@ -433,7 +433,7 @@ int ipv6_recv_error(struct sock *sk, str
                                ipv6_iface_scope_id(&sin->sin6_addr,
                                                    IP6CB(skb)->iif);
                } else {
                                               &sin->sin6_addr);
                        sin->sin6_scope_id = 0;
                }
-@@ -763,12 +763,12 @@ int ip6_datagram_send_ctl(struct net *ne
+@@ -770,12 +770,12 @@ int ip6_datagram_send_ctl(struct net *ne
                        }
  
                        if (fl6->flowlabel&IPV6_FLOWINFO_MASK) {
                case IPV6_2292HOPOPTS:
 --- a/net/ipv6/ip6_gre.c
 +++ b/net/ipv6/ip6_gre.c
-@@ -394,7 +394,7 @@ static void ip6gre_err(struct sk_buff *s
+@@ -397,7 +397,7 @@ static void ip6gre_err(struct sk_buff *s
+               return;
+       ipv6h = (const struct ipv6hdr *)skb->data;
+       greh = (const struct gre_base_hdr *)(skb->data + offset);
+-      key = key_off ? *(__be32 *)(skb->data + key_off) : 0;
++      key = key_off ? net_hdr_word((__be32 *)(skb->data + key_off)) : 0;
  
        t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr,
-                               flags & GRE_KEY ?
--                              *(((__be32 *)p) + (grehlen / 4) - 1) : 0,
-+                              net_hdr_word(((__be32 *)p) + (grehlen / 4) - 1) : 0,
-                               p[1]);
-       if (!t)
-               return;
-@@ -476,11 +476,11 @@ static int ip6gre_rcv(struct sk_buff *sk
+                                key, greh->protocol);
+@@ -484,11 +484,11 @@ static int ip6gre_rcv(struct sk_buff *sk
                        offset += 4;
                }
                if (flags&GRE_KEY) {
                        offset += 4;
                }
        }
-@@ -742,7 +742,7 @@ static netdev_tx_t ip6gre_xmit2(struct s
+@@ -750,7 +750,7 @@ static netdev_tx_t ip6gre_xmit2(struct s
  
                if (tunnel->parms.o_flags&GRE_SEQ) {
                        ++tunnel->o_seqno;
                        ptr--;
                }
                if (tunnel->parms.o_flags&GRE_KEY) {
-@@ -836,7 +836,7 @@ static inline int ip6gre_xmit_ipv6(struc
+@@ -846,7 +846,7 @@ static inline int ip6gre_xmit_ipv6(struc
  
        dsfield = ipv6_get_dsfield(ipv6h);
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
 --- a/net/ipv6/ip6_tunnel.c
 +++ b/net/ipv6/ip6_tunnel.c
-@@ -1396,7 +1396,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
+@@ -1310,7 +1310,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
  
        dsfield = ipv6_get_dsfield(ipv6h);
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
        for (p = *head; p; p = p->next) {
 --- a/net/ipv4/route.c
 +++ b/net/ipv4/route.c
-@@ -457,7 +457,7 @@ static struct neighbour *ipv4_neigh_look
+@@ -461,7 +461,7 @@ static struct neighbour *ipv4_neigh_look
        else if (skb)
                pkey = &ip_hdr(skb)->daddr;
  
        return neigh_create(&arp_tbl, pkey, dev);
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -450,48 +450,53 @@ static void tcp_options_write(__be32 *pt
+@@ -451,48 +451,53 @@ static void tcp_options_write(__be32 *pt
        u16 options = opts->options;    /* mungable copy */
  
        if (unlikely(OPTION_MD5 & options)) {
        }
  
        if (unlikely(opts->num_sack_blocks)) {
-@@ -499,16 +504,17 @@ static void tcp_options_write(__be32 *pt
+@@ -500,16 +505,17 @@ static void tcp_options_write(__be32 *pt
                        tp->duplicate_sack : tp->selective_acks;
                int this_sack;
  
                }
  
                tp->rx_opt.dsack = 0;
-@@ -521,13 +527,14 @@ static void tcp_options_write(__be32 *pt
+@@ -522,13 +528,14 @@ static void tcp_options_write(__be32 *pt
  
                if (foc->exp) {
                        len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len;
                memcpy(p, foc->val, foc->len);
 --- a/net/ipv4/igmp.c
 +++ b/net/ipv4/igmp.c
-@@ -501,7 +501,7 @@ static struct sk_buff *add_grec(struct s
+@@ -533,7 +533,7 @@ static struct sk_buff *add_grec(struct s
                if (!skb)
                        return NULL;
                psrc = (__be32 *)skb_put(skb, sizeof(__be32));
                        goto next_ht;
 --- a/net/ipv6/ip6_offload.c
 +++ b/net/ipv6/ip6_offload.c
-@@ -221,7 +221,7 @@ static struct sk_buff **ipv6_gro_receive
+@@ -225,7 +225,7 @@ static struct sk_buff **ipv6_gro_receive
                        continue;
  
                iph2 = (struct ipv6hdr *)(p->data + off);
                 * XXX skbs on the gro_list have all been parsed and pulled
 --- a/include/net/addrconf.h
 +++ b/include/net/addrconf.h
-@@ -43,7 +43,7 @@ struct prefix_info {
+@@ -45,7 +45,7 @@ struct prefix_info {
        __be32                  reserved2;
  
        struct in6_addr         prefix;
  #include <linux/netdevice.h>
 --- a/include/net/inet_ecn.h
 +++ b/include/net/inet_ecn.h
-@@ -115,13 +115,13 @@ static inline int IP6_ECN_set_ce(struct
- {
+@@ -124,9 +124,9 @@ static inline int IP6_ECN_set_ce(struct
        if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph)))
                return 0;
--      *(__be32*)iph |= htonl(INET_ECN_CE << 20);
-+      net_hdr_word(iph) |= htonl(INET_ECN_CE << 20);
+-      from = *(__be32 *)iph;
++      from = net_hdr_word(iph);
+       to = from | htonl(INET_ECN_CE << 20);
+-      *(__be32 *)iph = to;
++      net_hdr_word(iph) = to;
+       if (skb->ip_summed == CHECKSUM_COMPLETE)
+               skb->csum = csum_add(csum_sub(skb->csum, from), to);
        return 1;
- }
+@@ -134,7 +134,7 @@ static inline int IP6_ECN_set_ce(struct
  
  static inline void IP6_ECN_clear(struct ipv6hdr *iph)
  {
  
  #define       IP6_MF          0x0001
  #define       IP6_OFFSET      0xFFF8
-@@ -417,8 +417,8 @@ static inline void __ipv6_addr_set_half(
+@@ -418,8 +418,8 @@ static inline void __ipv6_addr_set_half(
        }
  #endif
  #endif
  }
  
  static inline void ipv6_addr_set(struct in6_addr *addr, 
-@@ -477,6 +477,8 @@ static inline bool ipv6_prefix_equal(con
+@@ -478,6 +478,8 @@ static inline bool ipv6_prefix_equal(con
        const __be32 *a1 = addr1->s6_addr32;
        const __be32 *a2 = addr2->s6_addr32;
        unsigned int pdw, pbi;
  
        /* check complete u32 in prefix */
        pdw = prefixlen >> 5;
-@@ -485,7 +487,9 @@ static inline bool ipv6_prefix_equal(con
+@@ -486,7 +488,9 @@ static inline bool ipv6_prefix_equal(con
  
        /* check incomplete u32 in prefix */
        pbi = prefixlen & 0x1f;
                return false;
  
        return true;
-@@ -629,13 +633,13 @@ static inline void ipv6_addr_set_v4mappe
+@@ -630,13 +634,13 @@ static inline void ipv6_addr_set_v4mappe
   */
  static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen)
  {
                if (xb)
                        return i * 32 + 31 - __fls(ntohl(xb));
        }
-@@ -799,17 +803,18 @@ static inline int ip6_default_np_autolab
+@@ -805,17 +809,18 @@ static inline int ip6_default_np_autolab
  static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass,
                                __be32 flowlabel)
  {
  
 --- a/net/ipv4/tcp_input.c
 +++ b/net/ipv4/tcp_input.c
-@@ -3809,14 +3809,16 @@ static bool tcp_parse_aligned_timestamp(
+@@ -3820,14 +3820,16 @@ static bool tcp_parse_aligned_timestamp(
  {
        const __be32 *ptr = (const __be32 *)(th + 1);
  
  
  /* Values for "flag" field in struct arpt_ip (general arp structure).
   * No flags defined yet.
+--- a/net/core/utils.c
++++ b/net/core/utils.c
+@@ -321,8 +321,14 @@ void inet_proto_csum_replace16(__sum16 *
+                              bool pseudohdr)
+ {
+       __be32 diff[] = {
+-              ~from[0], ~from[1], ~from[2], ~from[3],
+-              to[0], to[1], to[2], to[3],
++              ~net_hdr_word(&from[0]),
++              ~net_hdr_word(&from[1]),
++              ~net_hdr_word(&from[2]),
++              ~net_hdr_word(&from[3]),
++              net_hdr_word(&to[0]),
++              net_hdr_word(&to[1]),
++              net_hdr_word(&to[2]),
++              net_hdr_word(&to[3]),
+       };
+       if (skb->ip_summed != CHECKSUM_PARTIAL) {
+               *sum = csum_fold(csum_partial(diff, sizeof(diff),