diff options
Diffstat (limited to 'drivers/s390/net/ctcm_main.c')
-rw-r--r-- | drivers/s390/net/ctcm_main.c | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index 4ecafbf91211..6edf20b62de5 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c | |||
@@ -267,7 +267,7 @@ static struct channel *channel_get(enum ctcm_channel_types type, | |||
267 | else { | 267 | else { |
268 | ch->flags |= CHANNEL_FLAGS_INUSE; | 268 | ch->flags |= CHANNEL_FLAGS_INUSE; |
269 | ch->flags &= ~CHANNEL_FLAGS_RWMASK; | 269 | ch->flags &= ~CHANNEL_FLAGS_RWMASK; |
270 | ch->flags |= (direction == WRITE) | 270 | ch->flags |= (direction == CTCM_WRITE) |
271 | ? CHANNEL_FLAGS_WRITE : CHANNEL_FLAGS_READ; | 271 | ? CHANNEL_FLAGS_WRITE : CHANNEL_FLAGS_READ; |
272 | fsm_newstate(ch->fsm, CTC_STATE_STOPPED); | 272 | fsm_newstate(ch->fsm, CTC_STATE_STOPPED); |
273 | } | 273 | } |
@@ -388,7 +388,8 @@ int ctcm_ch_alloc_buffer(struct channel *ch) | |||
388 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, | 388 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
389 | "%s(%s): %s trans_skb allocation error", | 389 | "%s(%s): %s trans_skb allocation error", |
390 | CTCM_FUNTAIL, ch->id, | 390 | CTCM_FUNTAIL, ch->id, |
391 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | 391 | (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) ? |
392 | "RX" : "TX"); | ||
392 | return -ENOMEM; | 393 | return -ENOMEM; |
393 | } | 394 | } |
394 | 395 | ||
@@ -399,7 +400,8 @@ int ctcm_ch_alloc_buffer(struct channel *ch) | |||
399 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, | 400 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
400 | "%s(%s): %s set norm_cda failed", | 401 | "%s(%s): %s set norm_cda failed", |
401 | CTCM_FUNTAIL, ch->id, | 402 | CTCM_FUNTAIL, ch->id, |
402 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | 403 | (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) ? |
404 | "RX" : "TX"); | ||
403 | return -ENOMEM; | 405 | return -ENOMEM; |
404 | } | 406 | } |
405 | 407 | ||
@@ -603,14 +605,14 @@ static void ctcmpc_send_sweep_req(struct channel *rch) | |||
603 | 605 | ||
604 | priv = dev->ml_priv; | 606 | priv = dev->ml_priv; |
605 | grp = priv->mpcg; | 607 | grp = priv->mpcg; |
606 | ch = priv->channel[WRITE]; | 608 | ch = priv->channel[CTCM_WRITE]; |
607 | 609 | ||
608 | /* sweep processing is not complete until response and request */ | 610 | /* sweep processing is not complete until response and request */ |
609 | /* has completed for all read channels in group */ | 611 | /* has completed for all read channels in group */ |
610 | if (grp->in_sweep == 0) { | 612 | if (grp->in_sweep == 0) { |
611 | grp->in_sweep = 1; | 613 | grp->in_sweep = 1; |
612 | grp->sweep_rsp_pend_num = grp->active_channels[READ]; | 614 | grp->sweep_rsp_pend_num = grp->active_channels[CTCM_READ]; |
613 | grp->sweep_req_pend_num = grp->active_channels[READ]; | 615 | grp->sweep_req_pend_num = grp->active_channels[CTCM_READ]; |
614 | } | 616 | } |
615 | 617 | ||
616 | sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); | 618 | sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); |
@@ -911,7 +913,7 @@ static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) | |||
911 | return NETDEV_TX_BUSY; | 913 | return NETDEV_TX_BUSY; |
912 | 914 | ||
913 | dev->trans_start = jiffies; | 915 | dev->trans_start = jiffies; |
914 | if (ctcm_transmit_skb(priv->channel[WRITE], skb) != 0) | 916 | if (ctcm_transmit_skb(priv->channel[CTCM_WRITE], skb) != 0) |
915 | return NETDEV_TX_BUSY; | 917 | return NETDEV_TX_BUSY; |
916 | return NETDEV_TX_OK; | 918 | return NETDEV_TX_OK; |
917 | } | 919 | } |
@@ -994,7 +996,7 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) | |||
994 | } | 996 | } |
995 | 997 | ||
996 | dev->trans_start = jiffies; | 998 | dev->trans_start = jiffies; |
997 | if (ctcmpc_transmit_skb(priv->channel[WRITE], skb) != 0) { | 999 | if (ctcmpc_transmit_skb(priv->channel[CTCM_WRITE], skb) != 0) { |
998 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | 1000 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
999 | "%s(%s): device error - dropped", | 1001 | "%s(%s): device error - dropped", |
1000 | CTCM_FUNTAIL, dev->name); | 1002 | CTCM_FUNTAIL, dev->name); |
@@ -1035,7 +1037,7 @@ static int ctcm_change_mtu(struct net_device *dev, int new_mtu) | |||
1035 | return -EINVAL; | 1037 | return -EINVAL; |
1036 | 1038 | ||
1037 | priv = dev->ml_priv; | 1039 | priv = dev->ml_priv; |
1038 | max_bufsize = priv->channel[READ]->max_bufsize; | 1040 | max_bufsize = priv->channel[CTCM_READ]->max_bufsize; |
1039 | 1041 | ||
1040 | if (IS_MPC(priv)) { | 1042 | if (IS_MPC(priv)) { |
1041 | if (new_mtu > max_bufsize - TH_HEADER_LENGTH) | 1043 | if (new_mtu > max_bufsize - TH_HEADER_LENGTH) |
@@ -1226,10 +1228,10 @@ static void ctcm_irq_handler(struct ccw_device *cdev, | |||
1226 | priv = dev_get_drvdata(&cgdev->dev); | 1228 | priv = dev_get_drvdata(&cgdev->dev); |
1227 | 1229 | ||
1228 | /* Try to extract channel from driver data. */ | 1230 | /* Try to extract channel from driver data. */ |
1229 | if (priv->channel[READ]->cdev == cdev) | 1231 | if (priv->channel[CTCM_READ]->cdev == cdev) |
1230 | ch = priv->channel[READ]; | 1232 | ch = priv->channel[CTCM_READ]; |
1231 | else if (priv->channel[WRITE]->cdev == cdev) | 1233 | else if (priv->channel[CTCM_WRITE]->cdev == cdev) |
1232 | ch = priv->channel[WRITE]; | 1234 | ch = priv->channel[CTCM_WRITE]; |
1233 | else { | 1235 | else { |
1234 | dev_err(&cdev->dev, | 1236 | dev_err(&cdev->dev, |
1235 | "%s: Internal error: Can't determine channel for " | 1237 | "%s: Internal error: Can't determine channel for " |
@@ -1587,13 +1589,13 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) | |||
1587 | goto out_ccw2; | 1589 | goto out_ccw2; |
1588 | } | 1590 | } |
1589 | 1591 | ||
1590 | for (direction = READ; direction <= WRITE; direction++) { | 1592 | for (direction = CTCM_READ; direction <= CTCM_WRITE; direction++) { |
1591 | priv->channel[direction] = | 1593 | priv->channel[direction] = |
1592 | channel_get(type, direction == READ ? read_id : write_id, | 1594 | channel_get(type, direction == CTCM_READ ? |
1593 | direction); | 1595 | read_id : write_id, direction); |
1594 | if (priv->channel[direction] == NULL) { | 1596 | if (priv->channel[direction] == NULL) { |
1595 | if (direction == WRITE) | 1597 | if (direction == CTCM_WRITE) |
1596 | channel_free(priv->channel[READ]); | 1598 | channel_free(priv->channel[CTCM_READ]); |
1597 | goto out_dev; | 1599 | goto out_dev; |
1598 | } | 1600 | } |
1599 | priv->channel[direction]->netdev = dev; | 1601 | priv->channel[direction]->netdev = dev; |
@@ -1617,13 +1619,13 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) | |||
1617 | 1619 | ||
1618 | dev_info(&dev->dev, | 1620 | dev_info(&dev->dev, |
1619 | "setup OK : r/w = %s/%s, protocol : %d\n", | 1621 | "setup OK : r/w = %s/%s, protocol : %d\n", |
1620 | priv->channel[READ]->id, | 1622 | priv->channel[CTCM_READ]->id, |
1621 | priv->channel[WRITE]->id, priv->protocol); | 1623 | priv->channel[CTCM_WRITE]->id, priv->protocol); |
1622 | 1624 | ||
1623 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, | 1625 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
1624 | "setup(%s) OK : r/w = %s/%s, protocol : %d", dev->name, | 1626 | "setup(%s) OK : r/w = %s/%s, protocol : %d", dev->name, |
1625 | priv->channel[READ]->id, | 1627 | priv->channel[CTCM_READ]->id, |
1626 | priv->channel[WRITE]->id, priv->protocol); | 1628 | priv->channel[CTCM_WRITE]->id, priv->protocol); |
1627 | 1629 | ||
1628 | return 0; | 1630 | return 0; |
1629 | out_unregister: | 1631 | out_unregister: |
@@ -1635,10 +1637,10 @@ out_ccw2: | |||
1635 | out_ccw1: | 1637 | out_ccw1: |
1636 | ccw_device_set_offline(cgdev->cdev[0]); | 1638 | ccw_device_set_offline(cgdev->cdev[0]); |
1637 | out_remove_channel2: | 1639 | out_remove_channel2: |
1638 | readc = channel_get(type, read_id, READ); | 1640 | readc = channel_get(type, read_id, CTCM_READ); |
1639 | channel_remove(readc); | 1641 | channel_remove(readc); |
1640 | out_remove_channel1: | 1642 | out_remove_channel1: |
1641 | writec = channel_get(type, write_id, WRITE); | 1643 | writec = channel_get(type, write_id, CTCM_WRITE); |
1642 | channel_remove(writec); | 1644 | channel_remove(writec); |
1643 | out_err_result: | 1645 | out_err_result: |
1644 | return result; | 1646 | return result; |
@@ -1660,19 +1662,19 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev) | |||
1660 | if (!priv) | 1662 | if (!priv) |
1661 | return -ENODEV; | 1663 | return -ENODEV; |
1662 | 1664 | ||
1663 | if (priv->channel[READ]) { | 1665 | if (priv->channel[CTCM_READ]) { |
1664 | dev = priv->channel[READ]->netdev; | 1666 | dev = priv->channel[CTCM_READ]->netdev; |
1665 | CTCM_DBF_DEV(SETUP, dev, ""); | 1667 | CTCM_DBF_DEV(SETUP, dev, ""); |
1666 | /* Close the device */ | 1668 | /* Close the device */ |
1667 | ctcm_close(dev); | 1669 | ctcm_close(dev); |
1668 | dev->flags &= ~IFF_RUNNING; | 1670 | dev->flags &= ~IFF_RUNNING; |
1669 | ctcm_remove_attributes(&cgdev->dev); | 1671 | ctcm_remove_attributes(&cgdev->dev); |
1670 | channel_free(priv->channel[READ]); | 1672 | channel_free(priv->channel[CTCM_READ]); |
1671 | } else | 1673 | } else |
1672 | dev = NULL; | 1674 | dev = NULL; |
1673 | 1675 | ||
1674 | if (priv->channel[WRITE]) | 1676 | if (priv->channel[CTCM_WRITE]) |
1675 | channel_free(priv->channel[WRITE]); | 1677 | channel_free(priv->channel[CTCM_WRITE]); |
1676 | 1678 | ||
1677 | if (dev) { | 1679 | if (dev) { |
1678 | unregister_netdev(dev); | 1680 | unregister_netdev(dev); |
@@ -1685,11 +1687,11 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev) | |||
1685 | ccw_device_set_offline(cgdev->cdev[1]); | 1687 | ccw_device_set_offline(cgdev->cdev[1]); |
1686 | ccw_device_set_offline(cgdev->cdev[0]); | 1688 | ccw_device_set_offline(cgdev->cdev[0]); |
1687 | 1689 | ||
1688 | if (priv->channel[READ]) | 1690 | if (priv->channel[CTCM_READ]) |
1689 | channel_remove(priv->channel[READ]); | 1691 | channel_remove(priv->channel[CTCM_READ]); |
1690 | if (priv->channel[WRITE]) | 1692 | if (priv->channel[CTCM_WRITE]) |
1691 | channel_remove(priv->channel[WRITE]); | 1693 | channel_remove(priv->channel[CTCM_WRITE]); |
1692 | priv->channel[READ] = priv->channel[WRITE] = NULL; | 1694 | priv->channel[CTCM_READ] = priv->channel[CTCM_WRITE] = NULL; |
1693 | 1695 | ||
1694 | return 0; | 1696 | return 0; |
1695 | 1697 | ||
@@ -1720,11 +1722,11 @@ static int ctcm_pm_suspend(struct ccwgroup_device *gdev) | |||
1720 | 1722 | ||
1721 | if (gdev->state == CCWGROUP_OFFLINE) | 1723 | if (gdev->state == CCWGROUP_OFFLINE) |
1722 | return 0; | 1724 | return 0; |
1723 | netif_device_detach(priv->channel[READ]->netdev); | 1725 | netif_device_detach(priv->channel[CTCM_READ]->netdev); |
1724 | ctcm_close(priv->channel[READ]->netdev); | 1726 | ctcm_close(priv->channel[CTCM_READ]->netdev); |
1725 | if (!wait_event_timeout(priv->fsm->wait_q, | 1727 | if (!wait_event_timeout(priv->fsm->wait_q, |
1726 | fsm_getstate(priv->fsm) == DEV_STATE_STOPPED, CTCM_TIME_5_SEC)) { | 1728 | fsm_getstate(priv->fsm) == DEV_STATE_STOPPED, CTCM_TIME_5_SEC)) { |
1727 | netif_device_attach(priv->channel[READ]->netdev); | 1729 | netif_device_attach(priv->channel[CTCM_READ]->netdev); |
1728 | return -EBUSY; | 1730 | return -EBUSY; |
1729 | } | 1731 | } |
1730 | ccw_device_set_offline(gdev->cdev[1]); | 1732 | ccw_device_set_offline(gdev->cdev[1]); |
@@ -1745,9 +1747,9 @@ static int ctcm_pm_resume(struct ccwgroup_device *gdev) | |||
1745 | rc = ccw_device_set_online(gdev->cdev[0]); | 1747 | rc = ccw_device_set_online(gdev->cdev[0]); |
1746 | if (rc) | 1748 | if (rc) |
1747 | goto err_out; | 1749 | goto err_out; |
1748 | ctcm_open(priv->channel[READ]->netdev); | 1750 | ctcm_open(priv->channel[CTCM_READ]->netdev); |
1749 | err_out: | 1751 | err_out: |
1750 | netif_device_attach(priv->channel[READ]->netdev); | 1752 | netif_device_attach(priv->channel[CTCM_READ]->netdev); |
1751 | return rc; | 1753 | return rc; |
1752 | } | 1754 | } |
1753 | 1755 | ||