Commit 22ae2790 authored by Ursula Braun's avatar Ursula Braun Committed by David S. Miller

qeth: postpone freeing of qdio memory

To guarantee that a qdio ccw_device no longer touches the
qdio memory shared with Linux, the qdio ccw_device should
be offline when freeing the qdio memory. Thus this patch
postpones freeing of qdio memory.
Signed-off-by: default avatarUrsula Braun <ursula.braun@de.ibm.com>
Signed-off-by: default avatarFrank Blaschka <frank.blaschka@de.ibm.com>
Reviewed-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 91a48a2e
...@@ -1660,7 +1660,6 @@ int qeth_qdio_clear_card(struct qeth_card *card, int use_halt) ...@@ -1660,7 +1660,6 @@ int qeth_qdio_clear_card(struct qeth_card *card, int use_halt)
QDIO_FLAG_CLEANUP_USING_CLEAR); QDIO_FLAG_CLEANUP_USING_CLEAR);
if (rc) if (rc)
QETH_CARD_TEXT_(card, 3, "1err%d", rc); QETH_CARD_TEXT_(card, 3, "1err%d", rc);
qdio_free(CARD_DDEV(card));
atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED); atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED);
break; break;
case QETH_QDIO_CLEANING: case QETH_QDIO_CLEANING:
...@@ -2605,6 +2604,7 @@ static int qeth_mpc_initialize(struct qeth_card *card) ...@@ -2605,6 +2604,7 @@ static int qeth_mpc_initialize(struct qeth_card *card)
return 0; return 0;
out_qdio: out_qdio:
qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD);
qdio_free(CARD_DDEV(card));
return rc; return rc;
} }
...@@ -4906,9 +4906,11 @@ int qeth_core_hardsetup_card(struct qeth_card *card) ...@@ -4906,9 +4906,11 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
if (retries < 3) if (retries < 3)
QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n", QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n",
dev_name(&card->gdev->dev)); dev_name(&card->gdev->dev));
rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD);
ccw_device_set_offline(CARD_DDEV(card)); ccw_device_set_offline(CARD_DDEV(card));
ccw_device_set_offline(CARD_WDEV(card)); ccw_device_set_offline(CARD_WDEV(card));
ccw_device_set_offline(CARD_RDEV(card)); ccw_device_set_offline(CARD_RDEV(card));
qdio_free(CARD_DDEV(card));
rc = ccw_device_set_online(CARD_RDEV(card)); rc = ccw_device_set_online(CARD_RDEV(card));
if (rc) if (rc)
goto retriable; goto retriable;
...@@ -4918,7 +4920,6 @@ int qeth_core_hardsetup_card(struct qeth_card *card) ...@@ -4918,7 +4920,6 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
rc = ccw_device_set_online(CARD_DDEV(card)); rc = ccw_device_set_online(CARD_DDEV(card));
if (rc) if (rc)
goto retriable; goto retriable;
rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD);
retriable: retriable:
if (rc == -ERESTARTSYS) { if (rc == -ERESTARTSYS) {
QETH_DBF_TEXT(SETUP, 2, "break1"); QETH_DBF_TEXT(SETUP, 2, "break1");
......
...@@ -1091,6 +1091,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -1091,6 +1091,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
ccw_device_set_offline(CARD_DDEV(card)); ccw_device_set_offline(CARD_DDEV(card));
ccw_device_set_offline(CARD_WDEV(card)); ccw_device_set_offline(CARD_WDEV(card));
ccw_device_set_offline(CARD_RDEV(card)); ccw_device_set_offline(CARD_RDEV(card));
qdio_free(CARD_DDEV(card));
if (recover_flag == CARD_STATE_RECOVER) if (recover_flag == CARD_STATE_RECOVER)
card->state = CARD_STATE_RECOVER; card->state = CARD_STATE_RECOVER;
else else
...@@ -1132,6 +1133,7 @@ static int __qeth_l2_set_offline(struct ccwgroup_device *cgdev, ...@@ -1132,6 +1133,7 @@ static int __qeth_l2_set_offline(struct ccwgroup_device *cgdev,
rc = (rc2) ? rc2 : rc3; rc = (rc2) ? rc2 : rc3;
if (rc) if (rc)
QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
qdio_free(CARD_DDEV(card));
if (recover_flag == CARD_STATE_UP) if (recover_flag == CARD_STATE_UP)
card->state = CARD_STATE_RECOVER; card->state = CARD_STATE_RECOVER;
/* let user_space know that device is offline */ /* let user_space know that device is offline */
...@@ -1194,6 +1196,7 @@ static void qeth_l2_shutdown(struct ccwgroup_device *gdev) ...@@ -1194,6 +1196,7 @@ static void qeth_l2_shutdown(struct ccwgroup_device *gdev)
qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM);
qeth_qdio_clear_card(card, 0); qeth_qdio_clear_card(card, 0);
qeth_clear_qdio_buffers(card); qeth_clear_qdio_buffers(card);
qdio_free(CARD_DDEV(card));
} }
static int qeth_l2_pm_suspend(struct ccwgroup_device *gdev) static int qeth_l2_pm_suspend(struct ccwgroup_device *gdev)
......
...@@ -3447,6 +3447,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -3447,6 +3447,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
ccw_device_set_offline(CARD_DDEV(card)); ccw_device_set_offline(CARD_DDEV(card));
ccw_device_set_offline(CARD_WDEV(card)); ccw_device_set_offline(CARD_WDEV(card));
ccw_device_set_offline(CARD_RDEV(card)); ccw_device_set_offline(CARD_RDEV(card));
qdio_free(CARD_DDEV(card));
if (recover_flag == CARD_STATE_RECOVER) if (recover_flag == CARD_STATE_RECOVER)
card->state = CARD_STATE_RECOVER; card->state = CARD_STATE_RECOVER;
else else
...@@ -3493,6 +3494,7 @@ static int __qeth_l3_set_offline(struct ccwgroup_device *cgdev, ...@@ -3493,6 +3494,7 @@ static int __qeth_l3_set_offline(struct ccwgroup_device *cgdev,
rc = (rc2) ? rc2 : rc3; rc = (rc2) ? rc2 : rc3;
if (rc) if (rc)
QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
qdio_free(CARD_DDEV(card));
if (recover_flag == CARD_STATE_UP) if (recover_flag == CARD_STATE_UP)
card->state = CARD_STATE_RECOVER; card->state = CARD_STATE_RECOVER;
/* let user_space know that device is offline */ /* let user_space know that device is offline */
...@@ -3545,6 +3547,7 @@ static void qeth_l3_shutdown(struct ccwgroup_device *gdev) ...@@ -3545,6 +3547,7 @@ static void qeth_l3_shutdown(struct ccwgroup_device *gdev)
qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM);
qeth_qdio_clear_card(card, 0); qeth_qdio_clear_card(card, 0);
qeth_clear_qdio_buffers(card); qeth_clear_qdio_buffers(card);
qdio_free(CARD_DDEV(card));
} }
static int qeth_l3_pm_suspend(struct ccwgroup_device *gdev) static int qeth_l3_pm_suspend(struct ccwgroup_device *gdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment