diff options
Diffstat (limited to 'drivers/net/skfp/pmf.c')
-rw-r--r-- | drivers/net/skfp/pmf.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/drivers/net/skfp/pmf.c b/drivers/net/skfp/pmf.c index a320fdb3727d..9ac4665d7411 100644 --- a/drivers/net/skfp/pmf.c +++ b/drivers/net/skfp/pmf.c | |||
@@ -328,7 +328,7 @@ static SMbuf *smt_build_pmf_response(struct s_smc *smc, struct smt_header *req, | |||
328 | * build SMT header | 328 | * build SMT header |
329 | */ | 329 | */ |
330 | if (!(mb = smt_get_mbuf(smc))) | 330 | if (!(mb = smt_get_mbuf(smc))) |
331 | return(mb) ; | 331 | return mb; |
332 | 332 | ||
333 | smt = smtod(mb, struct smt_header *) ; | 333 | smt = smtod(mb, struct smt_header *) ; |
334 | smt->smt_dest = req->smt_source ; /* DA == source of request */ | 334 | smt->smt_dest = req->smt_source ; /* DA == source of request */ |
@@ -493,7 +493,7 @@ static SMbuf *smt_build_pmf_response(struct s_smc *smc, struct smt_header *req, | |||
493 | smt_add_para(smc,&set_pcon,(u_short) SMT_P1035,0,0) ; | 493 | smt_add_para(smc,&set_pcon,(u_short) SMT_P1035,0,0) ; |
494 | smt_add_para(smc,&set_pcon,(u_short) SMT_P1036,0,0) ; | 494 | smt_add_para(smc,&set_pcon,(u_short) SMT_P1036,0,0) ; |
495 | } | 495 | } |
496 | return(mb) ; | 496 | return mb; |
497 | } | 497 | } |
498 | 498 | ||
499 | static int smt_authorize(struct s_smc *smc, struct smt_header *sm) | 499 | static int smt_authorize(struct s_smc *smc, struct smt_header *sm) |
@@ -511,7 +511,7 @@ static int smt_authorize(struct s_smc *smc, struct smt_header *sm) | |||
511 | if (i != 8) { | 511 | if (i != 8) { |
512 | if (memcmp((char *) &sm->smt_sid, | 512 | if (memcmp((char *) &sm->smt_sid, |
513 | (char *) &smc->mib.fddiPRPMFStation,8)) | 513 | (char *) &smc->mib.fddiPRPMFStation,8)) |
514 | return(1) ; | 514 | return 1; |
515 | } | 515 | } |
516 | /* | 516 | /* |
517 | * check authoriziation parameter if passwd not zero | 517 | * check authoriziation parameter if passwd not zero |
@@ -522,13 +522,13 @@ static int smt_authorize(struct s_smc *smc, struct smt_header *sm) | |||
522 | if (i != 8) { | 522 | if (i != 8) { |
523 | pa = (struct smt_para *) sm_to_para(smc,sm,SMT_P_AUTHOR) ; | 523 | pa = (struct smt_para *) sm_to_para(smc,sm,SMT_P_AUTHOR) ; |
524 | if (!pa) | 524 | if (!pa) |
525 | return(1) ; | 525 | return 1; |
526 | if (pa->p_len != 8) | 526 | if (pa->p_len != 8) |
527 | return(1) ; | 527 | return 1; |
528 | if (memcmp((char *)(pa+1),(char *)smc->mib.fddiPRPMFPasswd,8)) | 528 | if (memcmp((char *)(pa+1),(char *)smc->mib.fddiPRPMFPasswd,8)) |
529 | return(1) ; | 529 | return 1; |
530 | } | 530 | } |
531 | return(0) ; | 531 | return 0; |
532 | } | 532 | } |
533 | 533 | ||
534 | static int smt_check_set_count(struct s_smc *smc, struct smt_header *sm) | 534 | static int smt_check_set_count(struct s_smc *smc, struct smt_header *sm) |
@@ -542,9 +542,9 @@ static int smt_check_set_count(struct s_smc *smc, struct smt_header *sm) | |||
542 | if ((smc->mib.fddiSMTSetCount.count != sc->count) || | 542 | if ((smc->mib.fddiSMTSetCount.count != sc->count) || |
543 | memcmp((char *) smc->mib.fddiSMTSetCount.timestamp, | 543 | memcmp((char *) smc->mib.fddiSMTSetCount.timestamp, |
544 | (char *)sc->timestamp,8)) | 544 | (char *)sc->timestamp,8)) |
545 | return(1) ; | 545 | return 1; |
546 | } | 546 | } |
547 | return(0) ; | 547 | return 0; |
548 | } | 548 | } |
549 | 549 | ||
550 | void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para, | 550 | void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para, |
@@ -1109,7 +1109,7 @@ static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, | |||
1109 | break ; | 1109 | break ; |
1110 | case 0x2000 : | 1110 | case 0x2000 : |
1111 | if (mac < 0 || mac >= NUMMACS) { | 1111 | if (mac < 0 || mac >= NUMMACS) { |
1112 | return(SMT_RDF_NOPARAM) ; | 1112 | return SMT_RDF_NOPARAM; |
1113 | } | 1113 | } |
1114 | mib_m = &smc->mib.m[mac] ; | 1114 | mib_m = &smc->mib.m[mac] ; |
1115 | mib_addr = (char *) mib_m ; | 1115 | mib_addr = (char *) mib_m ; |
@@ -1118,7 +1118,7 @@ static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, | |||
1118 | break ; | 1118 | break ; |
1119 | case 0x3000 : | 1119 | case 0x3000 : |
1120 | if (path < 0 || path >= NUMPATHS) { | 1120 | if (path < 0 || path >= NUMPATHS) { |
1121 | return(SMT_RDF_NOPARAM) ; | 1121 | return SMT_RDF_NOPARAM; |
1122 | } | 1122 | } |
1123 | mib_a = &smc->mib.a[path] ; | 1123 | mib_a = &smc->mib.a[path] ; |
1124 | mib_addr = (char *) mib_a ; | 1124 | mib_addr = (char *) mib_a ; |
@@ -1127,7 +1127,7 @@ static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, | |||
1127 | break ; | 1127 | break ; |
1128 | case 0x4000 : | 1128 | case 0x4000 : |
1129 | if (port < 0 || port >= smt_mib_phys(smc)) { | 1129 | if (port < 0 || port >= smt_mib_phys(smc)) { |
1130 | return(SMT_RDF_NOPARAM) ; | 1130 | return SMT_RDF_NOPARAM; |
1131 | } | 1131 | } |
1132 | mib_p = &smc->mib.p[port_to_mib(smc,port)] ; | 1132 | mib_p = &smc->mib.p[port_to_mib(smc,port)] ; |
1133 | mib_addr = (char *) mib_p ; | 1133 | mib_addr = (char *) mib_p ; |
@@ -1151,22 +1151,20 @@ static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, | |||
1151 | case SMT_P10F9 : | 1151 | case SMT_P10F9 : |
1152 | #endif | 1152 | #endif |
1153 | case SMT_P20F1 : | 1153 | case SMT_P20F1 : |
1154 | if (!local) { | 1154 | if (!local) |
1155 | return(SMT_RDF_NOPARAM) ; | 1155 | return SMT_RDF_NOPARAM; |
1156 | } | ||
1157 | break ; | 1156 | break ; |
1158 | } | 1157 | } |
1159 | pt = smt_get_ptab(pa->p_type) ; | 1158 | pt = smt_get_ptab(pa->p_type) ; |
1160 | if (!pt) { | 1159 | if (!pt) |
1161 | return( (pa->p_type & 0xff00) ? SMT_RDF_NOPARAM : | 1160 | return (pa->p_type & 0xff00) ? SMT_RDF_NOPARAM : |
1162 | SMT_RDF_ILLEGAL ) ; | 1161 | SMT_RDF_ILLEGAL; |
1163 | } | ||
1164 | switch (pt->p_access) { | 1162 | switch (pt->p_access) { |
1165 | case AC_GR : | 1163 | case AC_GR : |
1166 | case AC_S : | 1164 | case AC_S : |
1167 | break ; | 1165 | break ; |
1168 | default : | 1166 | default : |
1169 | return(SMT_RDF_ILLEGAL) ; | 1167 | return SMT_RDF_ILLEGAL; |
1170 | } | 1168 | } |
1171 | to = mib_addr + pt->p_offset ; | 1169 | to = mib_addr + pt->p_offset ; |
1172 | swap = pt->p_swap ; /* pointer to swap string */ | 1170 | swap = pt->p_swap ; /* pointer to swap string */ |
@@ -1292,7 +1290,7 @@ static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, | |||
1292 | break ; | 1290 | break ; |
1293 | default : | 1291 | default : |
1294 | SMT_PANIC(smc,SMT_E0120, SMT_E0120_MSG) ; | 1292 | SMT_PANIC(smc,SMT_E0120, SMT_E0120_MSG) ; |
1295 | return(SMT_RDF_ILLEGAL) ; | 1293 | return SMT_RDF_ILLEGAL; |
1296 | } | 1294 | } |
1297 | } | 1295 | } |
1298 | /* | 1296 | /* |
@@ -1501,15 +1499,15 @@ change_mac_para: | |||
1501 | default : | 1499 | default : |
1502 | break ; | 1500 | break ; |
1503 | } | 1501 | } |
1504 | return(0) ; | 1502 | return 0; |
1505 | 1503 | ||
1506 | val_error: | 1504 | val_error: |
1507 | /* parameter value in frame is out of range */ | 1505 | /* parameter value in frame is out of range */ |
1508 | return(SMT_RDF_RANGE) ; | 1506 | return SMT_RDF_RANGE; |
1509 | 1507 | ||
1510 | len_error: | 1508 | len_error: |
1511 | /* parameter value in frame is too short */ | 1509 | /* parameter value in frame is too short */ |
1512 | return(SMT_RDF_LENGTH) ; | 1510 | return SMT_RDF_LENGTH; |
1513 | 1511 | ||
1514 | #if 0 | 1512 | #if 0 |
1515 | no_author_error: | 1513 | no_author_error: |
@@ -1518,7 +1516,7 @@ no_author_error: | |||
1518 | * because SBA denied is not a valid return code in the | 1516 | * because SBA denied is not a valid return code in the |
1519 | * PMF protocol. | 1517 | * PMF protocol. |
1520 | */ | 1518 | */ |
1521 | return(SMT_RDF_AUTHOR) ; | 1519 | return SMT_RDF_AUTHOR; |
1522 | #endif | 1520 | #endif |
1523 | } | 1521 | } |
1524 | 1522 | ||
@@ -1527,7 +1525,7 @@ static const struct s_p_tab *smt_get_ptab(u_short para) | |||
1527 | const struct s_p_tab *pt ; | 1525 | const struct s_p_tab *pt ; |
1528 | for (pt = p_tab ; pt->p_num && pt->p_num != para ; pt++) | 1526 | for (pt = p_tab ; pt->p_num && pt->p_num != para ; pt++) |
1529 | ; | 1527 | ; |
1530 | return(pt->p_num ? pt : NULL) ; | 1528 | return pt->p_num ? pt : NULL; |
1531 | } | 1529 | } |
1532 | 1530 | ||
1533 | static int smt_mib_phys(struct s_smc *smc) | 1531 | static int smt_mib_phys(struct s_smc *smc) |
@@ -1535,11 +1533,11 @@ static int smt_mib_phys(struct s_smc *smc) | |||
1535 | #ifdef CONCENTRATOR | 1533 | #ifdef CONCENTRATOR |
1536 | SK_UNUSED(smc) ; | 1534 | SK_UNUSED(smc) ; |
1537 | 1535 | ||
1538 | return(NUMPHYS) ; | 1536 | return NUMPHYS; |
1539 | #else | 1537 | #else |
1540 | if (smc->s.sas == SMT_SAS) | 1538 | if (smc->s.sas == SMT_SAS) |
1541 | return(1) ; | 1539 | return 1; |
1542 | return(NUMPHYS) ; | 1540 | return NUMPHYS; |
1543 | #endif | 1541 | #endif |
1544 | } | 1542 | } |
1545 | 1543 | ||
@@ -1548,11 +1546,11 @@ static int port_to_mib(struct s_smc *smc, int p) | |||
1548 | #ifdef CONCENTRATOR | 1546 | #ifdef CONCENTRATOR |
1549 | SK_UNUSED(smc) ; | 1547 | SK_UNUSED(smc) ; |
1550 | 1548 | ||
1551 | return(p) ; | 1549 | return p; |
1552 | #else | 1550 | #else |
1553 | if (smc->s.sas == SMT_SAS) | 1551 | if (smc->s.sas == SMT_SAS) |
1554 | return(PS) ; | 1552 | return PS; |
1555 | return(p) ; | 1553 | return p; |
1556 | #endif | 1554 | #endif |
1557 | } | 1555 | } |
1558 | 1556 | ||