@@ -1764,6 +1764,45 @@ static int b53_arl_read(struct b53_device *dev, u64 mac,
17641764 return * idx >= dev -> num_arl_bins ? - ENOSPC : - ENOENT ;
17651765}
17661766
1767+ static int b53_arl_read_25 (struct b53_device * dev , u64 mac ,
1768+ u16 vid , struct b53_arl_entry * ent , u8 * idx )
1769+ {
1770+ DECLARE_BITMAP (free_bins , B53_ARLTBL_MAX_BIN_ENTRIES );
1771+ unsigned int i ;
1772+ int ret ;
1773+
1774+ ret = b53_arl_op_wait (dev );
1775+ if (ret )
1776+ return ret ;
1777+
1778+ bitmap_zero (free_bins , dev -> num_arl_bins );
1779+
1780+ /* Read the bins */
1781+ for (i = 0 ; i < dev -> num_arl_bins ; i ++ ) {
1782+ u64 mac_vid ;
1783+
1784+ b53_read64 (dev , B53_ARLIO_PAGE ,
1785+ B53_ARLTBL_MAC_VID_ENTRY (i ), & mac_vid );
1786+
1787+ b53_arl_to_entry_25 (ent , mac_vid );
1788+
1789+ if (!(mac_vid & ARLTBL_VALID_25 )) {
1790+ set_bit (i , free_bins );
1791+ continue ;
1792+ }
1793+ if ((mac_vid & ARLTBL_MAC_MASK ) != mac )
1794+ continue ;
1795+ if (dev -> vlan_enabled &&
1796+ ((mac_vid >> ARLTBL_VID_S_65 ) & ARLTBL_VID_MASK_25 ) != vid )
1797+ continue ;
1798+ * idx = i ;
1799+ return 0 ;
1800+ }
1801+
1802+ * idx = find_first_bit (free_bins , dev -> num_arl_bins );
1803+ return * idx >= dev -> num_arl_bins ? - ENOSPC : - ENOENT ;
1804+ }
1805+
17671806static int b53_arl_op (struct b53_device * dev , int op , int port ,
17681807 const unsigned char * addr , u16 vid , bool is_valid )
17691808{
@@ -1786,7 +1825,10 @@ static int b53_arl_op(struct b53_device *dev, int op, int port,
17861825 if (ret )
17871826 return ret ;
17881827
1789- ret = b53_arl_read (dev , mac , vid , & ent , & idx );
1828+ if (is5325 (dev ) || is5365 (dev ))
1829+ ret = b53_arl_read_25 (dev , mac , vid , & ent , & idx );
1830+ else
1831+ ret = b53_arl_read (dev , mac , vid , & ent , & idx );
17901832
17911833 /* If this is a read, just finish now */
17921834 if (op )
@@ -1830,12 +1872,17 @@ static int b53_arl_op(struct b53_device *dev, int op, int port,
18301872 ent .is_static = true;
18311873 ent .is_age = false;
18321874 memcpy (ent .mac , addr , ETH_ALEN );
1833- b53_arl_from_entry (& mac_vid , & fwd_entry , & ent );
1875+ if (is5325 (dev ) || is5365 (dev ))
1876+ b53_arl_from_entry_25 (& mac_vid , & ent );
1877+ else
1878+ b53_arl_from_entry (& mac_vid , & fwd_entry , & ent );
18341879
18351880 b53_write64 (dev , B53_ARLIO_PAGE ,
18361881 B53_ARLTBL_MAC_VID_ENTRY (idx ), mac_vid );
1837- b53_write32 (dev , B53_ARLIO_PAGE ,
1838- B53_ARLTBL_DATA_ENTRY (idx ), fwd_entry );
1882+
1883+ if (!is5325 (dev ) && !is5365 (dev ))
1884+ b53_write32 (dev , B53_ARLIO_PAGE ,
1885+ B53_ARLTBL_DATA_ENTRY (idx ), fwd_entry );
18391886
18401887 return b53_arl_rw_op (dev , 0 );
18411888}
@@ -1847,12 +1894,6 @@ int b53_fdb_add(struct dsa_switch *ds, int port,
18471894 struct b53_device * priv = ds -> priv ;
18481895 int ret ;
18491896
1850- /* 5325 and 5365 require some more massaging, but could
1851- * be supported eventually
1852- */
1853- if (is5325 (priv ) || is5365 (priv ))
1854- return - EOPNOTSUPP ;
1855-
18561897 mutex_lock (& priv -> arl_mutex );
18571898 ret = b53_arl_op (priv , 0 , port , addr , vid , true);
18581899 mutex_unlock (& priv -> arl_mutex );
@@ -1879,10 +1920,15 @@ EXPORT_SYMBOL(b53_fdb_del);
18791920static int b53_arl_search_wait (struct b53_device * dev )
18801921{
18811922 unsigned int timeout = 1000 ;
1882- u8 reg ;
1923+ u8 reg , offset ;
1924+
1925+ if (is5325 (dev ) || is5365 (dev ))
1926+ offset = B53_ARL_SRCH_CTL_25 ;
1927+ else
1928+ offset = B53_ARL_SRCH_CTL ;
18831929
18841930 do {
1885- b53_read8 (dev , B53_ARLIO_PAGE , B53_ARL_SRCH_CTL , & reg );
1931+ b53_read8 (dev , B53_ARLIO_PAGE , offset , & reg );
18861932 if (!(reg & ARL_SRCH_STDN ))
18871933 return 0 ;
18881934
@@ -1899,13 +1945,24 @@ static void b53_arl_search_rd(struct b53_device *dev, u8 idx,
18991945 struct b53_arl_entry * ent )
19001946{
19011947 u64 mac_vid ;
1902- u32 fwd_entry ;
19031948
1904- b53_read64 (dev , B53_ARLIO_PAGE ,
1905- B53_ARL_SRCH_RSTL_MACVID (idx ), & mac_vid );
1906- b53_read32 (dev , B53_ARLIO_PAGE ,
1907- B53_ARL_SRCH_RSTL (idx ), & fwd_entry );
1908- b53_arl_to_entry (ent , mac_vid , fwd_entry );
1949+ if (is5325 (dev )) {
1950+ b53_read64 (dev , B53_ARLIO_PAGE , B53_ARL_SRCH_RSTL_0_MACVID_25 ,
1951+ & mac_vid );
1952+ b53_arl_to_entry_25 (ent , mac_vid );
1953+ } else if (is5365 (dev )) {
1954+ b53_read64 (dev , B53_ARLIO_PAGE , B53_ARL_SRCH_RSTL_0_MACVID_65 ,
1955+ & mac_vid );
1956+ b53_arl_to_entry_25 (ent , mac_vid );
1957+ } else {
1958+ u32 fwd_entry ;
1959+
1960+ b53_read64 (dev , B53_ARLIO_PAGE , B53_ARL_SRCH_RSTL_MACVID (idx ),
1961+ & mac_vid );
1962+ b53_read32 (dev , B53_ARLIO_PAGE , B53_ARL_SRCH_RSTL (idx ),
1963+ & fwd_entry );
1964+ b53_arl_to_entry (ent , mac_vid , fwd_entry );
1965+ }
19091966}
19101967
19111968static int b53_fdb_copy (int port , const struct b53_arl_entry * ent ,
@@ -1926,14 +1983,20 @@ int b53_fdb_dump(struct dsa_switch *ds, int port,
19261983 struct b53_device * priv = ds -> priv ;
19271984 struct b53_arl_entry results [2 ];
19281985 unsigned int count = 0 ;
1986+ u8 offset ;
19291987 int ret ;
19301988 u8 reg ;
19311989
19321990 mutex_lock (& priv -> arl_mutex );
19331991
1992+ if (is5325 (priv ) || is5365 (priv ))
1993+ offset = B53_ARL_SRCH_CTL_25 ;
1994+ else
1995+ offset = B53_ARL_SRCH_CTL ;
1996+
19341997 /* Start search operation */
19351998 reg = ARL_SRCH_STDN ;
1936- b53_write8 (priv , B53_ARLIO_PAGE , B53_ARL_SRCH_CTL , reg );
1999+ b53_write8 (priv , offset , B53_ARL_SRCH_CTL , reg );
19372000
19382001 do {
19392002 ret = b53_arl_search_wait (priv );
0 commit comments