aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ehea/ehea_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ehea/ehea_main.c')
-rw-r--r--drivers/net/ehea/ehea_main.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 0e4042bc0a48..58364a0ff378 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -391,8 +391,8 @@ static int ehea_poll(struct net_device *dev, int *budget)
391 if (!skb) 391 if (!skb)
392 break; 392 break;
393 } 393 }
394 memcpy(skb->data, ((char*)cqe) + 64, 394 skb_copy_to_linear_data(skb, ((char*)cqe) + 64,
395 cqe->num_bytes_transfered - 4); 395 cqe->num_bytes_transfered - 4);
396 ehea_fill_skb(dev, skb, cqe); 396 ehea_fill_skb(dev, skb, cqe);
397 } else if (rq == 2) { /* RQ2 */ 397 } else if (rq == 2) { /* RQ2 */
398 skb = get_skb_by_index(skb_arr_rq2, 398 skb = get_skb_by_index(skb_arr_rq2,
@@ -1262,8 +1262,8 @@ static int ehea_clean_portres(struct ehea_port *port, struct ehea_port_res *pr)
1262static inline void write_ip_start_end(struct ehea_swqe *swqe, 1262static inline void write_ip_start_end(struct ehea_swqe *swqe,
1263 const struct sk_buff *skb) 1263 const struct sk_buff *skb)
1264{ 1264{
1265 swqe->ip_start = (u8)(((u64)skb->nh.iph) - ((u64)skb->data)); 1265 swqe->ip_start = skb_network_offset(skb);
1266 swqe->ip_end = (u8)(swqe->ip_start + skb->nh.iph->ihl * 4 - 1); 1266 swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1);
1267} 1267}
1268 1268
1269static inline void write_tcp_offset_end(struct ehea_swqe *swqe, 1269static inline void write_tcp_offset_end(struct ehea_swqe *swqe,
@@ -1300,13 +1300,13 @@ static void write_swqe2_TSO(struct sk_buff *skb,
1300 /* copy only eth/ip/tcp headers to immediate data and 1300 /* copy only eth/ip/tcp headers to immediate data and
1301 * the rest of skb->data to sg1entry 1301 * the rest of skb->data to sg1entry
1302 */ 1302 */
1303 headersize = ETH_HLEN + (skb->nh.iph->ihl * 4) + (skb->h.th->doff * 4); 1303 headersize = ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb);
1304 1304
1305 skb_data_size = skb->len - skb->data_len; 1305 skb_data_size = skb->len - skb->data_len;
1306 1306
1307 if (skb_data_size >= headersize) { 1307 if (skb_data_size >= headersize) {
1308 /* copy immediate data */ 1308 /* copy immediate data */
1309 memcpy(imm_data, skb->data, headersize); 1309 skb_copy_from_linear_data(skb, imm_data, headersize);
1310 swqe->immediate_data_length = headersize; 1310 swqe->immediate_data_length = headersize;
1311 1311
1312 if (skb_data_size > headersize) { 1312 if (skb_data_size > headersize) {
@@ -1337,7 +1337,7 @@ static void write_swqe2_nonTSO(struct sk_buff *skb,
1337 */ 1337 */
1338 if (skb_data_size >= SWQE2_MAX_IMM) { 1338 if (skb_data_size >= SWQE2_MAX_IMM) {
1339 /* copy immediate data */ 1339 /* copy immediate data */
1340 memcpy(imm_data, skb->data, SWQE2_MAX_IMM); 1340 skb_copy_from_linear_data(skb, imm_data, SWQE2_MAX_IMM);
1341 1341
1342 swqe->immediate_data_length = SWQE2_MAX_IMM; 1342 swqe->immediate_data_length = SWQE2_MAX_IMM;
1343 1343
@@ -1350,7 +1350,7 @@ static void write_swqe2_nonTSO(struct sk_buff *skb,
1350 swqe->descriptors++; 1350 swqe->descriptors++;
1351 } 1351 }
1352 } else { 1352 } else {
1353 memcpy(imm_data, skb->data, skb_data_size); 1353 skb_copy_from_linear_data(skb, imm_data, skb_data_size);
1354 swqe->immediate_data_length = skb_data_size; 1354 swqe->immediate_data_length = skb_data_size;
1355 } 1355 }
1356} 1356}
@@ -1688,6 +1688,7 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
1688 struct ehea_swqe *swqe, u32 lkey) 1688 struct ehea_swqe *swqe, u32 lkey)
1689{ 1689{
1690 if (skb->protocol == htons(ETH_P_IP)) { 1690 if (skb->protocol == htons(ETH_P_IP)) {
1691 const struct iphdr *iph = ip_hdr(skb);
1691 /* IPv4 */ 1692 /* IPv4 */
1692 swqe->tx_control |= EHEA_SWQE_CRC 1693 swqe->tx_control |= EHEA_SWQE_CRC
1693 | EHEA_SWQE_IP_CHECKSUM 1694 | EHEA_SWQE_IP_CHECKSUM
@@ -1697,15 +1698,15 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
1697 1698
1698 write_ip_start_end(swqe, skb); 1699 write_ip_start_end(swqe, skb);
1699 1700
1700 if (skb->nh.iph->protocol == IPPROTO_UDP) { 1701 if (iph->protocol == IPPROTO_UDP) {
1701 if ((skb->nh.iph->frag_off & IP_MF) || 1702 if ((iph->frag_off & IP_MF) ||
1702 (skb->nh.iph->frag_off & IP_OFFSET)) 1703 (iph->frag_off & IP_OFFSET))
1703 /* IP fragment, so don't change cs */ 1704 /* IP fragment, so don't change cs */
1704 swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM; 1705 swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM;
1705 else 1706 else
1706 write_udp_offset_end(swqe, skb); 1707 write_udp_offset_end(swqe, skb);
1707 1708
1708 } else if (skb->nh.iph->protocol == IPPROTO_TCP) { 1709 } else if (iph->protocol == IPPROTO_TCP) {
1709 write_tcp_offset_end(swqe, skb); 1710 write_tcp_offset_end(swqe, skb);
1710 } 1711 }
1711 1712
@@ -1731,10 +1732,11 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
1731 int i; 1732 int i;
1732 1733
1733 if (skb->protocol == htons(ETH_P_IP)) { 1734 if (skb->protocol == htons(ETH_P_IP)) {
1735 const struct iphdr *iph = ip_hdr(skb);
1734 /* IPv4 */ 1736 /* IPv4 */
1735 write_ip_start_end(swqe, skb); 1737 write_ip_start_end(swqe, skb);
1736 1738
1737 if (skb->nh.iph->protocol == IPPROTO_TCP) { 1739 if (iph->protocol == IPPROTO_TCP) {
1738 swqe->tx_control |= EHEA_SWQE_CRC 1740 swqe->tx_control |= EHEA_SWQE_CRC
1739 | EHEA_SWQE_IP_CHECKSUM 1741 | EHEA_SWQE_IP_CHECKSUM
1740 | EHEA_SWQE_TCP_CHECKSUM 1742 | EHEA_SWQE_TCP_CHECKSUM
@@ -1742,9 +1744,9 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
1742 1744
1743 write_tcp_offset_end(swqe, skb); 1745 write_tcp_offset_end(swqe, skb);
1744 1746
1745 } else if (skb->nh.iph->protocol == IPPROTO_UDP) { 1747 } else if (iph->protocol == IPPROTO_UDP) {
1746 if ((skb->nh.iph->frag_off & IP_MF) || 1748 if ((iph->frag_off & IP_MF) ||
1747 (skb->nh.iph->frag_off & IP_OFFSET)) 1749 (iph->frag_off & IP_OFFSET))
1748 /* IP fragment, so don't change cs */ 1750 /* IP fragment, so don't change cs */
1749 swqe->tx_control |= EHEA_SWQE_CRC 1751 swqe->tx_control |= EHEA_SWQE_CRC
1750 | EHEA_SWQE_IMM_DATA_PRESENT; 1752 | EHEA_SWQE_IMM_DATA_PRESENT;
@@ -1770,10 +1772,11 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
1770 /* copy (immediate) data */ 1772 /* copy (immediate) data */
1771 if (nfrags == 0) { 1773 if (nfrags == 0) {
1772 /* data is in a single piece */ 1774 /* data is in a single piece */
1773 memcpy(imm_data, skb->data, skb->len); 1775 skb_copy_from_linear_data(skb, imm_data, skb->len);
1774 } else { 1776 } else {
1775 /* first copy data from the skb->data buffer ... */ 1777 /* first copy data from the skb->data buffer ... */
1776 memcpy(imm_data, skb->data, skb->len - skb->data_len); 1778 skb_copy_from_linear_data(skb, imm_data,
1779 skb->len - skb->data_len);
1777 imm_data += skb->len - skb->data_len; 1780 imm_data += skb->len - skb->data_len;
1778 1781
1779 /* ... then copy data from the fragments */ 1782 /* ... then copy data from the fragments */