aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/sge.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cxgb3/sge.c')
-rw-r--r--drivers/net/cxgb3/sge.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 027ab2c3825c..3666586a4831 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -661,7 +661,7 @@ static inline struct sk_buff *get_imm_packet(const struct rsp_desc *resp)
661 661
662 if (skb) { 662 if (skb) {
663 __skb_put(skb, IMMED_PKT_SIZE); 663 __skb_put(skb, IMMED_PKT_SIZE);
664 memcpy(skb->data, resp->imm_data, IMMED_PKT_SIZE); 664 skb_copy_to_linear_data(skb, resp->imm_data, IMMED_PKT_SIZE);
665 } 665 }
666 return skb; 666 return skb;
667} 667}
@@ -897,11 +897,11 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb,
897 d->flit[2] = 0; 897 d->flit[2] = 0;
898 cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT_LSO); 898 cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT_LSO);
899 hdr->cntrl = htonl(cntrl); 899 hdr->cntrl = htonl(cntrl);
900 eth_type = skb->nh.raw - skb->data == ETH_HLEN ? 900 eth_type = skb_network_offset(skb) == ETH_HLEN ?
901 CPL_ETH_II : CPL_ETH_II_VLAN; 901 CPL_ETH_II : CPL_ETH_II_VLAN;
902 tso_info |= V_LSO_ETH_TYPE(eth_type) | 902 tso_info |= V_LSO_ETH_TYPE(eth_type) |
903 V_LSO_IPHDR_WORDS(skb->nh.iph->ihl) | 903 V_LSO_IPHDR_WORDS(ip_hdr(skb)->ihl) |
904 V_LSO_TCPHDR_WORDS(skb->h.th->doff); 904 V_LSO_TCPHDR_WORDS(tcp_hdr(skb)->doff);
905 hdr->lso_info = htonl(tso_info); 905 hdr->lso_info = htonl(tso_info);
906 flits = 3; 906 flits = 3;
907 } else { 907 } else {
@@ -913,7 +913,8 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb,
913 if (skb->len <= WR_LEN - sizeof(*cpl)) { 913 if (skb->len <= WR_LEN - sizeof(*cpl)) {
914 q->sdesc[pidx].skb = NULL; 914 q->sdesc[pidx].skb = NULL;
915 if (!skb->data_len) 915 if (!skb->data_len)
916 memcpy(&d->flit[2], skb->data, skb->len); 916 skb_copy_from_linear_data(skb, &d->flit[2],
917 skb->len);
917 else 918 else
918 skb_copy_bits(skb, 0, &d->flit[2], skb->len); 919 skb_copy_bits(skb, 0, &d->flit[2], skb->len);
919 920
@@ -1319,16 +1320,19 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
1319 /* Only TX_DATA builds SGLs */ 1320 /* Only TX_DATA builds SGLs */
1320 1321
1321 from = (struct work_request_hdr *)skb->data; 1322 from = (struct work_request_hdr *)skb->data;
1322 memcpy(&d->flit[1], &from[1], skb->h.raw - skb->data - sizeof(*from)); 1323 memcpy(&d->flit[1], &from[1],
1324 skb_transport_offset(skb) - sizeof(*from));
1323 1325
1324 flits = (skb->h.raw - skb->data) / 8; 1326 flits = skb_transport_offset(skb) / 8;
1325 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; 1327 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
1326 sgl_flits = make_sgl(skb, sgp, skb->h.raw, skb->tail - skb->h.raw, 1328 sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb),
1329 skb->tail - skb->transport_header,
1327 adap->pdev); 1330 adap->pdev);
1328 if (need_skb_unmap()) { 1331 if (need_skb_unmap()) {
1329 setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); 1332 setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits);
1330 skb->destructor = deferred_unmap_destructor; 1333 skb->destructor = deferred_unmap_destructor;
1331 ((struct unmap_info *)skb->cb)->len = skb->tail - skb->h.raw; 1334 ((struct unmap_info *)skb->cb)->len = (skb->tail -
1335 skb->transport_header);
1332 } 1336 }
1333 1337
1334 write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, 1338 write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits,
@@ -1349,8 +1353,8 @@ static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb)
1349 if (skb->len <= WR_LEN && cnt == 0) 1353 if (skb->len <= WR_LEN && cnt == 0)
1350 return 1; /* packet fits as immediate data */ 1354 return 1; /* packet fits as immediate data */
1351 1355
1352 flits = (skb->h.raw - skb->data) / 8; /* headers */ 1356 flits = skb_transport_offset(skb) / 8; /* headers */
1353 if (skb->tail != skb->h.raw) 1357 if (skb->tail != skb->transport_header)
1354 cnt++; 1358 cnt++;
1355 return flits_to_desc(flits + sgl_len(cnt)); 1359 return flits_to_desc(flits + sgl_len(cnt));
1356} 1360}
@@ -1620,7 +1624,9 @@ static inline int rx_offload(struct t3cdev *tdev, struct sge_rspq *rq,
1620 unsigned int gather_idx) 1624 unsigned int gather_idx)
1621{ 1625{
1622 rq->offload_pkts++; 1626 rq->offload_pkts++;
1623 skb->mac.raw = skb->nh.raw = skb->h.raw = skb->data; 1627 skb_reset_mac_header(skb);
1628 skb_reset_network_header(skb);
1629 skb_reset_transport_header(skb);
1624 1630
1625 if (rq->polling) { 1631 if (rq->polling) {
1626 rx_gather[gather_idx++] = skb; 1632 rx_gather[gather_idx++] = skb;
@@ -1684,9 +1690,8 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
1684 struct port_info *pi; 1690 struct port_info *pi;
1685 1691
1686 skb_pull(skb, sizeof(*p) + pad); 1692 skb_pull(skb, sizeof(*p) + pad);
1687 skb->dev = adap->port[p->iff];
1688 skb->dev->last_rx = jiffies; 1693 skb->dev->last_rx = jiffies;
1689 skb->protocol = eth_type_trans(skb, skb->dev); 1694 skb->protocol = eth_type_trans(skb, adap->port[p->iff]);
1690 pi = netdev_priv(skb->dev); 1695 pi = netdev_priv(skb->dev);
1691 if (pi->rx_csum_offload && p->csum_valid && p->csum == 0xffff && 1696 if (pi->rx_csum_offload && p->csum_valid && p->csum == 0xffff &&
1692 !p->fragment) { 1697 !p->fragment) {
@@ -1717,11 +1722,11 @@ static void skb_data_init(struct sk_buff *skb, struct sge_fl_page *p,
1717{ 1722{
1718 skb->len = len; 1723 skb->len = len;
1719 if (len <= SKB_DATA_SIZE) { 1724 if (len <= SKB_DATA_SIZE) {
1720 memcpy(skb->data, p->va, len); 1725 skb_copy_to_linear_data(skb, p->va, len);
1721 skb->tail += len; 1726 skb->tail += len;
1722 put_page(p->frag.page); 1727 put_page(p->frag.page);
1723 } else { 1728 } else {
1724 memcpy(skb->data, p->va, SKB_DATA_SIZE); 1729 skb_copy_to_linear_data(skb, p->va, SKB_DATA_SIZE);
1725 skb_shinfo(skb)->frags[0].page = p->frag.page; 1730 skb_shinfo(skb)->frags[0].page = p->frag.page;
1726 skb_shinfo(skb)->frags[0].page_offset = 1731 skb_shinfo(skb)->frags[0].page_offset =
1727 p->frag.page_offset + SKB_DATA_SIZE; 1732 p->frag.page_offset + SKB_DATA_SIZE;
@@ -1767,7 +1772,7 @@ static struct sk_buff *get_packet(struct adapter *adap, struct sge_fl *fl,
1767 __skb_put(skb, len); 1772 __skb_put(skb, len);
1768 pci_dma_sync_single_for_cpu(adap->pdev, mapping, len, 1773 pci_dma_sync_single_for_cpu(adap->pdev, mapping, len,
1769 PCI_DMA_FROMDEVICE); 1774 PCI_DMA_FROMDEVICE);
1770 memcpy(skb->data, sd->t.skb->data, len); 1775 skb_copy_from_linear_data(sd->t.skb, skb->data, len);
1771 pci_dma_sync_single_for_device(adap->pdev, mapping, len, 1776 pci_dma_sync_single_for_device(adap->pdev, mapping, len,
1772 PCI_DMA_FROMDEVICE); 1777 PCI_DMA_FROMDEVICE);
1773 } else if (!drop_thres) 1778 } else if (!drop_thres)