Recently, Broadcom has opensourced API for their network switching asic as part of OpenNSL project. I tried to dig little deep into what it really means and this blog is a result of that.
What is really Opensourced?
Following picture from Broadcom OpenNSL project clearly illustrates this:
- OpenNSL is a layer on top of Broadcom SDK. Broadcom SDK is not opensourced, only the OpenNSL layer is opensourced.
- SDK apis exposes some of the internal functionalities of the Chip. OpenNSL layer exposes the features but not their implementation so that the secret sauce stays with Broadcom.
- Before OpenNSL came, vendors using Broadcom sdk could not opensource their software accessing Broadcom sdk because Broadcom sdk source was under NDA. With OpenNSL, that limitation is not there anymore. 1 of the recent examples is Facebook’s Fboss agent using OpenNSL api and Facebook opensourcing Fboss agent. (I had mentioned more about Facebook’s Opencompute Networking contributions in my earlier blog)
- OpenNSL is targeted primarily towards StrataXGS chipsets with focus on Trident 2 and Tomahawk.
As of now, OpenNSL source code has the api for the following modules. I assume support for other modules will come soon.
– Layer 2, Layer 3, Vlan, STG, Statistics
Following are the apis supported under L2 category as mentioned in OpenNSL documentation:
int opennsl_l2_addr_add (int unit, opennsl_l2_addr_t *l2addr) LIB_DLL_EXPORTED Add an L2 address entry to the specified device. int opennsl_l2_addr_delete (int unit, opennsl_mac_t mac, opennsl_vlan_t vid) LIB_DLL_EXPORTED Delete an L2 address entry from the specified device. int opennsl_l2_addr_get (int unit, opennsl_mac_t mac_addr, opennsl_vlan_t vid, opennsl_l2_addr_t *l2addr) LIB_DLL_EXPORTED Check if an L2 entry is present in the L2 table. void opennsl_l2_addr_t_init (opennsl_l2_addr_t *l2addr, const opennsl_mac_t mac_addr, opennsl_vlan_t vid) LIB_DLL_EXPORTED Initialize an L2 address structure to a specified MAC address and VLAN ID. int opennsl_l2_station_add (int unit, int *station_id, opennsl_l2_station_t *station) LIB_DLL_EXPORTED Add an entry to L2 Station table. int opennsl_l2_station_delete (int unit, int station_id) LIB_DLL_EXPORTED Delete an entry from L2 Station Table. int opennsl_l2_station_get (int unit, int station_id, opennsl_l2_station_t *station) LIB_DLL_EXPORTED Get L2 station entry details from Station Table. void opennsl_l2_station_t_init (opennsl_l2_station_t *addr) LIB_DLL_EXPORTED Initialize L2 Station structure.
I feel that OpenNSL is a step in the right direction for Opensource software. It needs to be seen if the OpenNSL apis going forward will allow us to use all functionalities of the chip or not.