[SK_BUFF]: Introduce ipv6_hdr(), remove skb->nh.ipv6h
[deliverable/linux.git] / drivers / s390 / net / qeth_eddp.c
index 8491598f91495fe30fae194c4ef312540809cdd7..90da58b4e532c78e944eb1116d981e37f0e590c2 100644 (file)
@@ -49,7 +49,7 @@ qeth_eddp_check_buffers_for_context(struct qeth_qdio_out_q *queue,
        return buffers_needed;
 }
 
-static inline void
+static void
 qeth_eddp_free_context(struct qeth_eddp_context *ctx)
 {
        int i;
@@ -91,7 +91,7 @@ qeth_eddp_buf_release_contexts(struct qeth_qdio_out_buffer *buf)
        }
 }
 
-static inline int
+static int
 qeth_eddp_buf_ref_context(struct qeth_qdio_out_buffer *buf,
                          struct qeth_eddp_context *ctx)
 {
@@ -179,9 +179,8 @@ out_check:
                        flush_cnt++;
                }
        } else {
-#ifdef CONFIG_QETH_PERF_STATS
-               queue->card->perf_stats.skbs_sent_pack++;
-#endif
+               if (queue->card->options.performance_stats)
+                       queue->card->perf_stats.skbs_sent_pack++;
                QETH_DBF_TEXT(trace, 6, "fillbfpa");
                if (buf->next_element_to_fill >=
                                QETH_MAX_BUFFER_ELEMENTS(queue->card)) {
@@ -197,7 +196,7 @@ out:
        return flush_cnt;
 }
 
-static inline void
+static void
 qeth_eddp_create_segment_hdrs(struct qeth_eddp_context *ctx,
                              struct qeth_eddp_data *eddp, int data_len)
 {
@@ -257,9 +256,9 @@ qeth_eddp_create_segment_hdrs(struct qeth_eddp_context *ctx,
        ctx->offset += eddp->thl;
 }
 
-static inline void
+static void
 qeth_eddp_copy_data_tcp(char *dst, struct qeth_eddp_data *eddp, int len,
-                       u32 *hcsum)
+                       __wsum *hcsum)
 {
        struct skb_frag_struct *frag;
        int left_in_frag;
@@ -303,10 +302,10 @@ qeth_eddp_copy_data_tcp(char *dst, struct qeth_eddp_data *eddp, int len,
        }
 }
 
-static inline void
+static void
 qeth_eddp_create_segment_data_tcp(struct qeth_eddp_context *ctx,
                                  struct qeth_eddp_data *eddp, int data_len,
-                                 u32 hcsum)
+                                 __wsum hcsum)
 {
        u8 *page;
        int page_remainder;
@@ -350,10 +349,10 @@ qeth_eddp_create_segment_data_tcp(struct qeth_eddp_context *ctx,
        ((struct tcphdr *)eddp->th_in_ctx)->check = csum_fold(hcsum);
 }
 
-static inline u32
+static __wsum
 qeth_eddp_check_tcp4_hdr(struct qeth_eddp_data *eddp, int data_len)
 {
-       u32 phcsum; /* pseudo header checksum */
+       __wsum phcsum; /* pseudo header checksum */
 
        QETH_DBF_TEXT(trace, 5, "eddpckt4");
        eddp->th.tcp.h.check = 0;
@@ -364,11 +363,11 @@ qeth_eddp_check_tcp4_hdr(struct qeth_eddp_data *eddp, int data_len)
        return csum_partial((u8 *)&eddp->th, eddp->thl, phcsum);
 }
 
-static inline u32
+static __wsum
 qeth_eddp_check_tcp6_hdr(struct qeth_eddp_data *eddp, int data_len)
 {
-       u32 proto;
-       u32 phcsum; /* pseudo header checksum */
+       __be32 proto;
+       __wsum phcsum; /* pseudo header checksum */
 
        QETH_DBF_TEXT(trace, 5, "eddpckt6");
        eddp->th.tcp.h.check = 0;
@@ -382,7 +381,7 @@ qeth_eddp_check_tcp6_hdr(struct qeth_eddp_data *eddp, int data_len)
        return phcsum;
 }
 
-static inline struct qeth_eddp_data *
+static struct qeth_eddp_data *
 qeth_eddp_create_eddp_data(struct qeth_hdr *qh, u8 *nh, u8 nhl, u8 *th, u8 thl)
 {
        struct qeth_eddp_data *eddp;
@@ -400,13 +399,13 @@ qeth_eddp_create_eddp_data(struct qeth_hdr *qh, u8 *nh, u8 nhl, u8 *th, u8 thl)
        return eddp;
 }
 
-static inline void
+static void
 __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
                             struct qeth_eddp_data *eddp)
 {
        struct tcphdr *tcph;
        int data_len;
-       u32 hcsum;
+       __wsum hcsum;
 
        QETH_DBF_TEXT(trace, 5, "eddpftcp");
        eddp->skb_offset = sizeof(struct qeth_hdr) + eddp->nhl + eddp->thl;
@@ -434,22 +433,22 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
                        eddp->qh.hdr.l3.length = data_len + eddp->nhl +
                                                 eddp->thl;
                /* prepare ip hdr */
-               if (eddp->skb->protocol == ETH_P_IP){
-                       eddp->nh.ip4.h.tot_len = data_len + eddp->nhl +
-                                                eddp->thl;
+               if (eddp->skb->protocol == htons(ETH_P_IP)){
+                       eddp->nh.ip4.h.tot_len = htons(data_len + eddp->nhl +
+                                                eddp->thl);
                        eddp->nh.ip4.h.check = 0;
                        eddp->nh.ip4.h.check =
                                ip_fast_csum((u8 *)&eddp->nh.ip4.h,
                                                eddp->nh.ip4.h.ihl);
                } else
-                       eddp->nh.ip6.h.payload_len = data_len + eddp->thl;
+                       eddp->nh.ip6.h.payload_len = htons(data_len + eddp->thl);
                /* prepare tcp hdr */
                if (data_len == (eddp->skb->len - eddp->skb_offset)){
                        /* last segment -> set FIN and PSH flags */
                        eddp->th.tcp.h.fin = tcph->fin;
                        eddp->th.tcp.h.psh = tcph->psh;
                }
-               if (eddp->skb->protocol == ETH_P_IP)
+               if (eddp->skb->protocol == htons(ETH_P_IP))
                        hcsum = qeth_eddp_check_tcp4_hdr(eddp, data_len);
                else
                        hcsum = qeth_eddp_check_tcp6_hdr(eddp, data_len);
@@ -459,13 +458,13 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
                if (eddp->skb_offset >= eddp->skb->len)
                        break;
                /* prepare headers for next round */
-               if (eddp->skb->protocol == ETH_P_IP)
-                       eddp->nh.ip4.h.id++;
-               eddp->th.tcp.h.seq += data_len;
+               if (eddp->skb->protocol == htons(ETH_P_IP))
+                       eddp->nh.ip4.h.id = htons(ntohs(eddp->nh.ip4.h.id) + 1);
+               eddp->th.tcp.h.seq = htonl(ntohl(eddp->th.tcp.h.seq) + data_len);
        }
 }
 
