Commit 4965e97f authored by Frank Pavlic's avatar Frank Pavlic Committed by Jeff Garzik

[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: default avatarFrank 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: default avatarJeff Garzik <jgarzik@pobox.com>
parent 6c6b3e7c
...@@ -62,7 +62,8 @@ qeth_eddp_free_context(struct qeth_eddp_context *ctx) ...@@ -62,7 +62,8 @@ qeth_eddp_free_context(struct qeth_eddp_context *ctx)
for (i = 0; i < ctx->num_pages; ++i) for (i = 0; i < ctx->num_pages; ++i)
free_page((unsigned long)ctx->pages[i]); free_page((unsigned long)ctx->pages[i]);
kfree(ctx->pages); kfree(ctx->pages);
kfree(ctx->elements); if (ctx->elements != NULL)
kfree(ctx->elements);
kfree(ctx); kfree(ctx);
} }
......
...@@ -518,7 +518,8 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode) ...@@ -518,7 +518,8 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode)
QETH_DBF_TEXT(setup, 3, "setoffl"); QETH_DBF_TEXT(setup, 3, "setoffl");
QETH_DBF_HEX(setup, 3, &card, sizeof(void *)); QETH_DBF_HEX(setup, 3, &card, sizeof(void *));
netif_carrier_off(card->dev);
recover_flag = card->state; recover_flag = card->state;
if (qeth_stop_card(card, recovery_mode) == -ERESTARTSYS){ if (qeth_stop_card(card, recovery_mode) == -ERESTARTSYS){
PRINT_WARN("Stopping card %s interrupted by user!\n", PRINT_WARN("Stopping card %s interrupted by user!\n",
...@@ -1020,7 +1021,6 @@ void ...@@ -1020,7 +1021,6 @@ void
qeth_schedule_recovery(struct qeth_card *card) qeth_schedule_recovery(struct qeth_card *card)
{ {
QETH_DBF_TEXT(trace,2,"startrec"); QETH_DBF_TEXT(trace,2,"startrec");
if (qeth_set_thread_start_bit(card, QETH_RECOVER_THREAD) == 0) if (qeth_set_thread_start_bit(card, QETH_RECOVER_THREAD) == 0)
schedule_work(&card->kernel_thread_starter); schedule_work(&card->kernel_thread_starter);
} }
...@@ -1710,7 +1710,6 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) ...@@ -1710,7 +1710,6 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob)
"IP address reset.\n", "IP address reset.\n",
QETH_CARD_IFNAME(card), QETH_CARD_IFNAME(card),
card->info.chpid); card->info.chpid);
netif_carrier_on(card->dev);
qeth_schedule_recovery(card); qeth_schedule_recovery(card);
return NULL; return NULL;
case IPA_CMD_MODCCID: case IPA_CMD_MODCCID:
...@@ -1959,7 +1958,7 @@ qeth_osn_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, ...@@ -1959,7 +1958,7 @@ qeth_osn_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
{ {
u16 s1, s2; u16 s1, s2;
QETH_DBF_TEXT(trace,4,"osndipa"); QETH_DBF_TEXT(trace,4,"osndipa");
qeth_prepare_ipa_cmd(card, iob, QETH_PROT_OSN2); qeth_prepare_ipa_cmd(card, iob, QETH_PROT_OSN2);
s1 = (u16)(IPA_PDU_HEADER_SIZE + data_len); s1 = (u16)(IPA_PDU_HEADER_SIZE + data_len);
...@@ -3809,10 +3808,8 @@ qeth_open(struct net_device *dev) ...@@ -3809,10 +3808,8 @@ qeth_open(struct net_device *dev)
card->data.state = CH_STATE_UP; card->data.state = CH_STATE_UP;
card->state = CARD_STATE_UP; card->state = CARD_STATE_UP;
if (!card->lan_online){ if (!card->lan_online && netif_carrier_ok(dev))
if (netif_carrier_ok(dev)) netif_carrier_off(dev);
netif_carrier_off(dev);
}
return 0; return 0;
} }
...@@ -7936,8 +7933,8 @@ __qeth_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -7936,8 +7933,8 @@ __qeth_set_online(struct ccwgroup_device *gdev, int recovery_mode)
QETH_DBF_TEXT_(setup, 2, "6err%d", rc); QETH_DBF_TEXT_(setup, 2, "6err%d", rc);
goto out_remove; goto out_remove;
} }
/*maybe it was set offline without ifconfig down netif_carrier_on(card->dev);
* we can also use this state for recovery purposes*/
qeth_set_allowed_threads(card, 0xffffffff, 0); qeth_set_allowed_threads(card, 0xffffffff, 0);
if (recover_flag == CARD_STATE_RECOVER) if (recover_flag == CARD_STATE_RECOVER)
qeth_start_again(card, recovery_mode); qeth_start_again(card, recovery_mode);
......
...@@ -21,7 +21,7 @@ extern const char *VERSION_QETH_MPC_C; ...@@ -21,7 +21,7 @@ extern const char *VERSION_QETH_MPC_C;
#define IPA_PDU_HEADER_SIZE 0x40 #define IPA_PDU_HEADER_SIZE 0x40
#define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer+0x0e) #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer+0x0e)
#define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer+0x26) #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer+0x26)
#define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer+0x2a) #define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer+0x29)
#define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer+0x3a) #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer+0x3a)
extern unsigned char IPA_PDU_HEADER[]; extern unsigned char IPA_PDU_HEADER[];
......
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