diff options
author | Frank Pavlic <fpavlic@de.ibm.com> | 2005-12-13 02:22:30 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-12-24 10:05:51 -0500 |
commit | 4965e97fd36041d19483843c66286b9800a57c15 (patch) | |
tree | dc9161dea86858ab7a07a7e82bffe5ee4214125c | |
parent | 6c6b3e7c4f93d330b920e6531b579b1f6bae5ac1 (diff) |
[PATCH] s390: minor qeth network driver fixes
[patch 2/3] s390: minor qeth network driver fixes
From: Frank Pavlic <pavlic@de.ibm.com>
- use netif_carrier_on/off calls to tell network stack
link carrier state
- fix possible kfree on NULL
- PDU_LEN2 is at offset 0x29 otherwise OSN chpid won't initialize
Signed-off-by: Frank Pavlic <pavlic@de.ibm.com>
diffstat:
qeth_eddp.c | 3 ++-
qeth_main.c | 17 +++++++----------
qeth_mpc.h | 2 +-
3 files changed, 10 insertions(+), 12 deletions(-)
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r-- | drivers/s390/net/qeth_eddp.c | 3 | ||||
-rw-r--r-- | drivers/s390/net/qeth_main.c | 17 | ||||
-rw-r--r-- | drivers/s390/net/qeth_mpc.h | 2 |
3 files changed, 10 insertions, 12 deletions
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c index 011915d5e243..f94f1f25eec6 100644 --- a/drivers/s390/net/qeth_eddp.c +++ b/drivers/s390/net/qeth_eddp.c | |||
@@ -62,7 +62,8 @@ qeth_eddp_free_context(struct qeth_eddp_context *ctx) | |||
62 | for (i = 0; i < ctx->num_pages; ++i) | 62 | for (i = 0; i < ctx->num_pages; ++i) |
63 | free_page((unsigned long)ctx->pages[i]); | 63 | free_page((unsigned long)ctx->pages[i]); |
64 | kfree(ctx->pages); | 64 | kfree(ctx->pages); |
65 | kfree(ctx->elements); | 65 | if (ctx->elements != NULL) |
66 | kfree(ctx->elements); | ||
66 | kfree(ctx); | 67 | kfree(ctx); |
67 | } | 68 | } |
68 | 69 | ||
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 5d2d548e5421..e693dc4ce860 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -518,7 +518,8 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode) | |||
518 | 518 | ||
519 | QETH_DBF_TEXT(setup, 3, "setoffl"); | 519 | QETH_DBF_TEXT(setup, 3, "setoffl"); |
520 | QETH_DBF_HEX(setup, 3, &card, sizeof(void *)); | 520 | QETH_DBF_HEX(setup, 3, &card, sizeof(void *)); |
521 | 521 | ||
522 | netif_carrier_off(card->dev); | ||
522 | recover_flag = card->state; | 523 | recover_flag = card->state; |
523 | if (qeth_stop_card(card, recovery_mode) == -ERESTARTSYS){ | 524 | if (qeth_stop_card(card, recovery_mode) == -ERESTARTSYS){ |
524 | PRINT_WARN("Stopping card %s interrupted by user!\n", | 525 | PRINT_WARN("Stopping card %s interrupted by user!\n", |
@@ -1020,7 +1021,6 @@ void | |||
1020 | qeth_schedule_recovery(struct qeth_card *card) | 1021 | qeth_schedule_recovery(struct qeth_card *card) |
1021 | { | 1022 | { |
1022 | QETH_DBF_TEXT(trace,2,"startrec"); | 1023 | QETH_DBF_TEXT(trace,2,"startrec"); |
1023 | |||
1024 | if (qeth_set_thread_start_bit(card, QETH_RECOVER_THREAD) == 0) | 1024 | if (qeth_set_thread_start_bit(card, QETH_RECOVER_THREAD) == 0) |
1025 | schedule_work(&card->kernel_thread_starter); | 1025 | schedule_work(&card->kernel_thread_starter); |
1026 | } | 1026 | } |
@@ -1710,7 +1710,6 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) | |||
1710 | "IP address reset.\n", | 1710 | "IP address reset.\n", |
1711 | QETH_CARD_IFNAME(card), | 1711 | QETH_CARD_IFNAME(card), |
1712 | card->info.chpid); | 1712 | card->info.chpid); |
1713 | netif_carrier_on(card->dev); | ||
1714 | qeth_schedule_recovery(card); | 1713 | qeth_schedule_recovery(card); |
1715 | return NULL; | 1714 | return NULL; |
1716 | case IPA_CMD_MODCCID: | 1715 | case IPA_CMD_MODCCID: |
@@ -1959,7 +1958,7 @@ qeth_osn_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | |||
1959 | { | 1958 | { |
1960 | u16 s1, s2; | 1959 | u16 s1, s2; |
1961 | 1960 | ||
1962 | QETH_DBF_TEXT(trace,4,"osndipa"); | 1961 | QETH_DBF_TEXT(trace,4,"osndipa"); |
1963 | 1962 | ||
1964 | qeth_prepare_ipa_cmd(card, iob, QETH_PROT_OSN2); | 1963 | qeth_prepare_ipa_cmd(card, iob, QETH_PROT_OSN2); |
1965 | s1 = (u16)(IPA_PDU_HEADER_SIZE + data_len); | 1964 | s1 = (u16)(IPA_PDU_HEADER_SIZE + data_len); |
@@ -3809,10 +3808,8 @@ qeth_open(struct net_device *dev) | |||
3809 | card->data.state = CH_STATE_UP; | 3808 | card->data.state = CH_STATE_UP; |
3810 | card->state = CARD_STATE_UP; | 3809 | card->state = CARD_STATE_UP; |
3811 | 3810 | ||
3812 | if (!card->lan_online){ | 3811 | if (!card->lan_online && netif_carrier_ok(dev)) |
3813 | if (netif_carrier_ok(dev)) | 3812 | netif_carrier_off(dev); |
3814 | netif_carrier_off(dev); | ||
3815 | } | ||
3816 | return 0; | 3813 | return 0; |
3817 | } | 3814 | } |
3818 | 3815 | ||
@@ -7936,8 +7933,8 @@ __qeth_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
7936 | QETH_DBF_TEXT_(setup, 2, "6err%d", rc); | 7933 | QETH_DBF_TEXT_(setup, 2, "6err%d", rc); |
7937 | goto out_remove; | 7934 | goto out_remove; |
7938 | } | 7935 | } |
7939 | /*maybe it was set offline without ifconfig down | 7936 | netif_carrier_on(card->dev); |
7940 | * we can also use this state for recovery purposes*/ | 7937 | |
7941 | qeth_set_allowed_threads(card, 0xffffffff, 0); | 7938 | qeth_set_allowed_threads(card, 0xffffffff, 0); |
7942 | if (recover_flag == CARD_STATE_RECOVER) | 7939 | if (recover_flag == CARD_STATE_RECOVER) |
7943 | qeth_start_again(card, recovery_mode); | 7940 | qeth_start_again(card, recovery_mode); |
diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h index 5f71486e708c..00c71786e899 100644 --- a/drivers/s390/net/qeth_mpc.h +++ b/drivers/s390/net/qeth_mpc.h | |||
@@ -21,7 +21,7 @@ extern const char *VERSION_QETH_MPC_C; | |||
21 | #define IPA_PDU_HEADER_SIZE 0x40 | 21 | #define IPA_PDU_HEADER_SIZE 0x40 |
22 | #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer+0x0e) | 22 | #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer+0x0e) |
23 | #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer+0x26) | 23 | #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer+0x26) |
24 | #define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer+0x2a) | 24 | #define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer+0x29) |
25 | #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer+0x3a) | 25 | #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer+0x3a) |
26 | 26 | ||
27 | extern unsigned char IPA_PDU_HEADER[]; | 27 | extern unsigned char IPA_PDU_HEADER[]; |