aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/skfp/smt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/skfp/smt.c')
-rw-r--r--drivers/net/skfp/smt.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/drivers/net/skfp/smt.c b/drivers/net/skfp/smt.c
index 6f35bb77595f..2d9941c045bc 100644
--- a/drivers/net/skfp/smt.c
+++ b/drivers/net/skfp/smt.c
@@ -127,22 +127,22 @@ static inline int is_my_addr(const struct s_smc *smc,
127 127
128static inline int is_broadcast(const struct fddi_addr *addr) 128static inline int is_broadcast(const struct fddi_addr *addr)
129{ 129{
130 return(*(u_short *)(&addr->a[0]) == 0xffff && 130 return *(u_short *)(&addr->a[0]) == 0xffff &&
131 *(u_short *)(&addr->a[2]) == 0xffff && 131 *(u_short *)(&addr->a[2]) == 0xffff &&
132 *(u_short *)(&addr->a[4]) == 0xffff ) ; 132 *(u_short *)(&addr->a[4]) == 0xffff;
133} 133}
134 134
135static inline int is_individual(const struct fddi_addr *addr) 135static inline int is_individual(const struct fddi_addr *addr)
136{ 136{
137 return(!(addr->a[0] & GROUP_ADDR)) ; 137 return !(addr->a[0] & GROUP_ADDR);
138} 138}
139 139
140static inline int is_equal(const struct fddi_addr *addr1, 140static inline int is_equal(const struct fddi_addr *addr1,
141 const struct fddi_addr *addr2) 141 const struct fddi_addr *addr2)
142{ 142{
143 return(*(u_short *)(&addr1->a[0]) == *(u_short *)(&addr2->a[0]) && 143 return *(u_short *)(&addr1->a[0]) == *(u_short *)(&addr2->a[0]) &&
144 *(u_short *)(&addr1->a[2]) == *(u_short *)(&addr2->a[2]) && 144 *(u_short *)(&addr1->a[2]) == *(u_short *)(&addr2->a[2]) &&
145 *(u_short *)(&addr1->a[4]) == *(u_short *)(&addr2->a[4]) ) ; 145 *(u_short *)(&addr1->a[4]) == *(u_short *)(&addr2->a[4]);
146} 146}
147 147
148/* 148/*
@@ -457,8 +457,8 @@ static int div_ratio(u_long upper, u_long lower)
457 else 457 else
458 upper <<= 16L ; 458 upper <<= 16L ;
459 if (!lower) 459 if (!lower)
460 return(0) ; 460 return 0;
461 return((int)(upper/lower)) ; 461 return (int)(upper/lower) ;
462} 462}
463 463
464#ifndef SLIM_SMT 464#ifndef SLIM_SMT
@@ -1111,11 +1111,11 @@ SMbuf *smt_build_frame(struct s_smc *smc, int class, int type,
1111 1111
1112#if 0 1112#if 0
1113 if (!smc->r.sm_ma_avail) { 1113 if (!smc->r.sm_ma_avail) {
1114 return(0) ; 1114 return 0;
1115 } 1115 }
1116#endif 1116#endif
1117 if (!(mb = smt_get_mbuf(smc))) 1117 if (!(mb = smt_get_mbuf(smc)))
1118 return(mb) ; 1118 return mb;
1119 1119
1120 mb->sm_len = length ; 1120 mb->sm_len = length ;
1121 smt = smtod(mb, struct smt_header *) ; 1121 smt = smtod(mb, struct smt_header *) ;
@@ -1136,7 +1136,7 @@ SMbuf *smt_build_frame(struct s_smc *smc, int class, int type,
1136 smt->smt_tid = smt_get_tid(smc) ; /* set transaction ID */ 1136 smt->smt_tid = smt_get_tid(smc) ; /* set transaction ID */
1137 smt->smt_pad = 0 ; 1137 smt->smt_pad = 0 ;
1138 smt->smt_len = length - sizeof(struct smt_header) ; 1138 smt->smt_len = length - sizeof(struct smt_header) ;
1139 return(mb) ; 1139 return mb;
1140} 1140}
1141 1141
1142static void smt_add_frame_len(SMbuf *mb, int len) 1142static void smt_add_frame_len(SMbuf *mb, int len)
@@ -1375,7 +1375,7 @@ static int smt_fill_path(struct s_smc *smc, struct smt_p_path *path)
1375 pd_mac = (struct smt_mac_rec *) phy ; 1375 pd_mac = (struct smt_mac_rec *) phy ;
1376 pd_mac->mac_addr = smc->mib.m[MAC0].fddiMACSMTAddress ; 1376 pd_mac->mac_addr = smc->mib.m[MAC0].fddiMACSMTAddress ;
1377 pd_mac->mac_resource_idx = mac_con_resource_index(smc,1) ; 1377 pd_mac->mac_resource_idx = mac_con_resource_index(smc,1) ;
1378 return(len) ; 1378 return len;
1379} 1379}
1380 1380
1381/* 1381/*
@@ -1563,7 +1563,7 @@ u_long smt_get_tid(struct s_smc *smc)
1563 u_long tid ; 1563 u_long tid ;
1564 while ((tid = ++(smc->sm.smt_tid) ^ SMT_TID_MAGIC) == 0) 1564 while ((tid = ++(smc->sm.smt_tid) ^ SMT_TID_MAGIC) == 0)
1565 ; 1565 ;
1566 return(tid & 0x3fffffffL) ; 1566 return tid & 0x3fffffffL;
1567} 1567}
1568 1568
1569 1569
@@ -1654,11 +1654,11 @@ int smt_check_para(struct s_smc *smc, struct smt_header *sm,
1654 while (*p) { 1654 while (*p) {
1655 if (!sm_to_para(smc,sm,(int) *p)) { 1655 if (!sm_to_para(smc,sm,(int) *p)) {
1656 DB_SMT("SMT: smt_check_para - missing para %x\n",*p,0); 1656 DB_SMT("SMT: smt_check_para - missing para %x\n",*p,0);
1657 return(-1) ; 1657 return -1;
1658 } 1658 }
1659 p++ ; 1659 p++ ;
1660 } 1660 }
1661 return(0) ; 1661 return 0;
1662} 1662}
1663 1663
1664void *sm_to_para(struct s_smc *smc, struct smt_header *sm, int para) 1664void *sm_to_para(struct s_smc *smc, struct smt_header *sm, int para)
@@ -1687,7 +1687,7 @@ void *sm_to_para(struct s_smc *smc, struct smt_header *sm, int para)
1687 return NULL; 1687 return NULL;
1688 } 1688 }
1689 if (found) 1689 if (found)
1690 return(found) ; 1690 return found;
1691 } 1691 }
1692 return NULL; 1692 return NULL;
1693} 1693}
@@ -1732,7 +1732,7 @@ char *addr_to_string(struct fddi_addr *addr)
1732 string[i * 3 + 2] = ':'; 1732 string[i * 3 + 2] = ':';
1733 } 1733 }
1734 string[5 * 3 + 2] = 0; 1734 string[5 * 3 + 2] = 0;
1735 return(string); 1735 return string;
1736} 1736}
1737#endif 1737#endif
1738 1738
@@ -1742,9 +1742,9 @@ int smt_ifconfig(int argc, char *argv[])
1742 if (argc >= 2 && !strcmp(argv[0],"opt_bypass") && 1742 if (argc >= 2 && !strcmp(argv[0],"opt_bypass") &&
1743 !strcmp(argv[1],"yes")) { 1743 !strcmp(argv[1],"yes")) {
1744 smc->mib.fddiSMTBypassPresent = 1 ; 1744 smc->mib.fddiSMTBypassPresent = 1 ;
1745 return(0) ; 1745 return 0;
1746 } 1746 }
1747 return(amdfddi_config(0,argc,argv)) ; 1747 return amdfddi_config(0, argc, argv);
1748} 1748}
1749#endif 1749#endif
1750 1750
@@ -1756,9 +1756,9 @@ static int mac_index(struct s_smc *smc, int mac)
1756 SK_UNUSED(mac) ; 1756 SK_UNUSED(mac) ;
1757#ifdef CONCENTRATOR 1757#ifdef CONCENTRATOR
1758 SK_UNUSED(smc) ; 1758 SK_UNUSED(smc) ;
1759 return(NUMPHYS+1) ; 1759 return NUMPHYS + 1;
1760#else 1760#else
1761 return((smc->s.sas == SMT_SAS) ? 2 : 3) ; 1761 return (smc->s.sas == SMT_SAS) ? 2 : 3;
1762#endif 1762#endif
1763} 1763}
1764 1764
@@ -1768,7 +1768,7 @@ static int mac_index(struct s_smc *smc, int mac)
1768static int phy_index(struct s_smc *smc, int phy) 1768static int phy_index(struct s_smc *smc, int phy)
1769{ 1769{
1770 SK_UNUSED(smc) ; 1770 SK_UNUSED(smc) ;
1771 return(phy+1); 1771 return phy + 1;
1772} 1772}
1773 1773
1774/* 1774/*
@@ -1779,19 +1779,19 @@ static int mac_con_resource_index(struct s_smc *smc, int mac)
1779#ifdef CONCENTRATOR 1779#ifdef CONCENTRATOR
1780 SK_UNUSED(smc) ; 1780 SK_UNUSED(smc) ;
1781 SK_UNUSED(mac) ; 1781 SK_UNUSED(mac) ;
1782 return(entity_to_index(smc,cem_get_downstream(smc,ENTITY_MAC))) ; 1782 return entity_to_index(smc, cem_get_downstream(smc, ENTITY_MAC));
1783#else 1783#else
1784 SK_UNUSED(mac) ; 1784 SK_UNUSED(mac) ;
1785 switch (smc->mib.fddiSMTCF_State) { 1785 switch (smc->mib.fddiSMTCF_State) {
1786 case SC9_C_WRAP_A : 1786 case SC9_C_WRAP_A :
1787 case SC5_THRU_B : 1787 case SC5_THRU_B :
1788 case SC11_C_WRAP_S : 1788 case SC11_C_WRAP_S :
1789 return(1) ; 1789 return 1;
1790 case SC10_C_WRAP_B : 1790 case SC10_C_WRAP_B :
1791 case SC4_THRU_A : 1791 case SC4_THRU_A :
1792 return(2) ; 1792 return 2;
1793 } 1793 }
1794 return(smc->s.sas == SMT_SAS ? 2 : 3) ; 1794 return smc->s.sas == SMT_SAS ? 2 : 3;
1795#endif 1795#endif
1796} 1796}
1797 1797
@@ -1801,21 +1801,21 @@ static int mac_con_resource_index(struct s_smc *smc, int mac)
1801static int phy_con_resource_index(struct s_smc *smc, int phy) 1801static int phy_con_resource_index(struct s_smc *smc, int phy)
1802{ 1802{
1803#ifdef CONCENTRATOR 1803#ifdef CONCENTRATOR
1804 return(entity_to_index(smc,cem_get_downstream(smc,ENTITY_PHY(phy)))) ; 1804 return entity_to_index(smc, cem_get_downstream(smc, ENTITY_PHY(phy))) ;
1805#else 1805#else
1806 switch (smc->mib.fddiSMTCF_State) { 1806 switch (smc->mib.fddiSMTCF_State) {
1807 case SC9_C_WRAP_A : 1807 case SC9_C_WRAP_A :
1808 return(phy == PA ? 3 : 2) ; 1808 return phy == PA ? 3 : 2;
1809 case SC10_C_WRAP_B : 1809 case SC10_C_WRAP_B :
1810 return(phy == PA ? 1 : 3) ; 1810 return phy == PA ? 1 : 3;
1811 case SC4_THRU_A : 1811 case SC4_THRU_A :
1812 return(phy == PA ? 3 : 1) ; 1812 return phy == PA ? 3 : 1;
1813 case SC5_THRU_B : 1813 case SC5_THRU_B :
1814 return(phy == PA ? 2 : 3) ; 1814 return phy == PA ? 2 : 3;
1815 case SC11_C_WRAP_S : 1815 case SC11_C_WRAP_S :
1816 return(2) ; 1816 return 2;
1817 } 1817 }
1818 return(phy) ; 1818 return phy;
1819#endif 1819#endif
1820} 1820}
1821 1821
@@ -1823,16 +1823,16 @@ static int phy_con_resource_index(struct s_smc *smc, int phy)
1823static int entity_to_index(struct s_smc *smc, int e) 1823static int entity_to_index(struct s_smc *smc, int e)
1824{ 1824{
1825 if (e == ENTITY_MAC) 1825 if (e == ENTITY_MAC)
1826 return(mac_index(smc,1)) ; 1826 return mac_index(smc, 1);
1827 else 1827 else
1828 return(phy_index(smc,e - ENTITY_PHY(0))) ; 1828 return phy_index(smc, e - ENTITY_PHY(0));
1829} 1829}
1830#endif 1830#endif
1831 1831
1832#ifdef LITTLE_ENDIAN 1832#ifdef LITTLE_ENDIAN
1833static int smt_swap_short(u_short s) 1833static int smt_swap_short(u_short s)
1834{ 1834{
1835 return(((s>>8)&0xff)|((s&0xff)<<8)) ; 1835 return ((s>>8)&0xff) | ((s&0xff)<<8);
1836} 1836}
1837 1837
1838void smt_swap_para(struct smt_header *sm, int len, int direction) 1838void smt_swap_para(struct smt_header *sm, int len, int direction)
@@ -1996,7 +1996,7 @@ int smt_action(struct s_smc *smc, int class, int code, int index)
1996 } 1996 }
1997 break ; 1997 break ;
1998 default : 1998 default :
1999 return(1) ; 1999 return 1;
2000 } 2000 }
2001 break ; 2001 break ;
2002 case SMT_PORT_ACTION : 2002 case SMT_PORT_ACTION :
@@ -2017,14 +2017,14 @@ int smt_action(struct s_smc *smc, int class, int code, int index)
2017 event = PC_STOP ; 2017 event = PC_STOP ;
2018 break ; 2018 break ;
2019 default : 2019 default :
2020 return(1) ; 2020 return 1;
2021 } 2021 }
2022 queue_event(smc,EVENT_PCM+index,event) ; 2022 queue_event(smc,EVENT_PCM+index,event) ;
2023 break ; 2023 break ;
2024 default : 2024 default :
2025 return(1) ; 2025 return 1;
2026 } 2026 }
2027 return(0) ; 2027 return 0;
2028} 2028}
2029 2029
2030/* 2030/*