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: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Reviewed-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Ursula Braun 2014-02-24 13:12:06 +01:00 коммит произвёл David S. Miller
Родитель 91a48a2e85
Коммит 22ae27906d
3 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -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)
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 @@ retry:
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 @@ retry:
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 @@ out_remove:
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,
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)
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 @@ out_remove:
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,
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)
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)