aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/ctcmain.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/net/ctcmain.c')
-rw-r--r--drivers/s390/net/ctcmain.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c
index 0d6d5fcc128b..b20fd0681733 100644
--- a/drivers/s390/net/ctcmain.c
+++ b/drivers/s390/net/ctcmain.c
@@ -455,7 +455,7 @@ ctc_unpack_skb(struct channel *ch, struct sk_buff *pskb)
455 return; 455 return;
456 } 456 }
457 skb_put(pskb, header->length); 457 skb_put(pskb, header->length);
458 pskb->mac.raw = pskb->data; 458 skb_reset_mac_header(pskb);
459 len -= header->length; 459 len -= header->length;
460 skb = dev_alloc_skb(pskb->len); 460 skb = dev_alloc_skb(pskb->len);
461 if (!skb) { 461 if (!skb) {
@@ -472,8 +472,9 @@ ctc_unpack_skb(struct channel *ch, struct sk_buff *pskb)
472 privptr->stats.rx_dropped++; 472 privptr->stats.rx_dropped++;
473 return; 473 return;
474 } 474 }
475 memcpy(skb_put(skb, pskb->len), pskb->data, pskb->len); 475 skb_copy_from_linear_data(pskb, skb_put(skb, pskb->len),
476 skb->mac.raw = skb->data; 476 pskb->len);
477 skb_reset_mac_header(skb);
477 skb->dev = pskb->dev; 478 skb->dev = pskb->dev;
478 skb->protocol = pskb->protocol; 479 skb->protocol = pskb->protocol;
479 pskb->ip_summed = CHECKSUM_UNNECESSARY; 480 pskb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -706,7 +707,8 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg)
706 spin_unlock(&ch->collect_lock); 707 spin_unlock(&ch->collect_lock);
707 return; 708 return;
708 } 709 }
709 ch->trans_skb->tail = ch->trans_skb->data = ch->trans_skb_data; 710 ch->trans_skb->data = ch->trans_skb_data;
711 skb_reset_tail_pointer(ch->trans_skb);
710 ch->trans_skb->len = 0; 712 ch->trans_skb->len = 0;
711 if (ch->prof.maxmulti < (ch->collect_len + 2)) 713 if (ch->prof.maxmulti < (ch->collect_len + 2))
712 ch->prof.maxmulti = ch->collect_len + 2; 714 ch->prof.maxmulti = ch->collect_len + 2;
@@ -715,8 +717,9 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg)
715 *((__u16 *) skb_put(ch->trans_skb, 2)) = ch->collect_len + 2; 717 *((__u16 *) skb_put(ch->trans_skb, 2)) = ch->collect_len + 2;
716 i = 0; 718 i = 0;
717 while ((skb = skb_dequeue(&ch->collect_queue))) { 719 while ((skb = skb_dequeue(&ch->collect_queue))) {
718 memcpy(skb_put(ch->trans_skb, skb->len), skb->data, 720 skb_copy_from_linear_data(skb, skb_put(ch->trans_skb,
719 skb->len); 721 skb->len),
722 skb->len);
720 privptr->stats.tx_packets++; 723 privptr->stats.tx_packets++;
721 privptr->stats.tx_bytes += skb->len - LL_HEADER_LENGTH; 724 privptr->stats.tx_bytes += skb->len - LL_HEADER_LENGTH;
722 atomic_dec(&skb->users); 725 atomic_dec(&skb->users);
@@ -831,7 +834,8 @@ ch_action_rx(fsm_instance * fi, int event, void *arg)
831 ctc_unpack_skb(ch, skb); 834 ctc_unpack_skb(ch, skb);
832 } 835 }
833 again: 836 again:
834 skb->data = skb->tail = ch->trans_skb_data; 837 skb->data = ch->trans_skb_data;
838 skb_reset_tail_pointer(skb);
835 skb->len = 0; 839 skb->len = 0;
836 if (ctc_checkalloc_buffer(ch, 1)) 840 if (ctc_checkalloc_buffer(ch, 1))
837 return; 841 return;
@@ -1638,21 +1642,19 @@ add_channel(struct ccw_device *cdev, enum channel_types type)
1638 struct channel *ch; 1642 struct channel *ch;
1639 1643
1640 DBF_TEXT(trace, 2, __FUNCTION__); 1644 DBF_TEXT(trace, 2, __FUNCTION__);
1641 if ((ch = 1645 ch = kzalloc(sizeof(struct channel), GFP_KERNEL);
1642 (struct channel *) kmalloc(sizeof (struct channel), 1646 if (!ch) {
1643 GFP_KERNEL)) == NULL) {
1644 ctc_pr_warn("ctc: Out of memory in add_channel\n"); 1647 ctc_pr_warn("ctc: Out of memory in add_channel\n");
1645 return -1; 1648 return -1;
1646 } 1649 }
1647 memset(ch, 0, sizeof (struct channel)); 1650 /* assure all flags and counters are reset */
1648 if ((ch->ccw = kmalloc(8*sizeof(struct ccw1), 1651 ch->ccw = kzalloc(8 * sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
1649 GFP_KERNEL | GFP_DMA)) == NULL) { 1652 if (!ch->ccw) {
1650 kfree(ch); 1653 kfree(ch);
1651 ctc_pr_warn("ctc: Out of memory in add_channel\n"); 1654 ctc_pr_warn("ctc: Out of memory in add_channel\n");
1652 return -1; 1655 return -1;
1653 } 1656 }
1654 1657
1655 memset(ch->ccw, 0, 8*sizeof(struct ccw1)); // assure all flags and counters are reset
1656 1658
1657 /** 1659 /**
1658 * "static" ccws are used in the following way: 1660 * "static" ccws are used in the following way:
@@ -1692,15 +1694,14 @@ add_channel(struct ccw_device *cdev, enum channel_types type)
1692 return -1; 1694 return -1;
1693 } 1695 }
1694 fsm_newstate(ch->fsm, CH_STATE_IDLE); 1696 fsm_newstate(ch->fsm, CH_STATE_IDLE);
1695 if ((ch->irb = kmalloc(sizeof (struct irb), 1697 ch->irb = kzalloc(sizeof(struct irb), GFP_KERNEL);
1696 GFP_KERNEL)) == NULL) { 1698 if (!ch->irb) {
1697 ctc_pr_warn("ctc: Out of memory in add_channel\n"); 1699 ctc_pr_warn("ctc: Out of memory in add_channel\n");
1698 kfree_fsm(ch->fsm); 1700 kfree_fsm(ch->fsm);
1699 kfree(ch->ccw); 1701 kfree(ch->ccw);
1700 kfree(ch); 1702 kfree(ch);
1701 return -1; 1703 return -1;
1702 } 1704 }
1703 memset(ch->irb, 0, sizeof (struct irb));
1704 while (*c && less_than((*c)->id, ch->id)) 1705 while (*c && less_than((*c)->id, ch->id))
1705 c = &(*c)->next; 1706 c = &(*c)->next;
1706 if (*c && (!strncmp((*c)->id, ch->id, CTC_ID_SIZE))) { 1707 if (*c && (!strncmp((*c)->id, ch->id, CTC_ID_SIZE))) {
@@ -2226,7 +2227,8 @@ transmit_skb(struct channel *ch, struct sk_buff *skb)
2226 * IDAL support in CTC is broken, so we have to 2227 * IDAL support in CTC is broken, so we have to
2227 * care about skb's above 2G ourselves. 2228 * care about skb's above 2G ourselves.
2228 */ 2229 */
2229 hi = ((unsigned long) skb->tail + LL_HEADER_LENGTH) >> 31; 2230 hi = ((unsigned long)skb_tail_pointer(skb) +
2231 LL_HEADER_LENGTH) >> 31;
2230 if (hi) { 2232 if (hi) {
2231 nskb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); 2233 nskb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
2232 if (!nskb) { 2234 if (!nskb) {
@@ -2262,11 +2264,12 @@ transmit_skb(struct channel *ch, struct sk_buff *skb)
2262 return -EBUSY; 2264 return -EBUSY;
2263 } 2265 }
2264 2266
2265 ch->trans_skb->tail = ch->trans_skb->data; 2267 skb_reset_tail_pointer(ch->trans_skb);
2266 ch->trans_skb->len = 0; 2268 ch->trans_skb->len = 0;
2267 ch->ccw[1].count = skb->len; 2269 ch->ccw[1].count = skb->len;
2268 memcpy(skb_put(ch->trans_skb, skb->len), skb->data, 2270 skb_copy_from_linear_data(skb, skb_put(ch->trans_skb,
2269 skb->len); 2271 skb->len),
2272 skb->len);
2270 atomic_dec(&skb->users); 2273 atomic_dec(&skb->users);
2271 dev_kfree_skb_irq(skb); 2274 dev_kfree_skb_irq(skb);
2272 ccw_idx = 0; 2275 ccw_idx = 0;
@@ -2745,14 +2748,13 @@ ctc_probe_device(struct ccwgroup_device *cgdev)
2745 if (!get_device(&cgdev->dev)) 2748 if (!get_device(&cgdev->dev))
2746 return -ENODEV; 2749 return -ENODEV;
2747 2750
2748 priv = kmalloc(sizeof (struct ctc_priv), GFP_KERNEL); 2751 priv = kzalloc(sizeof(struct ctc_priv), GFP_KERNEL);
2749 if (!priv) { 2752 if (!priv) {
2750 ctc_pr_err("%s: Out of memory\n", __func__); 2753 ctc_pr_err("%s: Out of memory\n", __func__);
2751 put_device(&cgdev->dev); 2754 put_device(&cgdev->dev);
2752 return -ENOMEM; 2755 return -ENOMEM;
2753 } 2756 }
2754 2757
2755 memset(priv, 0, sizeof (struct ctc_priv));
2756 rc = ctc_add_files(&cgdev->dev); 2758 rc = ctc_add_files(&cgdev->dev);
2757 if (rc) { 2759 if (rc) {
2758 kfree(priv); 2760 kfree(priv);
@@ -2793,10 +2795,9 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device,
2793 DBF_TEXT(setup, 3, __FUNCTION__); 2795 DBF_TEXT(setup, 3, __FUNCTION__);
2794 2796
2795 if (alloc_device) { 2797 if (alloc_device) {
2796 dev = kmalloc(sizeof (struct net_device), GFP_KERNEL); 2798 dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
2797 if (!dev) 2799 if (!dev)
2798 return NULL; 2800 return NULL;
2799 memset(dev, 0, sizeof (struct net_device));
2800 } 2801 }
2801 2802
2802 dev->priv = privptr; 2803 dev->priv = privptr;