Skip to content

Commit

Permalink
Merge pull request #80 from pzanna/Dev_81
Browse files Browse the repository at this point in the history
Dev 81
  • Loading branch information
pzanna authored May 28, 2017
2 parents 4721096 + b82ac13 commit 3e983a9
Show file tree
Hide file tree
Showing 21 changed files with 977 additions and 1,216 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ This repository contains the entire open-source firmware for the Zodiac FX inclu

The latest firmware is available in the [Northbound Networks Forums](http://forums.northboundnetworks.com/index.php?topic=52.0).

Starting from version 0.80, Zodiac FX supports firmware updates via the CLI and web interface. In order to make this possible, major changes were made to the firmware flashing process. Follow the update process below, based on your current firmware version.
Starting from version 0.81, Zodiac FX supports firmware updates via the CLI and web interface. In order to make this possible, major changes were made to the firmware flashing process. Follow the update process below, based on your current firmware version.

#### For firmware versions BEFORE version 0.80
#### For firmware versions BEFORE version 0.81

To update to version 0.80 or later, a **full upgrade firmware** needs to be flashed.
To update to version 0.81 or later, a **full upgrade firmware** needs to be flashed.

Download the latest **full upgrade firmware** from the [Northbound Networks Forums](http://forums.northboundnetworks.com/index.php?topic=52.0) - 'Full Upgrade Firmware (v0.XX) - ZodiacFX_vXX_full_install.bin'

Follow the firmware update process detailed in **Section 2. Updating Firmware** in the [Zodiac FX User Guide](http://forums.northboundnetworks.com/downloads/zodiac_fx/guides/ZodiacFX_UserGuide_0317.pdf).

#### For firmware versions AFTER version 0.80
#### For firmware versions AFTER version 0.81

The update process has been simplified for the newer releases.

Expand Down Expand Up @@ -83,7 +83,7 @@ The Zodiac FX uses a simple additive checksum to verify the integrity of the upl
To sign your own modified firmware, follow the steps below:
* Build a 'Release' binary of the modified firmware
* Update the Zodiac FX with the modified firmware
* Follow the instructions outlined in Flashing/Updating the Firmware - For firmware versions AFTER version 0.80
* Follow the instructions outlined in Flashing/Updating the Firmware - For firmware versions AFTER version 0.81
* The firmware will fail the verification check, but will still be stored inside the Zodiac FX flash memory
* In the root context of the CLI, type in the hidden command 'get crc'
* Open the ZodiacFX.bin file in a hex editor, and append the 8 bytes to the end of the firmware file
Expand All @@ -99,6 +99,12 @@ Issues can also be [raised](https://github.com/NorthboundNetworks/ZodiacFX/issue

## Release Notes

**Version 0.81**
* Firmware upload fixes (full upgrade required)
* Metering bug-fixes & updates (initial DSCP remark support)
* Port stat output bug-fixes
* Web interface improvements

**Version 0.80**
* Firmware upload via CLI and web interface added
* Metering added to OpenFlow 1.3
Expand Down
6 changes: 3 additions & 3 deletions ZodiacFX/ZodiacFX.cproj
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@
<InterfaceName>JTAG</InterfaceName>
</ToolOptions>
<ToolType>com.atmel.avrdbg.tool.atmelice</ToolType>
<ToolNumber>J41800058832</ToolNumber>
<ToolNumber>J41800009874</ToolNumber>
<ToolName>Atmel-ICE</ToolName>
</com_atmel_avrdbg_tool_atmelice>
<avrtoolinterface>JTAG</avrtoolinterface>
<avrtoolserialnumber>J41800058832</avrtoolserialnumber>
<avrtoolserialnumber>J41800009874</avrtoolserialnumber>
<avrdeviceexpectedsignature>0xA3CC0CE0</avrdeviceexpectedsignature>
<avrtoolinterfaceclock>7500000</avrtoolinterfaceclock>
</PropertyGroup>
Expand Down Expand Up @@ -368,7 +368,7 @@
</armgcc.linker.libraries.LibrarySearchPaths>
<armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>
<armgcc.linker.memorysettings.ExternalRAM />
<armgcc.linker.miscellaneous.LinkerFlags>-Wl,--defsym,__stack_size__=0x1400 -Wl,--entry=Reset_Handler -Wl,-section-start=.text=0x00420000 -Wl,--cref -mthumb -T../src/ASF/sam/utils/linker_scripts/sam4e/sam4e8/gcc/flash.ld</armgcc.linker.miscellaneous.LinkerFlags>
<armgcc.linker.miscellaneous.LinkerFlags>-Wl,--defsym,__stack_size__=0x1400 -Wl,--entry=Reset_Handler -Wl,-section-start=.text=0x00410000 -Wl,--cref -mthumb -T../src/ASF/sam/utils/linker_scripts/sam4e/sam4e8/gcc/flash.ld</armgcc.linker.miscellaneous.LinkerFlags>
<armgcc.assembler.general.IncludePaths>
<ListValues>
<Value>../src/ASF/sam/drivers/efc</Value>
Expand Down
103 changes: 61 additions & 42 deletions ZodiacFX/src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Paul Zanna <[email protected]>
* & Kristopher Chen <[email protected]>
*
*/

Expand Down Expand Up @@ -60,16 +61,14 @@ extern uint16_t ofp13_oxm_inst_size[MAX_FLOWS_13];
extern struct flows_counter flow_counters[MAX_FLOWS_13];
extern struct flow_tbl_actions *flow_actions10[MAX_FLOWS_13];
extern int iLastFlow;
extern struct ofp10_port_stats phys10_port_stats[4];
extern struct ofp13_port_stats phys13_port_stats[4];
extern struct ofp10_port_stats phys10_port_stats[TOTAL_PORTS];
extern struct ofp13_port_stats phys13_port_stats[TOTAL_PORTS];
extern struct table_counter table_counters[MAX_TABLES];
extern struct meter_entry13 *meter_entry[MAX_METER_13];
extern struct meter_band_stats_array band_stats_array[MAX_METER_13];
extern bool masterselect;
extern bool stackenabled = false;
extern bool trace = false;
extern struct tcp_pcb *tcp_pcb;
extern uint8_t port_status[4];
extern uint8_t port_status[TOTAL_PORTS];
extern int totaltime;
extern int32_t ul_temp;
extern int OF_Version;
Expand All @@ -82,7 +81,6 @@ uint8_t uCLIContext = 0;
struct arp_header arp_test;
uint8_t esc_char = 0;


// Internal Functions
void saveConfig(void);
void command_root(char *command, char *param1, char *param2, char *param3);
Expand Down Expand Up @@ -124,6 +122,18 @@ void saveConfig(void)
return;
}

/*
* Restart Zodiac FX
*
*/
void software_reset(void)
{
for(int x = 0;x<100000;x++); // Let the above message get sent to the terminal before detaching
udc_detach(); // Detach the USB device before restart
rstc_start_software_reset(RSTC); // Software reset
while (1);
}

/*
* Main command line loop
*
Expand All @@ -142,10 +152,7 @@ void task_command(char *str, char *str_last)
if(restart_required_outer == true)
{
printf("Restarting the Zodiac FX, please reopen your terminal application.\r\n");
for(int x = 0;x<100000;x++); // Let the above message get sent to the terminal before detaching
udc_detach(); // Detach the USB device before restart
rstc_start_software_reset(RSTC); // Software reset
while (1);
software_reset();
}

while(udi_cdc_is_rx_ready()){
Expand Down Expand Up @@ -318,28 +325,35 @@ void command_root(char *command, char *param1, char *param2, char *param3)
{
int i;
printf("\r\n-------------------------------------------------------------------------\r\n");
for (i=0;i<4;i++)
for (i=0;i<TOTAL_PORTS;i++)
{

printf("\r\nPort %d\r\n",i+1);
if (port_status[i] == 1) printf(" Status: UP\r\n");
if (port_status[i] == 0) printf(" Status: DOWN\r\n");
for (int x=0;x<MAX_VLANS;x++)
if (i > 3)
{
if (Zodiac_Config.vlan_list[x].portmap[i] == 1)
printf(" VLAN type: OpenFlow\r\n");
printf(" VLAN ID: n/a\r\n");
} else
{
for (int x=0;x<MAX_VLANS;x++)
{
if (Zodiac_Config.vlan_list[x].uVlanType == 0) printf(" VLAN type: Unassigned\r\n");
if (Zodiac_Config.vlan_list[x].uVlanType == 1) printf(" VLAN type: OpenFlow\r\n");
if (Zodiac_Config.vlan_list[x].uVlanType == 2) printf(" VLAN type: Native\r\n");
printf(" VLAN ID: %d\r\n", Zodiac_Config.vlan_list[x].uVlanID);
if (Zodiac_Config.vlan_list[x].portmap[i] == 1)
{
if (Zodiac_Config.vlan_list[x].uVlanType == 0) printf(" VLAN type: Unassigned\r\n");
if (Zodiac_Config.vlan_list[x].uVlanType == 1) printf(" VLAN type: OpenFlow\r\n");
if (Zodiac_Config.vlan_list[x].uVlanType == 2) printf(" VLAN type: Native\r\n");
printf(" VLAN ID: %d\r\n", Zodiac_Config.vlan_list[x].uVlanID);
}
}
}
if( OF_Version == 1)
{
printf(" RX Bytes: %" PRIu64 "\r\n", phys10_port_stats[i].rx_bytes);
printf(" TX Bytes: %" PRIu64 "\r\n", phys10_port_stats[i].tx_bytes);
if (Zodiac_Config.of_port[i] == 1) printf(" RX Packets: %" PRIu64 "\r\n", phys10_port_stats[i].rx_packets);
if (Zodiac_Config.of_port[i] == 1) printf(" TX Packets: %" PRIu64 "\r\n", phys10_port_stats[i].tx_packets);
if (Zodiac_Config.of_port[i] == 1 || i > 3) printf(" RX Packets: %" PRIu64 "\r\n", phys10_port_stats[i].rx_packets);
if (Zodiac_Config.of_port[i] == 1 || i > 3) printf(" TX Packets: %" PRIu64 "\r\n", phys10_port_stats[i].tx_packets);
printf(" RX Dropped Packets: %" PRIu64 "\r\n", phys10_port_stats[i].rx_dropped);
printf(" TX Dropped Packets: %" PRIu64 "\r\n", phys10_port_stats[i].tx_dropped);
printf(" RX CRC Errors: %" PRIu64 "\r\n", phys10_port_stats[i].rx_crc_err);
Expand All @@ -348,8 +362,8 @@ void command_root(char *command, char *param1, char *param2, char *param3)
{
printf(" RX Bytes: %" PRIu64 "\r\n", phys13_port_stats[i].rx_bytes);
printf(" TX Bytes: %" PRIu64 "\r\n", phys13_port_stats[i].tx_bytes);
if (Zodiac_Config.of_port[i] == 1) printf(" RX Packets: %" PRIu64 "\r\n", phys13_port_stats[i].rx_packets);
if (Zodiac_Config.of_port[i] == 1) printf(" TX Packets: %" PRIu64 "\r\n", phys13_port_stats[i].tx_packets);
if (Zodiac_Config.of_port[i] == 1 || i > 3) printf(" RX Packets: %" PRIu64 "\r\n", phys13_port_stats[i].rx_packets);
if (Zodiac_Config.of_port[i] == 1 || i > 3) printf(" TX Packets: %" PRIu64 "\r\n", phys13_port_stats[i].tx_packets);
printf(" RX Dropped Packets: %" PRIu64 "\r\n", phys13_port_stats[i].rx_dropped);
printf(" TX Dropped Packets: %" PRIu64 "\r\n", phys13_port_stats[i].tx_dropped);
printf(" RX CRC Errors: %" PRIu64 "\r\n", phys13_port_stats[i].rx_crc_err);
Expand Down Expand Up @@ -447,10 +461,7 @@ void command_root(char *command, char *param1, char *param2, char *param3)
if (strcmp(command, "restart")==0)
{
printf("Restarting the Zodiac FX, please reopen your terminal application.\r\n");
for(int x = 0;x<100000;x++); // Let the above message get sent to the terminal before detaching
udc_detach(); // Detach the USB device before restart
rstc_start_software_reset(RSTC); // Software reset
while (1);
software_reset();
}

// Get CRC
Expand All @@ -461,6 +472,19 @@ void command_root(char *command, char *param1, char *param2, char *param3)
printf("Append [%08x 00000000] to the binary\r\n", ntohl(verify.calculated));
return;
}

if (strcmp(command, "dump")==0 && strcmp(param1, "flash")==0)
{
uint8_t* buffer_pmem = FLASH_BUFFER;
while(buffer_pmem < FLASH_BUFFER_END)
{
printf("%02x", *buffer_pmem);
buffer_pmem++;
}
printf("\n");

return;
}

// Unknown Command
printf("Unknown command\r\n");
Expand Down Expand Up @@ -506,10 +530,7 @@ void command_config(char *command, char *param1, char *param2, char *param3)
if (strcmp(command, "restart")==0)
{
printf("Restarting the Zodiac FX, please reopen your terminal application.\r\n");
for(int x = 0;x<100000;x++); // Let the above message get send to the terminal before detaching
udc_detach(); // Detach the USB device before restart
rstc_start_software_reset(RSTC); // Software reset
while (1);
software_reset();
}

// Display Config
Expand All @@ -534,10 +555,6 @@ void command_config(char *command, char *param1, char *param2, char *param3)
} else {
printf(" Force OpenFlow version: Disabled\r\n");
}
if (masterselect == true) printf(" Stacking Select: SLAVE\r\n");
if (masterselect == false) printf(" Stacking Select: MASTER\r\n");
if (stackenabled == true) printf(" Stacking Status: Enabled\r\n");
if (stackenabled == false) printf(" Stacking Select: Disabled\r\n");
if (Zodiac_Config.ethtype_filter == 1) printf(" EtherType Filtering: Enabled\r\n");
if (Zodiac_Config.ethtype_filter != 1) printf(" EtherType Filtering: Disabled\r\n");
printf("\r\n-------------------------------------------------------------------------\r\n\n");
Expand Down Expand Up @@ -1540,7 +1557,7 @@ void command_openflow(char *command, char *param1, char *param2, char *param3)
}
else if(ptr_band->type == OFPMBT13_DSCP_REMARK)
{
printf("DSCP REMARK (unsupported)\r\n");
printf("DSCP REMARK\r\n");
}
else
{
Expand All @@ -1549,6 +1566,11 @@ void command_openflow(char *command, char *param1, char *param2, char *param3)
printf("\t\t Rate:\t\t%d\t\r\n", ptr_band->rate);
printf("\t\t Burst Size:\t%d\t\r\n", ptr_band->burst_size);

if(ptr_band->type == OFPMBT13_DSCP_REMARK)
{
printf("\t\t Precedence:\t+%d\t\r\n", ((struct ofp13_meter_band_dscp_remark*)ptr_band)->prec_level);
}

// Find band index
int band_index = ((uint8_t*)ptr_band - (uint8_t*)&(meter_entry[meter_index]->bands)) / sizeof(struct ofp13_meter_band_drop);

Expand Down Expand Up @@ -1611,12 +1633,6 @@ void command_debug(char *command, char *param1, char *param2, char *param3)
return;
}

if (strcmp(command, "spi")==0)
{
//stack_write(atoi(param1));
return;
}

if (strcmp(command, "mem")==0)
{
printf("mem total: %d\r\n", membag_get_total());
Expand Down Expand Up @@ -1670,10 +1686,12 @@ void printhelp(void)
printf(" config\r\n");
printf(" openflow\r\n");
printf(" debug\r\n");
printf(" show ports\r\n");
printf(" update\r\n");
printf(" show status\r\n");
printf(" show version\r\n");
printf(" show ports\r\n");
printf(" restart\r\n");
printf(" help\r\n");
printf("\r\n");
printf("Config:\r\n");
printf(" save\r\n");
Expand All @@ -1693,13 +1711,14 @@ void printhelp(void)
printf(" set vlan-type <vlan id> <openflow|native>\r\n");
printf(" add vlan-port <vlan id> <port>\r\n");
printf(" delete vlan-port <port>\r\n");
printf(" factory reset\r\n");
printf(" set of-version <version(0|1|4)>\r\n");
printf(" set ethertype-filter <enable|disable>\r\n");
printf(" factory reset\r\n");
printf(" exit\r\n");
printf("\r\n");
printf("OpenFlow:\r\n");
printf(" show status\r\n");
printf(" show tables\r\n");
printf(" show flows\r\n");
printf(" show meters\r\n");
printf(" enable\r\n");
Expand Down
1 change: 1 addition & 0 deletions ZodiacFX/src/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,6 @@ typedef struct arp_header {

void task_command(char *str, char * str_last);
void loadConfig(void);
void software_reset(void);

#endif /* COMMANDS_H_ */
4 changes: 3 additions & 1 deletion ZodiacFX/src/config/config_zodiac.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#define CONFIG_ZODIAC_H_


#define VERSION "0.80" // Firmware version number
#define VERSION "0.81" // Firmware version number

#define TOTAL_PORTS 4 // Total number of physical ports on the Zodiac FX

#define MAX_OFP_VERSION 0x04

Expand Down
Loading

0 comments on commit 3e983a9

Please sign in to comment.