[SK_BUFF]: Introduce tcp_hdr(), remove skb->h.th
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / net / cxgb3 / sge.c
index c23783432e51d07180069c9445157b6e566b60b5..a70fe9145a2e471bfc6021e00e6c578d7ef3ed02 100644 (file)
@@ -897,11 +897,11 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb,
                d->flit[2] = 0;
                cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT_LSO);
                hdr->cntrl = htonl(cntrl);
-               eth_type = skb->nh.raw - skb->data == ETH_HLEN ?
+               eth_type = skb_network_offset(skb) == ETH_HLEN ?
                    CPL_ETH_II : CPL_ETH_II_VLAN;
                tso_info |= V_LSO_ETH_TYPE(eth_type) |
-                   V_LSO_IPHDR_WORDS(skb->nh.iph->ihl) |
-                   V_LSO_TCPHDR_WORDS(skb->h.th->doff);
+                   V_LSO_IPHDR_WORDS(ip_hdr(skb)->ihl) |
+                   V_LSO_TCPHDR_WORDS(tcp_hdr(skb)->doff);
                hdr->lso_info = htonl(tso_info);
                flits = 3;
        } else {
@@ -1319,9 +1319,10 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
        /* Only TX_DATA builds SGLs */
 
        from = (struct work_request_hdr *)skb->data;
-       memcpy(&d->flit[1], &from[1], skb->h.raw - skb->data - sizeof(*from));
+       memcpy(&d->flit[1], &from[1],
+              skb_transport_offset(skb) - sizeof(*from));
 
-       flits = (skb->h.raw - skb->data) / 8;
+       flits = skb_transport_offset(skb) / 8;
        sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
        sgl_flits = make_sgl(skb, sgp, skb->h.raw, skb->tail - skb->h.raw,
                             adap->pdev);
@@ -1349,7 +1350,7 @@ static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb)
        if (skb->len <= WR_LEN && cnt == 0)
                return 1;       /* packet fits as immediate data */
 
-       flits = (skb->h.raw - skb->data) / 8;   /* headers */
+       flits = skb_transport_offset(skb) / 8;  /* headers */
        if (skb->tail != skb->h.raw)
                cnt++;
        return flits_to_desc(flits + sgl_len(cnt));
@@ -1620,7 +1621,9 @@ static inline int rx_offload(struct t3cdev *tdev, struct sge_rspq *rq,
                             unsigned int gather_idx)
 {
        rq->offload_pkts++;
-       skb->mac.raw = skb->nh.raw = skb->h.raw = skb->data;
+       skb_reset_mac_header(skb);
+       skb_reset_network_header(skb);
+       skb_reset_transport_header(skb);
 
        if (rq->polling) {
                rx_gather[gather_idx++] = skb;
@@ -1684,9 +1687,8 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
        struct port_info *pi;
 
        skb_pull(skb, sizeof(*p) + pad);
-       skb->dev = adap->port[p->iff];
        skb->dev->last_rx = jiffies;
-       skb->protocol = eth_type_trans(skb, skb->dev);
+       skb->protocol = eth_type_trans(skb, adap->port[p->iff]);
        pi = netdev_priv(skb->dev);
        if (pi->rx_csum_offload && p->csum_valid && p->csum == 0xffff &&
            !p->fragment) {
@@ -2631,7 +2633,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
        q->txq[TXQ_ETH].stop_thres = nports *
            flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3);
 
-       if (ntxq == 1) {
+       if (!is_offload(adapter)) {
 #ifdef USE_RX_PAGE
                q->fl[0].buf_size = RX_PAGE_SIZE;
 #else