Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] drivers/net/skfp/: cleanups

This patch contains the following cleanups:
- make needlessly global code static
- remove the completely unused smtparse.c
- remove the following unused global functions:
- drvfbi.c: init_dma
- drvfbi.c: dis_dma
- drvfbi.c: get_rom_byte
- drvfbi.c: mac_drv_vpd_read
- drvfbi.c: mac_drv_pci_fix
- fplustm.c: mac_set_func_addr
- fplustm.c: mac_del_multicast
- hwmtm.c: mac_drv_rx_frag
- pcmplc.c: pcm_set_lct_short
- smt.c: smt_please_reconnect
- smt.c: smt_change_t_neg
- smtdef.c: smt_set_defaults

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>

authored by

Adrian Bunk and committed by
Jeff Garzik
7aa55fce 9b25978e

+20 -883
+2 -2
drivers/net/skfp/Makefile
··· 6 6 7 7 skfp-objs := skfddi.o hwmtm.o fplustm.o smt.o cfm.o \ 8 8 ecm.o pcmplc.o pmf.o queue.o rmt.o \ 9 - smtdef.o smtinit.o smttimer.o srf.o smtparse.o\ 10 - hwt.o drvfbi.o ess.o 9 + smtdef.o smtinit.o smttimer.o srf.o hwt.o \ 10 + drvfbi.o ess.o 11 11 12 12 # NOTE: 13 13 # Compiling this driver produces some warnings (and some more are
+4 -218
drivers/net/skfp/drvfbi.c
··· 105 105 #endif 106 106 107 107 108 - /* Prototypes of local functions. */ 109 - void smt_stop_watchdog(struct s_smc *smc); 108 + /* Prototype of a local function. */ 109 + static void smt_stop_watchdog(struct s_smc *smc); 110 110 111 111 #ifdef MCA 112 112 static int read_card_id() ; ··· 631 631 * LED_Y_OFF just switch yellow LED off 632 632 * LED_Y_ON just switch yello LED on 633 633 */ 634 - void led_indication(struct s_smc *smc, int led_event) 634 + static void led_indication(struct s_smc *smc, int led_event) 635 635 { 636 636 /* use smc->hw.mac_ring_is_up == TRUE 637 637 * as indication for Ring Operational ··· 763 763 SK_UNUSED(smc) ; 764 764 #endif 765 765 } 766 - 767 - /*--------------------------- DMA init ----------------------------*/ 768 - #ifdef ISA 769 - 770 - /* 771 - * init DMA 772 - */ 773 - void init_dma(struct s_smc *smc, int dma) 774 - { 775 - SK_UNUSED(smc) ; 776 - 777 - /* 778 - * set cascade mode, 779 - * clear mask bit (enable DMA cannal) 780 - */ 781 - if (dma > 3) { 782 - outp(0xd6,(dma & 0x03) | 0xc0) ; 783 - outp(0xd4, dma & 0x03) ; 784 - } 785 - else { 786 - outp(0x0b,(dma & 0x03) | 0xc0) ; 787 - outp(0x0a,dma & 0x03) ; 788 - } 789 - } 790 - 791 - /* 792 - * disable DMA 793 - */ 794 - void dis_dma(struct s_smc *smc, int dma) 795 - { 796 - SK_UNUSED(smc) ; 797 - 798 - /* 799 - * set mask bit (disable DMA cannal) 800 - */ 801 - if (dma > 3) { 802 - outp(0xd4,(dma & 0x03) | 0x04) ; 803 - } 804 - else { 805 - outp(0x0a,(dma & 0x03) | 0x04) ; 806 - } 807 - } 808 - 809 - #endif /* ISA */ 810 - 811 - #ifdef EISA 812 - 813 - /*arrays with io addresses of dma controller length and address registers*/ 814 - static const int cntr[8] = { 0x001,0x003,0x005,0x007,0,0x0c6,0x0ca,0x0ce } ; 815 - static const int base[8] = { 0x000,0x002,0x004,0x006,0,0x0c4,0x0c8,0x0cc } ; 816 - static const int page[8] = { 0x087,0x083,0x081,0x082,0,0x08b,0x089,0x08a } ; 817 - 818 - void init_dma(struct s_smc *smc, int dma) 819 - { 820 - /* 821 - * extended mode register 822 - * 32 bit IO 823 - * type c 824 - * TC output 825 - * disable stop 826 - */ 827 - 828 - /* mode read (write) demand */ 829 - smc->hw.dma_rmode = (dma & 3) | 0x08 | 0x0 ; 830 - smc->hw.dma_wmode = (dma & 3) | 0x04 | 0x0 ; 831 - 832 - /* 32 bit IO's, burst DMA mode (type "C") */ 833 - smc->hw.dma_emode = (dma & 3) | 0x08 | 0x30 ; 834 - 835 - outp((dma < 4) ? 0x40b : 0x4d6,smc->hw.dma_emode) ; 836 - 837 - /* disable chaining */ 838 - outp((dma < 4) ? 0x40a : 0x4d4,(dma&3)) ; 839 - 840 - /*load dma controller addresses for fast access during set dma*/ 841 - smc->hw.dma_base_word_count = cntr[smc->hw.dma]; 842 - smc->hw.dma_base_address = base[smc->hw.dma]; 843 - smc->hw.dma_base_address_page = page[smc->hw.dma]; 844 - 845 - } 846 - 847 - void dis_dma(struct s_smc *smc, int dma) 848 - { 849 - SK_UNUSED(smc) ; 850 - 851 - outp((dma < 4) ? 0x0a : 0xd4,(dma&3)|4) ;/* mask bit */ 852 - } 853 - #endif /* EISA */ 854 - 855 - #ifdef MCA 856 - void init_dma(struct s_smc *smc, int dma) 857 - { 858 - SK_UNUSED(smc) ; 859 - SK_UNUSED(dma) ; 860 - } 861 - 862 - void dis_dma(struct s_smc *smc, int dma) 863 - { 864 - SK_UNUSED(smc) ; 865 - SK_UNUSED(dma) ; 866 - } 867 - #endif 868 - 869 - #ifdef PCI 870 - void init_dma(struct s_smc *smc, int dma) 871 - { 872 - SK_UNUSED(smc) ; 873 - SK_UNUSED(dma) ; 874 - } 875 - 876 - void dis_dma(struct s_smc *smc, int dma) 877 - { 878 - SK_UNUSED(smc) ; 879 - SK_UNUSED(dma) ; 880 - } 881 - #endif 882 766 883 767 #ifdef MULT_OEM 884 768 static int is_equal_num(char comp1[], char comp2[], int num) ··· 1291 1407 #endif /* DEBUG */ 1292 1408 } 1293 1409 1294 - void smt_stop_watchdog(struct s_smc *smc) 1410 + static void smt_stop_watchdog(struct s_smc *smc) 1295 1411 { 1296 1412 SK_UNUSED(smc) ; /* Make LINT happy. */ 1297 1413 #ifndef DEBUG ··· 1306 1422 } 1307 1423 1308 1424 #ifdef PCI 1309 - static char get_rom_byte(struct s_smc *smc, u_short addr) 1310 - { 1311 - GET_PAGE(addr) ; 1312 - return (READ_PROM(ADDR(B2_FDP))) ; 1313 - } 1314 - 1315 - /* 1316 - * ROM image defines 1317 - */ 1318 - #define ROM_SIG_1 0 1319 - #define ROM_SIG_2 1 1320 - #define PCI_DATA_1 0x18 1321 - #define PCI_DATA_2 0x19 1322 - 1323 - /* 1324 - * PCI data structure defines 1325 - */ 1326 - #define VPD_DATA_1 0x08 1327 - #define VPD_DATA_2 0x09 1328 - #define IMAGE_LEN_1 0x10 1329 - #define IMAGE_LEN_2 0x11 1330 - #define CODE_TYPE 0x14 1331 - #define INDICATOR 0x15 1332 - 1333 - /* 1334 - * BEGIN_MANUAL_ENTRY(mac_drv_vpd_read) 1335 - * mac_drv_vpd_read(smc,buf,size,image) 1336 - * 1337 - * function DOWNCALL (FDDIWARE) 1338 - * reads the VPD data of the FPROM and writes it into the 1339 - * buffer 1340 - * 1341 - * para buf points to the buffer for the VPD data 1342 - * size size of the VPD data buffer 1343 - * image boot image; code type of the boot image 1344 - * image = 0 Intel x86, PC-AT compatible 1345 - * 1 OPENBOOT standard for PCI 1346 - * 2-FF reserved 1347 - * 1348 - * returns len number of VPD data bytes read form the FPROM 1349 - * <0 number of read bytes 1350 - * >0 error: data invalid 1351 - * 1352 - * END_MANUAL_ENTRY 1353 - */ 1354 - int mac_drv_vpd_read(struct s_smc *smc, char *buf, int size, char image) 1355 - { 1356 - u_short ibase ; 1357 - u_short pci_base ; 1358 - u_short vpd ; 1359 - int len ; 1360 - 1361 - len = 0 ; 1362 - ibase = 0 ; 1363 - /* 1364 - * as long images defined 1365 - */ 1366 - while (get_rom_byte(smc,ibase+ROM_SIG_1) == 0x55 && 1367 - (u_char) get_rom_byte(smc,ibase+ROM_SIG_2) == 0xaa) { 1368 - /* 1369 - * get the pointer to the PCI data structure 1370 - */ 1371 - pci_base = ibase + get_rom_byte(smc,ibase+PCI_DATA_1) + 1372 - (get_rom_byte(smc,ibase+PCI_DATA_2) << 8) ; 1373 - 1374 - if (image == get_rom_byte(smc,pci_base+CODE_TYPE)) { 1375 - /* 1376 - * we have the right image, read the VPD data 1377 - */ 1378 - vpd = ibase + get_rom_byte(smc,pci_base+VPD_DATA_1) + 1379 - (get_rom_byte(smc,pci_base+VPD_DATA_2) << 8) ; 1380 - if (vpd == ibase) { 1381 - break ; /* no VPD data */ 1382 - } 1383 - for (len = 0; len < size; len++,buf++,vpd++) { 1384 - *buf = get_rom_byte(smc,vpd) ; 1385 - } 1386 - break ; 1387 - } 1388 - else { 1389 - /* 1390 - * try the next image 1391 - */ 1392 - if (get_rom_byte(smc,pci_base+INDICATOR) & 0x80) { 1393 - break ; /* this was the last image */ 1394 - } 1395 - ibase = ibase + get_rom_byte(smc,ibase+IMAGE_LEN_1) + 1396 - (get_rom_byte(smc,ibase+IMAGE_LEN_2) << 8) ; 1397 - } 1398 - } 1399 - 1400 - return(len) ; 1401 - } 1402 - 1403 - void mac_drv_pci_fix(struct s_smc *smc, u_long fix_value) 1404 - { 1405 - smc->hw.pci_fix_value = fix_value ; 1406 - } 1407 1425 1408 1426 void mac_do_pci_fix(struct s_smc *smc) 1409 1427 {
+2 -2
drivers/net/skfp/ess.c
··· 102 102 void ess_para_change(struct s_smc *smc); 103 103 int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm, 104 104 int fs); 105 - int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead); 105 + static int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead); 106 106 107 107 108 108 /* ··· 375 375 * determines the synchronous bandwidth, set the TSYNC register and the 376 376 * mib variables SBAPayload, SBAOverhead and fddiMACT-NEG. 377 377 */ 378 - int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead) 378 + static int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead) 379 379 { 380 380 /* 381 381 * determine the synchronous bandwidth (sync_bw) in bytes per T-NEG,
-70
drivers/net/skfp/fplustm.c
··· 1117 1117 /* 1118 1118 BEGIN_MANUAL_ENTRY(if,func;others;2) 1119 1119 1120 - int mac_set_func_addr(smc,f_addr) 1121 - struct s_smc *smc ; 1122 - u_long f_addr ; 1123 - 1124 - Function DOWNCALL (SMT, fplustm.c) 1125 - Set a Token-Ring functional address, the address will 1126 - be activated after calling mac_update_multicast() 1127 - 1128 - Para f_addr functional bits in non-canonical format 1129 - 1130 - Returns 0: always success 1131 - 1132 - END_MANUAL_ENTRY() 1133 - */ 1134 - int mac_set_func_addr(struct s_smc *smc, u_long f_addr) 1135 - { 1136 - smc->hw.fp.func_addr = f_addr ; 1137 - return(0) ; 1138 - } 1139 - 1140 - 1141 - /* 1142 - BEGIN_MANUAL_ENTRY(if,func;others;2) 1143 - 1144 1120 int mac_add_multicast(smc,addr,can) 1145 1121 struct s_smc *smc ; 1146 1122 struct fddi_addr *addr ; ··· 1176 1200 smc->hw.fp.os_slots_used++ ; 1177 1201 1178 1202 return(0) ; 1179 - } 1180 - 1181 - /* 1182 - BEGIN_MANUAL_ENTRY(if,func;others;2) 1183 - 1184 - void mac_del_multicast(smc,addr,can) 1185 - struct s_smc *smc ; 1186 - struct fddi_addr *addr ; 1187 - int can ; 1188 - 1189 - Function DOWNCALL (SMT, fplustm.c) 1190 - Delete an entry from the multicast table 1191 - 1192 - Para addr pointer to a multicast address 1193 - can = 0: the multicast address has the physical format 1194 - = 1: the multicast address has the canonical format 1195 - | 0x80 permanent 1196 - 1197 - END_MANUAL_ENTRY() 1198 - */ 1199 - void mac_del_multicast(struct s_smc *smc, struct fddi_addr *addr, int can) 1200 - { 1201 - SK_LOC_DECL(struct fddi_addr,own) ; 1202 - struct s_fpmc *tb ; 1203 - 1204 - if (!(tb = mac_get_mc_table(smc,addr,&own,1,can & ~0x80))) 1205 - return ; 1206 - /* 1207 - * permanent addresses must be deleted with perm bit 1208 - * and vice versa 1209 - */ 1210 - if (( tb->perm && (can & 0x80)) || 1211 - (!tb->perm && !(can & 0x80))) { 1212 - /* 1213 - * delete it 1214 - */ 1215 - if (tb->n) { 1216 - tb->n-- ; 1217 - if (tb->perm) { 1218 - smc->hw.fp.smt_slots_used-- ; 1219 - } 1220 - else { 1221 - smc->hw.fp.os_slots_used-- ; 1222 - } 1223 - } 1224 - } 1225 1203 } 1226 1204 1227 1205 /*
-7
drivers/net/skfp/h/cmtdef.h
··· 507 507 int *remote, int *mac); 508 508 void plc_config_mux(struct s_smc *smc, int mux); 509 509 void sm_lem_evaluate(struct s_smc *smc); 510 - void smt_clear_una_dna(struct s_smc *smc); 511 510 void mac_update_counter(struct s_smc *smc); 512 511 void sm_pm_ls_latch(struct s_smc *smc, int phy, int on_off); 513 512 void sm_ma_control(struct s_smc *smc, int mode); ··· 540 541 u_long smt_get_time(void); 541 542 u_long smt_get_tid(struct s_smc *smc); 542 543 void smt_timer_done(struct s_smc *smc); 543 - void smt_set_defaults(struct s_smc *smc); 544 544 void smt_fixup_mib(struct s_smc *smc); 545 545 void smt_reset_defaults(struct s_smc *smc, int level); 546 546 void smt_agent_task(struct s_smc *smc); 547 - void smt_please_reconnect(struct s_smc *smc, int reconn_time); 548 547 int smt_check_para(struct s_smc *smc, struct smt_header *sm, 549 548 const u_short list[]); 550 549 void driver_get_bia(struct s_smc *smc, struct fddi_addr *bia_addr); ··· 565 568 int pcm_rooted_station(struct s_smc *smc); 566 569 int cfm_get_mac_input(struct s_smc *smc); 567 570 int cfm_get_mac_output(struct s_smc *smc); 568 - int port_to_mib(struct s_smc *smc, int p); 569 571 int cem_build_path(struct s_smc *smc, char *to, int path_index); 570 572 int sm_mac_get_tx_state(struct s_smc *smc); 571 573 char *get_pcmstate(struct s_smc *smc, int np); ··· 576 580 void smt_set_timestamp(struct s_smc *smc, u_char *p); 577 581 void mac_set_rx_mode(struct s_smc *smc, int mode); 578 582 int mac_add_multicast(struct s_smc *smc, struct fddi_addr *addr, int can); 579 - int mac_set_func_addr(struct s_smc *smc, u_long f_addr); 580 - void mac_del_multicast(struct s_smc *smc, struct fddi_addr *addr, int can); 581 583 void mac_update_multicast(struct s_smc *smc); 582 584 void mac_clear_multicast(struct s_smc *smc); 583 585 void set_formac_tsync(struct s_smc *smc, long sync_bw); ··· 593 599 int smt_set_mac_opvalues(struct s_smc *smc); 594 600 595 601 #ifdef TAG_MODE 596 - void mac_drv_pci_fix(struct s_smc *smc, u_long fix_value); 597 602 void mac_do_pci_fix(struct s_smc *smc); 598 603 void mac_drv_clear_tx_queue(struct s_smc *smc); 599 604 void mac_drv_repair_descr(struct s_smc *smc);
-25
drivers/net/skfp/h/hwmtm.h
··· 262 262 (smc)->hw.fp.tx_q[queue].tx_curr_put 263 263 264 264 /* 265 - * BEGIN_MANUAL_ENTRY(HWM_TX_CHECK) 266 - * void HWM_TX_CHECK(smc,frame_status,low_water) 267 - * 268 - * function MACRO (hardware module, hwmtm.h) 269 - * This macro is invoked by the OS-specific before it left it's 270 - * driver_send function. This macro calls mac_drv_clear_txd 271 - * if the free TxDs of the current transmit queue is equal or 272 - * lower than the given low water mark. 273 - * 274 - * para frame_status status of the frame, see design description 275 - * low_water low water mark of free TxD's 276 - * 277 - * END_MANUAL_ENTRY 278 - */ 279 - #ifndef HWM_NO_FLOW_CTL 280 - #define HWM_TX_CHECK(smc,frame_status,low_water) {\ 281 - if ((low_water)>=(smc)->hw.fp.tx_q[(frame_status)&QUEUE_A0].tx_free) {\ 282 - mac_drv_clear_txd(smc) ;\ 283 - }\ 284 - } 285 - #else 286 - #define HWM_TX_CHECK(smc,frame_status,low_water) mac_drv_clear_txd(smc) 287 - #endif 288 - 289 - /* 290 265 * BEGIN_MANUAL_ENTRY(HWM_GET_RX_FRAG_LEN) 291 266 * int HWM_GET_RX_FRAG_LEN(rxd) 292 267 *
+2 -32
drivers/net/skfp/hwmtm.c
··· 86 86 static u_long repair_rxd_ring(struct s_smc *smc, struct s_smt_rx_queue *queue); 87 87 static SMbuf* get_llc_rx(struct s_smc *smc); 88 88 static SMbuf* get_txd_mb(struct s_smc *smc); 89 + static void mac_drv_clear_txd(struct s_smc *smc); 89 90 90 91 /* 91 92 ------------------------------------------------------------- ··· 147 146 */ 148 147 void process_receive(struct s_smc *smc); 149 148 void fddi_isr(struct s_smc *smc); 150 - void mac_drv_clear_txd(struct s_smc *smc); 151 149 void smt_free_mbuf(struct s_smc *smc, SMbuf *mb); 152 150 void init_driver_fplus(struct s_smc *smc); 153 151 void mac_drv_rx_mode(struct s_smc *smc, int mode); ··· 158 158 void hwm_rx_frag(struct s_smc *smc, char far *virt, u_long phys, int len, 159 159 int frame_status); 160 160 161 - int mac_drv_rx_frag(struct s_smc *smc, void far *virt, int len); 162 161 int mac_drv_init(struct s_smc *smc); 163 162 int hwm_tx_init(struct s_smc *smc, u_char fc, int frag_count, int frame_len, 164 163 int frame_status); ··· 1447 1448 NDD_TRACE("RHfE",r,AIX_REVERSE(r->rxd_rbadr),0) ; 1448 1449 } 1449 1450 1450 - #ifndef NDIS_OS2 1451 - /* 1452 - * BEGIN_MANUAL_ENTRY(mac_drv_rx_frag) 1453 - * int mac_drv_rx_frag(smc,virt,len) 1454 - * 1455 - * function DOWNCALL (hwmtm.c) 1456 - * mac_drv_rx_frag fills the fragment with a part of the frame. 1457 - * 1458 - * para virt the virtual address of the fragment 1459 - * len the length in bytes of the fragment 1460 - * 1461 - * return 0: success code, no errors possible 1462 - * 1463 - * END_MANUAL_ENTRY 1464 - */ 1465 - int mac_drv_rx_frag(struct s_smc *smc, void far *virt, int len) 1466 - { 1467 - NDD_TRACE("RHSB",virt,len,smc->os.hwm.r.mb_pos) ; 1468 - 1469 - DB_RX("receive from queue: len/virt: = %d/%x",len,virt,4) ; 1470 - memcpy((char far *)virt,smc->os.hwm.r.mb_pos,len) ; 1471 - smc->os.hwm.r.mb_pos += len ; 1472 - 1473 - NDD_TRACE("RHSE",smc->os.hwm.r.mb_pos,0,0) ; 1474 - return(0) ; 1475 - } 1476 - #endif 1477 - 1478 - 1479 1451 /* 1480 1452 * BEGINN_MANUAL_ENTRY(mac_drv_clear_rx_queue) 1481 1453 * ··· 1948 1978 * 1949 1979 * END_MANUAL_ENTRY 1950 1980 */ 1951 - void mac_drv_clear_txd(struct s_smc *smc) 1981 + static void mac_drv_clear_txd(struct s_smc *smc) 1952 1982 { 1953 1983 struct s_smt_tx_queue *queue ; 1954 1984 struct s_smt_fp_txd volatile *t1 ;
-7
drivers/net/skfp/pcmplc.c
··· 1861 1861 #endif 1862 1862 } 1863 1863 1864 - void pcm_set_lct_short(struct s_smc *smc, int n) 1865 - { 1866 - if (n <= 0 || n > 1000) 1867 - return ; 1868 - smc->s.lct_short = n ; 1869 - } 1870 - 1871 1864 #ifdef DEBUG 1872 1865 /* 1873 1866 * fill state struct
+6 -5
drivers/net/skfp/pmf.c
··· 36 36 static int smt_check_set_count(struct s_smc *smc, struct smt_header *sm); 37 37 static const struct s_p_tab* smt_get_ptab(u_short para); 38 38 static int smt_mib_phys(struct s_smc *smc); 39 - int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, int local, 40 - int set); 39 + static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, 40 + int local, int set); 41 41 void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para, 42 42 int index, int local); 43 43 static SMbuf *smt_build_pmf_response(struct s_smc *smc, struct smt_header *req, 44 44 int set, int local); 45 + static int port_to_mib(struct s_smc *smc, int p); 45 46 46 47 #define MOFFSS(e) ((int)&(((struct fddi_mib *)0)->e)) 47 48 #define MOFFSA(e) ((int) (((struct fddi_mib *)0)->e)) ··· 1079 1078 /* 1080 1079 * set parameter 1081 1080 */ 1082 - int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, int local, 1083 - int set) 1081 + static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, 1082 + int local, int set) 1084 1083 { 1085 1084 #define IFSET(x) if (set) (x) 1086 1085 ··· 1550 1549 #endif 1551 1550 } 1552 1551 1553 - int port_to_mib(struct s_smc *smc, int p) 1552 + static int port_to_mib(struct s_smc *smc, int p) 1554 1553 { 1555 1554 #ifdef CONCENTRATOR 1556 1555 SK_UNUSED(smc) ;
-1
drivers/net/skfp/skfddi.c
··· 149 149 extern void mac_drv_rx_mode(struct s_smc *smc, int mode); 150 150 extern void mac_drv_clear_rx_queue(struct s_smc *smc); 151 151 extern void enable_tx_irq(struct s_smc *smc, u_short queue); 152 - extern void mac_drv_clear_txd(struct s_smc *smc); 153 152 154 153 static struct pci_device_id skfddi_pci_tbl[] = { 155 154 { PCI_VENDOR_ID_SK, PCI_DEVICE_ID_SK_FP, PCI_ANY_ID, PCI_ANY_ID, },
+4 -42
drivers/net/skfp/smt.c
··· 110 110 static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long seed, 111 111 int len); 112 112 113 - void smt_clear_una_dna(struct s_smc *smc); 113 + static void smt_clear_una_dna(struct s_smc *smc); 114 114 static void smt_clear_old_una_dna(struct s_smc *smc); 115 115 #ifdef CONCENTRATOR 116 116 static int entity_to_index(void); ··· 118 118 static void update_dac(struct s_smc *smc, int report); 119 119 static int div_ratio(u_long upper, u_long lower); 120 120 #ifdef USE_CAN_ADDR 121 - void hwm_conv_can(struct s_smc *smc, char *data, int len); 121 + static void hwm_conv_can(struct s_smc *smc, char *data, int len); 122 122 #else 123 123 #define hwm_conv_can(smc,data,len) 124 124 #endif ··· 214 214 smt_timer_start(smc,&smc->sm.smt_timer, (u_long)1000000L, 215 215 EV_TOKEN(EVENT_SMT,SM_TIMER)) ; 216 216 DB_SMT("SMT agent task\n",0,0) ; 217 - } 218 - 219 - void smt_please_reconnect(struct s_smc *smc, int reconn_time) 220 - /* struct s_smc *smc; Pointer to SMT context */ 221 - /* int reconn_time; Wait for reconnect time in seconds */ 222 - { 223 - /* 224 - * The please reconnect variable is used as a timer. 225 - * It is decremented each time smt_event is called. 226 - * This happens every second or when smt_force_irq is called. 227 - * Note: smt_force_irq () is called on some packet receives and 228 - * when a multicast address is changed. Since nothing 229 - * is received during the disconnect and the multicast 230 - * address changes can be viewed as not very often and 231 - * the timer runs out close to its given value 232 - * (reconn_time). 233 - */ 234 - smc->sm.please_reconnect = reconn_time ; 235 217 } 236 218 237 219 #ifndef SMT_REAL_TOKEN_CT ··· 1556 1574 * clear DNA and UNA 1557 1575 * called from CFM if configuration changes 1558 1576 */ 1559 - void smt_clear_una_dna(struct s_smc *smc) 1577 + static void smt_clear_una_dna(struct s_smc *smc) 1560 1578 { 1561 1579 smc->mib.m[MAC0].fddiMACUpstreamNbr = SMT_Unknown ; 1562 1580 smc->mib.m[MAC0].fddiMACDownstreamNbr = SMT_Unknown ; ··· 2040 2058 } 2041 2059 2042 2060 /* 2043 - * change tneg 2044 - * set T_Req in MIB (Path Attribute) 2045 - * calculate new values for MAC 2046 - * if change required 2047 - * disconnect 2048 - * set reconnect 2049 - * end 2050 - */ 2051 - void smt_change_t_neg(struct s_smc *smc, u_long tneg) 2052 - { 2053 - smc->mib.a[PATH0].fddiPATHMaxT_Req = tneg ; 2054 - 2055 - if (smt_set_mac_opvalues(smc)) { 2056 - RS_SET(smc,RS_EVENT) ; 2057 - smc->sm.please_reconnect = 1 ; 2058 - queue_event(smc,EVENT_ECM,EC_DISCONNECT) ; 2059 - } 2060 - } 2061 - 2062 - /* 2063 2061 * canonical conversion of <len> bytes beginning form *data 2064 2062 */ 2065 2063 #ifdef USE_CAN_ADDR 2066 - void hwm_conv_can(struct s_smc *smc, char *data, int len) 2064 + static void hwm_conv_can(struct s_smc *smc, char *data, int len) 2067 2065 { 2068 2066 int i ; 2069 2067
-5
drivers/net/skfp/smtdef.c
··· 76 76 static void smt_init_mib(struct s_smc *smc, int level); 77 77 static int set_min_max(int maxflag, u_long mib, u_long limit, u_long *oper); 78 78 79 - void smt_set_defaults(struct s_smc *smc) 80 - { 81 - smt_reset_defaults(smc,0) ; 82 - } 83 - 84 79 #define MS2BCLK(x) ((x)*12500L) 85 80 #define US2BCLK(x) ((x)*1250L) 86 81
-467
drivers/net/skfp/smtparse.c
··· 1 - /****************************************************************************** 2 - * 3 - * (C)Copyright 1998,1999 SysKonnect, 4 - * a business unit of Schneider & Koch & Co. Datensysteme GmbH. 5 - * 6 - * See the file "skfddi.c" for further information. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 - * 13 - * The information in this file is provided "AS IS" without warranty. 14 - * 15 - ******************************************************************************/ 16 - 17 - 18 - /* 19 - parser for SMT parameters 20 - */ 21 - 22 - #include "h/types.h" 23 - #include "h/fddi.h" 24 - #include "h/smc.h" 25 - #include "h/smt_p.h" 26 - 27 - #define KERNEL 28 - #include "h/smtstate.h" 29 - 30 - #ifndef lint 31 - static const char ID_sccs[] = "@(#)smtparse.c 1.12 98/10/06 (C) SK " ; 32 - #endif 33 - 34 - #ifdef sun 35 - #define _far 36 - #endif 37 - 38 - /* 39 - * convert to BCLK units 40 - */ 41 - #define MS2BCLK(x) ((x)*12500L) 42 - #define US2BCLK(x) ((x/10)*125L) 43 - 44 - /* 45 - * parameter table 46 - */ 47 - static struct s_ptab { 48 - char *pt_name ; 49 - u_short pt_num ; 50 - u_short pt_type ; 51 - u_long pt_min ; 52 - u_long pt_max ; 53 - } ptab[] = { 54 - { "PMFPASSWD",0, 0 } , 55 - { "USERDATA",1, 0 } , 56 - { "LERCUTOFFA",2, 1, 4, 15 } , 57 - { "LERCUTOFFB",3, 1, 4, 15 } , 58 - { "LERALARMA",4, 1, 4, 15 } , 59 - { "LERALARMB",5, 1, 4, 15 } , 60 - { "TMAX",6, 1, 5, 165 } , 61 - { "TMIN",7, 1, 5, 165 } , 62 - { "TREQ",8, 1, 5, 165 } , 63 - { "TVX",9, 1, 2500, 10000 } , 64 - #ifdef ESS 65 - { "SBAPAYLOAD",10, 1, 0, 1562 } , 66 - { "SBAOVERHEAD",11, 1, 50, 5000 } , 67 - { "MAXTNEG",12, 1, 5, 165 } , 68 - { "MINSEGMENTSIZE",13, 1, 0, 4478 } , 69 - { "SBACATEGORY",14, 1, 0, 0xffff } , 70 - { "SYNCHTXMODE",15, 0 } , 71 - #endif 72 - #ifdef SBA 73 - { "SBACOMMAND",16, 0 } , 74 - { "SBAAVAILABLE",17, 1, 0, 100 } , 75 - #endif 76 - { NULL } 77 - } ; 78 - 79 - /* Define maximum string size for values and keybuffer */ 80 - #define MAX_VAL 40 81 - 82 - /* 83 - * local function declarations 84 - */ 85 - static u_long parse_num(int type, char _far *value, char *v, u_long mn, 86 - u_long mx, int scale); 87 - static int parse_word(char *buf, char _far *text); 88 - 89 - #ifdef SIM 90 - #define DB_MAIN(a,b,c) printf(a,b,c) 91 - #else 92 - #define DB_MAIN(a,b,c) 93 - #endif 94 - 95 - /* 96 - * BEGIN_MANUAL_ENTRY() 97 - * 98 - * int smt_parse_arg(struct s_smc *,char _far *keyword,int type, 99 - char _far *value) 100 - * 101 - * parse SMT parameter 102 - * *keyword 103 - * pointer to keyword, must be \0, \n or \r terminated 104 - * *value pointer to value, either char * or u_long * 105 - * if char * 106 - * pointer to value, must be \0, \n or \r terminated 107 - * if u_long * 108 - * contains binary value 109 - * 110 - * type 0: integer 111 - * 1: string 112 - * return 113 - * 0 parameter parsed ok 114 - * != 0 error 115 - * NOTE: 116 - * function can be called with DS != SS 117 - * 118 - * 119 - * END_MANUAL_ENTRY() 120 - */ 121 - int smt_parse_arg(struct s_smc *smc, char _far *keyword, int type, 122 - char _far *value) 123 - { 124 - char keybuf[MAX_VAL+1]; 125 - char valbuf[MAX_VAL+1]; 126 - char c ; 127 - char *p ; 128 - char *v ; 129 - char *d ; 130 - u_long val = 0 ; 131 - struct s_ptab *pt ; 132 - int st ; 133 - int i ; 134 - 135 - /* 136 - * parse keyword 137 - */ 138 - if ((st = parse_word(keybuf,keyword))) 139 - return(st) ; 140 - /* 141 - * parse value if given as string 142 - */ 143 - if (type == 1) { 144 - if ((st = parse_word(valbuf,value))) 145 - return(st) ; 146 - } 147 - /* 148 - * search in table 149 - */ 150 - st = 0 ; 151 - for (pt = ptab ; (v = pt->pt_name) ; pt++) { 152 - for (p = keybuf ; (c = *p) ; p++,v++) { 153 - if (c != *v) 154 - break ; 155 - } 156 - if (!c && !*v) 157 - break ; 158 - } 159 - if (!v) 160 - return(-1) ; 161 - #if 0 162 - printf("=>%s<==>%s<=\n",pt->pt_name,valbuf) ; 163 - #endif 164 - /* 165 - * set value in MIB 166 - */ 167 - if (pt->pt_type) 168 - val = parse_num(type,value,valbuf,pt->pt_min,pt->pt_max,1) ; 169 - switch (pt->pt_num) { 170 - case 0 : 171 - v = valbuf ; 172 - d = (char *) smc->mib.fddiPRPMFPasswd ; 173 - for (i = 0 ; i < (signed)sizeof(smc->mib.fddiPRPMFPasswd) ; i++) 174 - *d++ = *v++ ; 175 - DB_MAIN("SET %s = %s\n",pt->pt_name,smc->mib.fddiPRPMFPasswd) ; 176 - break ; 177 - case 1 : 178 - v = valbuf ; 179 - d = (char *) smc->mib.fddiSMTUserData ; 180 - for (i = 0 ; i < (signed)sizeof(smc->mib.fddiSMTUserData) ; i++) 181 - *d++ = *v++ ; 182 - DB_MAIN("SET %s = %s\n",pt->pt_name,smc->mib.fddiSMTUserData) ; 183 - break ; 184 - case 2 : 185 - smc->mib.p[PA].fddiPORTLer_Cutoff = (u_char) val ; 186 - DB_MAIN("SET %s = %d\n", 187 - pt->pt_name,smc->mib.p[PA].fddiPORTLer_Cutoff) ; 188 - break ; 189 - case 3 : 190 - smc->mib.p[PB].fddiPORTLer_Cutoff = (u_char) val ; 191 - DB_MAIN("SET %s = %d\n", 192 - pt->pt_name,smc->mib.p[PB].fddiPORTLer_Cutoff) ; 193 - break ; 194 - case 4 : 195 - smc->mib.p[PA].fddiPORTLer_Alarm = (u_char) val ; 196 - DB_MAIN("SET %s = %d\n", 197 - pt->pt_name,smc->mib.p[PA].fddiPORTLer_Alarm) ; 198 - break ; 199 - case 5 : 200 - smc->mib.p[PB].fddiPORTLer_Alarm = (u_char) val ; 201 - DB_MAIN("SET %s = %d\n", 202 - pt->pt_name,smc->mib.p[PB].fddiPORTLer_Alarm) ; 203 - break ; 204 - case 6 : /* TMAX */ 205 - DB_MAIN("SET %s = %d\n",pt->pt_name,val) ; 206 - smc->mib.a[PATH0].fddiPATHT_MaxLowerBound = 207 - (u_long) -MS2BCLK((long)val) ; 208 - break ; 209 - case 7 : /* TMIN */ 210 - DB_MAIN("SET %s = %d\n",pt->pt_name,val) ; 211 - smc->mib.m[MAC0].fddiMACT_Min = 212 - (u_long) -MS2BCLK((long)val) ; 213 - break ; 214 - case 8 : /* TREQ */ 215 - DB_MAIN("SET %s = %d\n",pt->pt_name,val) ; 216 - smc->mib.a[PATH0].fddiPATHMaxT_Req = 217 - (u_long) -MS2BCLK((long)val) ; 218 - break ; 219 - case 9 : /* TVX */ 220 - DB_MAIN("SET %s = %d \n",pt->pt_name,val) ; 221 - smc->mib.a[PATH0].fddiPATHTVXLowerBound = 222 - (u_long) -US2BCLK((long)val) ; 223 - break ; 224 - #ifdef ESS 225 - case 10 : /* SBAPAYLOAD */ 226 - DB_MAIN("SET %s = %d\n",pt->pt_name,val) ; 227 - if (smc->mib.fddiESSPayload != val) { 228 - smc->ess.raf_act_timer_poll = TRUE ; 229 - smc->mib.fddiESSPayload = val ; 230 - } 231 - break ; 232 - case 11 : /* SBAOVERHEAD */ 233 - DB_MAIN("SET %s = %d\n",pt->pt_name,val) ; 234 - smc->mib.fddiESSOverhead = val ; 235 - break ; 236 - case 12 : /* MAXTNEG */ 237 - DB_MAIN("SET %s = %d\n",pt->pt_name,val) ; 238 - smc->mib.fddiESSMaxTNeg = (u_long) -MS2BCLK((long)val) ; 239 - break ; 240 - case 13 : /* MINSEGMENTSIZE */ 241 - DB_MAIN("SET %s = %d\n",pt->pt_name,val) ; 242 - smc->mib.fddiESSMinSegmentSize = val ; 243 - break ; 244 - case 14 : /* SBACATEGORY */ 245 - DB_MAIN("SET %s = %d\n",pt->pt_name,val) ; 246 - smc->mib.fddiESSCategory = 247 - (smc->mib.fddiESSCategory & 0xffff) | 248 - ((u_long)(val << 16)) ; 249 - break ; 250 - case 15 : /* SYNCHTXMODE */ 251 - /* do not use memcmp(valbuf,"ALL",3) because DS != SS */ 252 - if (valbuf[0] == 'A' && valbuf[1] == 'L' && valbuf[2] == 'L') { 253 - smc->mib.fddiESSSynchTxMode = TRUE ; 254 - DB_MAIN("SET %s = %s\n",pt->pt_name,valbuf) ; 255 - } 256 - /* if (!memcmp(valbuf,"SPLIT",5)) { */ 257 - if (valbuf[0] == 'S' && valbuf[1] == 'P' && valbuf[2] == 'L' && 258 - valbuf[3] == 'I' && valbuf[4] == 'T') { 259 - DB_MAIN("SET %s = %s\n",pt->pt_name,valbuf) ; 260 - smc->mib.fddiESSSynchTxMode = FALSE ; 261 - } 262 - break ; 263 - #endif 264 - #ifdef SBA 265 - case 16 : /* SBACOMMAND */ 266 - /* if (!memcmp(valbuf,"START",5)) { */ 267 - if (valbuf[0] == 'S' && valbuf[1] == 'T' && valbuf[2] == 'A' && 268 - valbuf[3] == 'R' && valbuf[4] == 'T') { 269 - DB_MAIN("SET %s = %s\n",pt->pt_name,valbuf) ; 270 - smc->mib.fddiSBACommand = SB_START ; 271 - } 272 - /* if (!memcmp(valbuf,"STOP",4)) { */ 273 - if (valbuf[0] == 'S' && valbuf[1] == 'T' && valbuf[2] == 'O' && 274 - valbuf[3] == 'P') { 275 - DB_MAIN("SET %s = %s\n",pt->pt_name,valbuf) ; 276 - smc->mib.fddiSBACommand = SB_STOP ; 277 - } 278 - break ; 279 - case 17 : /* SBAAVAILABLE */ 280 - DB_MAIN("SET %s = %d\n",pt->pt_name,val) ; 281 - smc->mib.fddiSBAAvailable = (u_char) val ; 282 - break ; 283 - #endif 284 - } 285 - return(0) ; 286 - } 287 - 288 - static int parse_word(char *buf, char _far *text) 289 - { 290 - char c ; 291 - char *p ; 292 - int p_len ; 293 - int quote ; 294 - int i ; 295 - int ok ; 296 - 297 - /* 298 - * skip leading white space 299 - */ 300 - p = buf ; 301 - for (i = 0 ; i < MAX_VAL ; i++) 302 - *p++ = 0 ; 303 - p = buf ; 304 - p_len = 0 ; 305 - ok = 0 ; 306 - while ( (c = *text++) && (c != '\n') && (c != '\r')) { 307 - if ((c != ' ') && (c != '\t')) { 308 - ok = 1 ; 309 - break ; 310 - } 311 - } 312 - if (!ok) 313 - return(-1) ; 314 - if (c == '"') { 315 - quote = 1 ; 316 - } 317 - else { 318 - quote = 0 ; 319 - text-- ; 320 - } 321 - /* 322 - * parse valbuf 323 - */ 324 - ok = 0 ; 325 - while (!ok && p_len < MAX_VAL-1 && (c = *text++) && (c != '\n') 326 - && (c != '\r')) { 327 - switch (quote) { 328 - case 0 : 329 - if ((c == ' ') || (c == '\t') || (c == '=')) { 330 - ok = 1 ; 331 - break ; 332 - } 333 - *p++ = c ; 334 - p_len++ ; 335 - break ; 336 - case 2 : 337 - *p++ = c ; 338 - p_len++ ; 339 - quote = 1 ; 340 - break ; 341 - case 1 : 342 - switch (c) { 343 - case '"' : 344 - ok = 1 ; 345 - break ; 346 - case '\\' : 347 - quote = 2 ; 348 - break ; 349 - default : 350 - *p++ = c ; 351 - p_len++ ; 352 - } 353 - } 354 - } 355 - *p++ = 0 ; 356 - for (p = buf ; (c = *p) ; p++) { 357 - if (c >= 'a' && c <= 'z') 358 - *p = c + 'A' - 'a' ; 359 - } 360 - return(0) ; 361 - } 362 - 363 - static u_long parse_num(int type, char _far *value, char *v, u_long mn, 364 - u_long mx, int scale) 365 - { 366 - u_long x = 0 ; 367 - char c ; 368 - 369 - if (type == 0) { /* integer */ 370 - u_long _far *l ; 371 - u_long u1 ; 372 - 373 - l = (u_long _far *) value ; 374 - u1 = *l ; 375 - /* 376 - * if the value is negative take the lower limit 377 - */ 378 - if ((long)u1 < 0) { 379 - if (- ((long)u1) > (long) mx) { 380 - u1 = 0 ; 381 - } 382 - else { 383 - u1 = (u_long) - ((long)u1) ; 384 - } 385 - } 386 - x = u1 ; 387 - } 388 - else { /* string */ 389 - int sign = 0 ; 390 - 391 - if (*v == '-') { 392 - sign = 1 ; 393 - } 394 - while ((c = *v++) && (c >= '0') && (c <= '9')) { 395 - x = x * 10 + c - '0' ; 396 - } 397 - if (scale == 10) { 398 - x *= 10 ; 399 - if (c == '.') { 400 - if ((c = *v++) && (c >= '0') && (c <= '9')) { 401 - x += c - '0' ; 402 - } 403 - } 404 - } 405 - if (sign) 406 - x = (u_long) - ((long)x) ; 407 - } 408 - /* 409 - * if the value is negative 410 - * and the absolute value is outside the limits 411 - * take the lower limit 412 - * else 413 - * take the absoute value 414 - */ 415 - if ((long)x < 0) { 416 - if (- ((long)x) > (long) mx) { 417 - x = 0 ; 418 - } 419 - else { 420 - x = (u_long) - ((long)x) ; 421 - } 422 - } 423 - if (x < mn) 424 - return(mn) ; 425 - else if (x > mx) 426 - return(mx) ; 427 - return(x) ; 428 - } 429 - 430 - #if 0 431 - struct s_smc SMC ; 432 - main() 433 - { 434 - char *p ; 435 - char *v ; 436 - char buf[100] ; 437 - int toggle = 0 ; 438 - 439 - while (gets(buf)) { 440 - p = buf ; 441 - while (*p && ((*p == ' ') || (*p == '\t'))) 442 - p++ ; 443 - 444 - while (*p && ((*p != ' ') && (*p != '\t'))) 445 - p++ ; 446 - 447 - v = p ; 448 - while (*v && ((*v == ' ') || (*v == '\t'))) 449 - v++ ; 450 - if ((*v >= '0') && (*v <= '9')) { 451 - toggle = !toggle ; 452 - if (toggle) { 453 - u_long l ; 454 - l = atol(v) ; 455 - smt_parse_arg(&SMC,buf,0,(char _far *)&l) ; 456 - } 457 - else 458 - smt_parse_arg(&SMC,buf,1,(char _far *)p) ; 459 - } 460 - else { 461 - smt_parse_arg(&SMC,buf,1,(char _far *)p) ; 462 - } 463 - } 464 - exit(0) ; 465 - } 466 - #endif 467 -