-static inline int
+static int
 qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
                           struct sk_buff *skb, struct qeth_hdr *qhdr)
 {
@@ -473,25 +472,29 @@ qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
 
        QETH_DBF_TEXT(trace, 5, "eddpficx");
        /* create our segmentation headers and copy original headers */
-       if (skb->protocol == ETH_P_IP)
-               eddp = qeth_eddp_create_eddp_data(qhdr, (u8 *)skb->nh.iph,
-                               skb->nh.iph->ihl*4,
-                               (u8 *)skb->h.th, skb->h.th->doff*4);
+       if (skb->protocol == htons(ETH_P_IP))
+               eddp = qeth_eddp_create_eddp_data(qhdr,
+                                                 skb_network_header(skb),
+                                                 ip_hdrlen(skb),
+                                                 skb->h.raw,
+                                                 skb->h.th->doff * 4);
        else
-               eddp = qeth_eddp_create_eddp_data(qhdr, (u8 *)skb->nh.ipv6h,
-                               sizeof(struct ipv6hdr),
-                               (u8 *)skb->h.th, skb->h.th->doff*4);
+               eddp = qeth_eddp_create_eddp_data(qhdr,
+                                                 skb_network_header(skb),
+                                                 sizeof(struct ipv6hdr),
+                                                 skb->h.raw,
+                                                 skb->h.th->doff * 4);
 
        if (eddp == NULL) {
                QETH_DBF_TEXT(trace, 2, "eddpfcnm");
                return -ENOMEM;
        }
        if (qhdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2) {
-               skb->mac.raw = (skb->data) + sizeof(struct qeth_hdr);
+               skb_set_mac_header(skb, sizeof(struct qeth_hdr));
                memcpy(&eddp->mac, eth_hdr(skb), ETH_HLEN);
 #ifdef CONFIG_QETH_VLAN
                if (eddp->mac.h_proto == __constant_htons(ETH_P_8021Q)) {
-                       eddp->vlan[0] = __constant_htons(skb->protocol);
+                       eddp->vlan[0] = skb->protocol;
                        eddp->vlan[1] = htons(vlan_tx_tag_get(skb));
                }
 #endif /* CONFIG_QETH_VLAN */
@@ -506,7 +509,7 @@ qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
        return 0;
 }
 
-static inline void
+static void
 qeth_eddp_calc_num_pages(struct qeth_eddp_context *ctx, struct sk_buff *skb,
                         int hdr_len)
 {
@@ -530,7 +533,7 @@ qeth_eddp_calc_num_pages(struct qeth_eddp_context *ctx, struct sk_buff *skb,
                            (skb_shinfo(skb)->gso_segs + 1);
 }
 
-static inline struct qeth_eddp_context *
+static struct qeth_eddp_context *
 qeth_eddp_create_context_generic(struct qeth_card *card, struct sk_buff *skb,
                                 int hdr_len)
 {
@@ -582,18 +585,19 @@ qeth_eddp_create_context_generic(struct qeth_card *card, struct sk_buff *skb,
        return ctx;
 }
 
-static inline struct qeth_eddp_context *
+static struct qeth_eddp_context *
 qeth_eddp_create_context_tcp(struct qeth_card *card, struct sk_buff *skb,
                             struct qeth_hdr *qhdr)
 {
        struct qeth_eddp_context *ctx = NULL;
 
        QETH_DBF_TEXT(trace, 5, "creddpct");
-       if (skb->protocol == ETH_P_IP)
+       if (skb->protocol == htons(ETH_P_IP))
                ctx = qeth_eddp_create_context_generic(card, skb,
-                       sizeof(struct qeth_hdr) + skb->nh.iph->ihl*4 +
-                       skb->h.th->doff*4);
-       else if (skb->protocol == ETH_P_IPV6)
+                                                      (sizeof(struct qeth_hdr) +
+                                                       ip_hdrlen(skb) +
+                                                       skb->h.th->doff * 4));
+       else if (skb->protocol == htons(ETH_P_IPV6))
                ctx = qeth_eddp_create_context_generic(card, skb,
                        sizeof(struct qeth_hdr) + sizeof(struct ipv6hdr) +
                        skb->h.th->doff*4);
@@ -626,5 +630,3 @@ qeth_eddp_create_context(struct qeth_card *card, struct sk_buff *skb,
        }
        return NULL;
 }
-
-
This page took 0.035892 seconds and 5 git commands to generate.