Changeset 35585


Ignore:
Timestamp:
2013-02-13T17:05:13+01:00 (5 years ago)
Author:
hauke
Message:

switch: resetting and enabling vlan write for gigabit switches

This patch makes it possible to reset and enable writing vlans to recent switchs.

This is based on a patch by jcharest and the Broadcom SDK.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/switch/src/switch-robo.c

    r35584 r35585  
    694694static int handle_enable_vlan_write(void *driver, char *buf, int nr) 
    695695{ 
     696        __u16 val16; 
    696697        int disable = ((buf[0] != '1') ? 1 : 0); 
    697698 
     699        val16 = robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0); 
    698700        robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0, disable ? 0 : 
    699                 (1 << 7) /* 802.1Q VLAN */ | (3 << 5) /* mac check and hash */); 
     701                val16 | (1 << 7) /* 802.1Q VLAN */ | (3 << 5) /* mac check and hash */); 
     702 
     703        val16 = robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL1); 
    700704        robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL1, disable ? 0 : 
    701                 (robo.devid == ROBO_DEVICE_ID_5325 ? (1 << 1) : 
     705                val16 | (robo.devid == ROBO_DEVICE_ID_5325 ? (1 << 1) : 
    702706                0) | (1 << 2) | (1 << 3)); /* RSV multicast */ 
    703707 
     
    713717} 
    714718 
    715 static int handle_reset(void *driver, char *buf, int nr) 
    716 { 
    717         switch_driver *d = (switch_driver *) driver; 
     719static void handle_reset_old(switch_driver *d, char *buf, int nr) 
     720{ 
    718721        int j; 
    719722        __u16 val16; 
    720  
    721         /* disable switching */ 
    722         set_switch(0); 
    723723 
    724724        /* reset vlans */ 
     
    734734                             val16); 
    735735        } 
     736} 
     737 
     738static void handle_reset_new(switch_driver *d, char *buf, int nr) 
     739{ 
     740        int j; 
     741        __u8 vtbl_entry, vtbl_index, vtbl_access; 
     742 
     743        if ((robo.devid == ROBO_DEVICE_ID_5395) || 
     744            (robo.devid == ROBO_DEVICE_ID_53115)) { 
     745                vtbl_access = ROBO_VTBL_ACCESS_5395; 
     746                vtbl_index = ROBO_VTBL_INDX_5395; 
     747                vtbl_entry = ROBO_VTBL_ENTRY_5395; 
     748        } else { 
     749                vtbl_access = ROBO_VTBL_ACCESS; 
     750                vtbl_index = ROBO_VTBL_INDX; 
     751                vtbl_entry = ROBO_VTBL_ENTRY; 
     752        } 
     753 
     754        for (j = 0; j <= VLAN_ID_MAX; j++) { 
     755                /* write config now */ 
     756                robo_write32(ROBO_ARLIO_PAGE, vtbl_entry, 0); 
     757                robo_write16(ROBO_ARLIO_PAGE, vtbl_index, j); 
     758                robo_write16(ROBO_ARLIO_PAGE, vtbl_access, 1 << 7); 
     759        } 
     760} 
     761 
     762static int handle_reset(void *driver, char *buf, int nr) 
     763{ 
     764        int j; 
     765        switch_driver *d = (switch_driver *) driver; 
     766 
     767        /* disable switching */ 
     768        set_switch(0); 
     769 
     770        if (robo.devid != ROBO_DEVICE_ID_5325) 
     771                handle_reset_new(d, buf, nr); 
     772        else 
     773                handle_reset_old(d, buf, nr); 
    736774 
    737775        /* reset ports to a known good state */ 
Note: See TracChangeset for help on using the changeset viewer.