]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp-test-sw/commands/cmd_netstats.c
e154c4592916c24044acd16a26eef874549db56a
[pes-rpp/rpp-test-sw.git] / rpp-test-sw / commands / cmd_netstats.c
1 /*
2  * Copyright (C) 2012-2013 Czech Technical University in Prague
3  *
4  * Created on: Aug 23, 2013
5  *
6  * Authors:
7  *     - Jan Dolezal <pm.jenik@gmail.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  * File : cmd_netstats.c
23  *
24  * Abstract:
25  *      This file contains commands for net statistics (ethernet interface and LwIP)
26  *
27  */
28
29 #include "cmd_netstats.h"
30
31 #ifndef DOCGEN
32
33 #include <string.h>
34
35 #include "rpp/rpp.h"
36 #include "drv/emac.h"
37 #include "lwip/opt.h"
38 #include "lwip/stats.h"
39
40 #define INTERFACE_INSTANCE_NUMBER 0
41
42 int cmd_do_read_linkstat(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
43 {
44         if (!isPostInitialized()) {
45                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
46                 return FAILURE;
47         }
48         struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
49         if (rpp_eth_phylinkstat(INTERFACE_INSTANCE_NUMBER))
50                 rpp_sci_printf("%c%c%d : UP\r\n", netif->name[0], netif->name[1], netif->num);
51         else
52                 rpp_sci_printf("%c%c%d : DOWN\r\n", netif->name[0], netif->name[1], netif->num);
53         return SUCCESS;
54 }
55
56 int cmd_do_read_mac(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
57 {
58         if (!isPostInitialized()) {
59                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
60                 return FAILURE;
61         }
62         uint8_t macaddr[18];
63         rpp_eth_get_macAddrStr(INTERFACE_INSTANCE_NUMBER,macaddr);
64         rpp_sci_printf((const char *)"%s\n", macaddr);
65         return SUCCESS;
66 }
67
68 int cmd_do_read_ip(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
69 {
70         if (!isPostInitialized()) {
71                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
72                 return FAILURE;
73         }
74         struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
75         uint8_t ipString[16];
76         rpp_eth_getIPDecimalStr(netif->ip_addr, ipString);
77         rpp_sci_printf("Address: %s\r\n", ipString);
78         rpp_eth_getIPDecimalStr(netif->netmask, ipString);
79         rpp_sci_printf("Netmask: %s\r\n", ipString);
80         rpp_eth_getIPDecimalStr(netif->gw, ipString);
81         rpp_sci_printf("Gateway: %s\r\n", ipString);
82         return SUCCESS;
83 }
84
85
86
87
88 /*      --- EMAC DESCRIPTOR FORMAT ---
89  *                                         bit fields
90  * WORD   |
91  * OFFSET | 31                               16 | 15                                 0
92  * ------------------------------------------------------------------------------------
93  *    0   |                         *Next Descriptor Pointer
94  *    1   |                           *Data Buffer Pointer
95  *    2   |            Buffer Offset            |            Buffer Length
96  *    3   |                Flags                |            Packet Length
97  *    4   |                                  *pbuf
98  */
99
100 boolean_t bd_SOP(volatile struct emac_tx_bd *bufferDescriptor)
101 {
102         return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_SOP);
103 }
104
105 boolean_t bd_EOP(volatile struct emac_tx_bd *bufferDescriptor)
106 {
107         return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_EOP);
108 }
109
110 boolean_t bd_OWNER(volatile struct emac_tx_bd *bufferDescriptor)
111 {
112         return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_OWNER);
113 }
114
115 boolean_t bd_EOQ(volatile struct emac_tx_bd *bufferDescriptor)
116 {
117         return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_EOQ);
118 }
119
120 uint32_t bd_addr(uint16_t bd_num)
121 {
122         return EMAC_CTRL_RAM_BASE_m(0) + bd_num*sizeof(struct emac_tx_bd);
123 }
124
125 volatile struct emac_tx_bd *findPreviousBD(volatile struct emac_tx_bd *bufferDescriptor)
126 {
127         volatile struct emac_tx_bd *temporary = bufferDescriptor - 1;
128
129         /* first try space before given bd */
130         if ((uint32_t)temporary >= EMAC_CTRL_RAM_BASE_m(0) && temporary->next == bufferDescriptor)
131                 return temporary;
132         temporary = bufferDescriptor->next;
133         while (temporary != bufferDescriptor && temporary != NULL) {
134                 if (temporary->next == bufferDescriptor)
135                         return temporary;
136                 temporary = (temporary + 1); /* going through memory, if you want to go through bd chains put here 'temporary = temporary->next;' */
137                 if ( (uint32_t)(temporary+1) > EMAC_CTRL_RAM_BASE_m(0)+SIZE_EMAC_CTRL_RAM) /* when out of CPPI RAM */
138                         temporary = (struct emac_tx_bd *)EMAC_CTRL_RAM_BASE_m(0);  /* continue scanning from the beginning */
139         }
140         return (struct emac_tx_bd *)-1;  /* not found */
141 }
142
143 void print_bd_content(volatile struct emac_tx_bd *bufferDescriptor, boolean_t humanReadable)
144 {
145         uint16_t data;
146
147         rpp_sci_printf("Buffer Descriptor at 0x%08x\n", bufferDescriptor);
148         rpp_sci_printf("Next BD:\t0x%08x\n", bufferDescriptor->next);
149         rpp_sci_printf("Data ptr:\t0x%08x\n", bufferDescriptor->bufptr);
150         rpp_sci_printf("Buf offset:\t%d\tBuf length:\t%d\n", (bufferDescriptor->bufoff_len >> 16), (bufferDescriptor->bufoff_len & 0xffff));
151         if (!humanReadable)
152                 rpp_sci_printf("Flags:\t\t0x%04x\t", (bufferDescriptor->flags_pktlen >> 16));
153         else
154         {
155                 data = bufferDescriptor->flags_pktlen;
156                 rpp_sci_printf("Flags:\t%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n", (data & EMAC_DSC_FLAG_SOP) ? "SOP" : "", (data & EMAC_DSC_FLAG_EOP) ? "EOP" : "", (data & EMAC_DSC_FLAG_OWNER) ? "OWNER" : "", (data & EMAC_DSC_FLAG_EOQ) ? "EOQ" : "", (data & EMAC_DSC_FLAG_TDOWNCMPLT) ? "TDWN" : "", (data & EMAC_DSC_FLAG_PASSCRC) ? "PSCRC" : "", (data & EMAC_DSC_FLAG_JABBER) ? "JBR" : "", (data & EMAC_DSC_FLAG_OVERSIZE) ? "OVSZ" : "", (data & EMAC_DSC_FLAG_FRAGMENT) ? "FRGM" : "", (data & EMAC_DSC_FLAG_UNDERSIZED) ? "UNSZ" : "", (data & EMAC_DSC_FLAG_CONTROL) ? "CTRL" : "", (data & EMAC_DSC_FLAG_OVERRUN) ? "OVRUN" : "", (data & EMAC_DSC_FLAG_CODEERROR) ? "CODEERR" : "", (data & EMAC_DSC_FLAG_ALIGNERROR) ? "ALGNERR" : "", (data & EMAC_DSC_FLAG_CRCERROR) ? "CRCERR" : "", (data & EMAC_DSC_FLAG_NOMATCH) ? "NOMATCH" : "");
157         }
158         rpp_sci_printf("Pkt length:\t%d\n", (bufferDescriptor->flags_pktlen & 0xffff));
159         rpp_sci_printf("Pbuf ptr:\t0x%08x\n", bufferDescriptor->pbuf);
160 }
161
162 /*
163  * mode: 0 flags -> param says which flag (0-15)
164  *       1 bd->next == NULL, no param
165  */
166 void print_bds_state(uint8_t mode, uint8_t param)
167 {
168         volatile struct emac_tx_bd *bufferDescriptor = (struct emac_tx_bd *)EMAC_CTRL_RAM_BASE_m(0);
169         uint16_t index = 0;
170
171         rpp_sci_printf("TX:");
172         while (index < 409) {
173                 if (!(index%10)) {
174                         rpp_sci_printf(" ");
175                         if (!(index%50)) rpp_sci_printf("\n");
176                 }
177                 if (index == 204)
178                         rpp_sci_printf("\nRX: ");
179                 if      (mode == 0) {
180                         if (bufferDescriptor->flags_pktlen & ((1 << 15) >> (param%16)))
181                                 rpp_sci_printf("f");
182                         else
183                                 rpp_sci_printf(".");
184                 }
185                 else if (mode == 1) {
186                         if (bufferDescriptor->next == NULL)
187                                 rpp_sci_printf("0");
188                         else
189                                 rpp_sci_printf(".");
190                 }
191                 else return;
192                 bufferDescriptor++;
193                 index++;
194         }
195         rpp_sci_printf("\n");
196 }
197
198 #define BUF_SIZE 15
199
200 unsigned long readNum(uint8_t minamount, uint8_t maxamount, boolean_t hex)
201 {
202         unsigned long out = 0;
203         uint8_t input_buffer[BUF_SIZE];
204         uint8_t buf_index = 0;
205         uint8_t input;
206
207         do {
208                 input = rpp_sci_getc();
209                 if (input == '\b' && buf_index > 0) {
210                         input_buffer[buf_index] = '\0';
211                         buf_index--;
212                         echo('\b');
213                         echo( ' ');
214                         echo('\b');
215                 }
216                 else if (buf_index >= maxamount)
217                         continue;
218                 else if (input <= '9' && input >= '0') {
219                         input_buffer[buf_index] = input - '0';
220                         echo(input);
221                         buf_index++;
222                 }
223                 else if (hex && (input <= 'f' && input >= 'a')) {
224                         input_buffer[buf_index] = input - ('a' - 10);
225                         echo(input);
226                         buf_index++;
227                 }
228                 else if (hex && (input <= 'F' && input >= 'A')) {
229                         input_buffer[buf_index] = input - ('A' - 10);
230                         echo((input + ('a' - 'A')));
231                         buf_index++;
232                 }
233         } while ( (input != '\r' && input != '\n' && buf_index < BUF_SIZE) || buf_index < minamount);
234         input = 0; /* use as index */
235         while (input < buf_index) {
236                 if (hex)
237                         out = (out << 4) + input_buffer[input];
238                 else
239                         out = (out*10) + input_buffer[input];
240                 input++;
241         }
242         return out;
243 }
244
245 int cmd_do_bufferdescriptors(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
246 {
247         uint8_t pindex;
248         uint8_t input;
249         volatile struct emac_tx_bd *bufferDescriptor;
250         boolean_t run = TRUE, interactive = FALSE, overview = FALSE;
251
252 #if RPP_ETH_STATS
253         boolean_t isrRun = FALSE, rb = FALSE, tb = FALSE;
254 #endif
255
256         /* if eth not initialized return */
257         if (!isPostInitialized()) {
258                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
259                 return FAILURE;
260         }
261
262         /* examine parameters */
263         for (pindex = 1; param[pindex] != 0; pindex++) {
264                 if        (strncmp((char *)param[pindex], "-i", 3) == 0) {
265                         interactive = TRUE;
266                         break;
267                 }
268                 else if (strncmp((char *)param[pindex], "-o", 3) == 0) {
269                         overview = TRUE;
270                         break;
271                 }
272 #if RPP_ETH_STATS
273                 else if (strncmp((char *)param[pindex], "-r", 3) == 0) {
274                         isrRun = TRUE;
275                         break;
276                 }
277                 else if (strncmp((char *)param[pindex], "-rb", 4) == 0) {
278                         rb = TRUE;
279                         break;
280                 }
281                 else if (strncmp((char *)param[pindex], "-tb", 4) == 0) {
282                         tb = TRUE;
283                         break;
284                 }
285 #endif
286         }
287         struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
288         if (netif == NULL) {
289                 rpp_sci_printf("netif err\n");
290                 return -1;
291         }
292
293         if (interactive)
294                 while (run) {
295                         input = rpp_sci_getc();
296
297                         if (input == 'b') { /* print buffer descriptor at given address */
298                                 rpp_sci_printf("-? 0x");
299                                 bufferDescriptor = (struct emac_tx_bd *)readNum(8,8,TRUE);
300                                 rpp_sci_printf("\n");
301                                 /* check it fits EMAC CPPI RAM */
302                                 /*if(bufferDescriptor >= EMAC_CTRL_RAM_BASE_m(INTERFACE_INSTANCE_NUMBER) && (bufferDescriptor + sizeof(struct emac_tx_bd)) <= EMAC_CTRL_RAM_BASE_m(INTERFACE_INSTANCE_NUMBER) + SIZE_EMAC_CTRL_RAM)
303                                    {*/
304                                 print_bd_content(bufferDescriptor, FALSE);
305                                 /*}
306                                    else
307                                    {
308                                     rpp_sci_printf("address not from BD CPPI RAM range\n");
309                                    }*/
310                                 while (1) {
311                                         input = rpp_sci_getc();
312                                         if      (input == 'n') { /* next */
313                                                 bufferDescriptor = bufferDescriptor->next;
314                                                 if (bufferDescriptor != NULL)
315                                                         print_bd_content(bufferDescriptor, FALSE);
316                                                 else {
317                                                         rpp_sci_printf("NULL\n");
318                                                         break;
319                                                 }
320                                         }
321                                         else if (input == 'p') { /* previous */
322                                                 bufferDescriptor = findPreviousBD(bufferDescriptor);
323                                                 if ((int32_t)bufferDescriptor != -1) {
324                                                         if (bufferDescriptor == NULL) {
325                                                                 rpp_sci_printf("NULL\n");
326                                                                 break;
327                                                         }
328                                                         else
329                                                                 print_bd_content(bufferDescriptor, FALSE);
330                                                 }
331                                                 else
332                                                 {
333                                                         rpp_sci_printf("not found\n");
334                                                         break;
335                                                 }
336                                         }
337                                         else if (input == 'r') { /* reprint */
338                                                 if ((int32_t)bufferDescriptor == -1 || bufferDescriptor == NULL) break;
339                                                 print_bd_content(bufferDescriptor, FALSE);
340                                         }
341                                         else break;
342                                 }
343                         }
344
345                         if      (input == 'q') { /* quit */
346                                 run = FALSE;
347                                 continue;
348                         }
349 #if RPP_ETH_STATS
350                         else if (input == 's') /* general statistics */
351                                 printStatistics();
352                         else if (input == 't') { /* print tx channel */
353                                 print_tx_channel_stat();
354                                 continue;
355                         }
356                         else if (input == 'r') { /* print rx channel */
357                                 print_rx_channel_stat();
358                                 continue;
359                         }
360 #endif
361                         else if (input == 'a') { /* autocheck consistency of buffer descriptors */
362
363                         }
364                         else if (input == 'o') { /* overview */
365                                 uint8_t mode = rpp_sci_getc() - '0';
366                                 uint8_t param = rpp_sci_getc() - '0';
367                                 print_bds_state(mode, param);
368                         }
369                         else if (input == 'c')  /* convert */
370                                 rpp_sci_printf("0x%08x", bd_addr((uint16_t)readNum(1, 3, FALSE)));
371                 }
372         else
373         {
374                 if (overview) {
375                         rpp_sci_printf(" --- OVERVIEWS ---\n");
376                         rpp_sci_printf("bd->next points to NULL\n");
377                         print_bds_state(1, 0);
378                         rpp_sci_printf("bds with EMAC_DSC_FLAG_SOP\n");
379                         print_bds_state(0, 0);
380                         rpp_sci_printf("bds with EMAC_DSC_FLAG_EOP\n");
381                         print_bds_state(0, 1);
382                         rpp_sci_printf("bds with EMAC_DSC_FLAG_OWNER\n");
383                         print_bds_state(0, 2);
384                         rpp_sci_printf("bds with EMAC_DSC_FLAG_EOQ\n");
385                         print_bds_state(0, 3);
386                         rpp_sci_printf("bds with EMAC_DSC_FLAG_TDOWNCMPLT\n");
387                         print_bds_state(0, 4);
388                         rpp_sci_printf("bds with EMAC_DSC_FLAG_PASSCRC\n");
389                         print_bds_state(0, 5);
390                         rpp_sci_printf("\nPress any key ...\r");
391                         rpp_sci_getc();
392                         /* These flags are not so much important */
393                         rpp_sci_printf("bds with EMAC_DSC_FLAG_JABBER\n");
394                         print_bds_state(0, 6);
395                         rpp_sci_printf("bds with EMAC_DSC_FLAG_OVERSIZE\n");
396                         print_bds_state(0, 7);
397                         rpp_sci_printf("bds with EMAC_DSC_FLAG_FRAGMENT\n");
398                         print_bds_state(0, 8);
399                         rpp_sci_printf("bds with EMAC_DSC_FLAG_UNDERSIZED\n");
400                         print_bds_state(0, 9);
401                         rpp_sci_printf("bds with EMAC_DSC_FLAG_CONTROL\n");
402                         print_bds_state(0, 10);
403                         rpp_sci_printf("bds with EMAC_DSC_FLAG_OVERRUN\n");
404                         print_bds_state(0, 11);
405                         rpp_sci_printf("bds with EMAC_DSC_FLAG_CODEERROR\n");
406                         print_bds_state(0, 12);
407                         rpp_sci_printf("bds with EMAC_DSC_FLAG_ALIGNERROR\n");
408                         print_bds_state(0, 13);
409                         rpp_sci_printf("bds with EMAC_DSC_FLAG_CRCERROR\n");
410                         print_bds_state(0, 14);
411                         rpp_sci_printf("bds with EMAC_DSC_FLAG_NOMATCH\n");
412                         print_bds_state(0, 15);
413                 }
414 #if RPP_ETH_STATS
415                 if (isrRun) {
416                         rpp_sci_printf(" --- NUMBER OF ISR RUNS ---\n");
417                         rpp_sci_printf("TxIsr: %d", countEMACCore0TxIsr);
418                         rpp_sci_printf("RxIsr: %d", countEMACCore0RxIsr);
419                 }
420 #endif
421
422
423         }
424         return ERR_OK;
425 }
426
427 #if LWIP_DHCP
428 int cmd_do_dhcp(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
429 {
430         if (!isPostInitialized()) {
431                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
432                 return FAILURE;
433         }
434         rpp_sci_printf("not implemented yet.");
435         return ERR_OK;
436 }
437 #endif
438
439 #if LWIP_STATS_DISPLAY
440 int cmd_do_lwip(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
441 {
442         if (!isPostInitialized()) {
443                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
444                 return FAILURE;
445         }
446         stats_display();
447         rpp_sci_printf("\n");
448         return ERR_OK;
449 }
450 #endif
451
452 int cmd_do_ethinit(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
453 {
454         int8_t retVal = rpp_eth_init_postInit(0, NULL); /* post OS startup init of eth (LwIP) for application usage -- waits for a while, for auto-negotiation of ethernet speed and DHCP if used */
455
456         switch (retVal) {
457         case FAILURE:
458                 rpp_sci_printf("already initialized\n");
459                 break;
460         case NETIF_ADD_ERR:
461                 rpp_sci_printf("initialization of physical part of ethernet failed\n");
462                 break;
463         case DHCP_MEM_ERR:
464                 rpp_sci_printf("DHCP couldn't be started due to insufficient memory\n");
465                 break;
466         case PHY_LINK_DOWN:
467                 rpp_sci_printf("cable is not connected\n");
468                 break;
469         default:
470                 rpp_sci_printf("ethinit DONE\n");
471         }
472         return retVal;
473 }
474
475 #endif  /* DOCGEN */
476
477 cmd_des_t const cmd_des_linkstat = {
478         0,0,
479         "ethlinkstat","Print current status of ethernet interface",
480
481         "### Command syntax ###\n"
482         "\n"
483         "    ethlinkstat\n"
484         "\n"
485         "### Description ###\n"
486         "\n"
487         "This command reads PHY link status assigned to ethernet interface and\n"
488         "prints interface name and informs about PHY's status to the output.\n"
489         "\n"
490         "### Example ###\n"
491         "\n"
492         "    --> ethlinkstat\n"
493         "    et0 : UP\n"
494         "\n"
495         "    --> ethlinkstat\n"
496         "    et0 : DOWN\n",
497         CMD_HANDLER(cmd_do_read_linkstat), (void *)&cmd_list_netstats
498 };
499
500 cmd_des_t const cmd_des_mac = {
501         0,0,
502         "ethmac","Print current MAC address of ethernet interface",
503
504         "### Command syntax ###\n"
505         "\n"
506         "    ethmac\n"
507         "\n"
508         "### Description ###\n"
509         "\n"
510         "This command obtains MAC address from ethernet interface structure\n"
511         "and prints it to the output.\n"
512         "\n"
513         "### Example ###\n"
514         "\n"
515         "    --> ethmac\n"
516         "    12:34:56:78:9a:bc\n",
517         CMD_HANDLER(cmd_do_read_mac), (void *)&cmd_list_netstats
518 };
519
520 cmd_des_t const cmd_des_ip = {
521         0,0,
522         "ethip","Print current IP address of network interface",
523
524         "### Command syntax ###\n"
525         "\n"
526         "    ethip\n"
527         "\n"
528         "### Description ###\n"
529         "\n"
530         "This command reads current IP address, netmask and gateway of network\n"
531         "interface and prints these to the output.\n"
532         "\n"
533         "### Example ###\n"
534         "\n"
535         "    --> ethip\n"
536         "    Address: 192.168.247.1\n"
537         "    Netmask: 255.255.255.0\n"
538         "    Gateway: 192.168.247.255\n",
539         CMD_HANDLER(cmd_do_read_ip), (void *)&cmd_list_netstats
540 };
541
542 cmd_des_t const cmd_des_bufferdescriptors = {
543         0,CDESM_SPACE_SEP,
544         "ethbd","Examine emac buffer descriptors",
545
546         "### Command syntax ###\n"
547         "\n"
548         "    ethbd\n"
549         "\n"
550         "### Description ###\n"
551         "After startup you use keys to control what will be done.\n"
552         "\n"
553         "- q - quit\n"
554         "- s - general statistics\n"
555         "- t - transmit channel status\n"
556         "- r - receive channel status\n"
557         "- b - after giving address of bd it prints bd content\n"
558         "- a - checks consistency of buffer descriptors\n"
559         "\n"
560         "\n"
561         "### Example ###\n"
562         "\n"
563         "    --> ethbd\n",
564         CMD_HANDLER(cmd_do_bufferdescriptors), (void *)&cmd_list_netstats
565 };
566
567 #if LWIP_DHCP
568 cmd_des_t const cmd_des_dhcp = {
569         0,0,
570         "dhcp","Prints and controls DHCP",
571
572         "### Command syntax ###\n"
573         "\n"
574         "    dhcp\n"
575         "\n"
576         "### Description ###\n"
577         "\n"
578         "\n"
579         ".\n"
580         "\n"
581         "### Example ###\n"
582         "\n"
583         "    --> dhcp\n"
584         "    \n",
585         CMD_HANDLER(cmd_do_dhcp), (void *)&cmd_list_netstats
586 };
587 #endif
588
589 #if LWIP_STATS_DISPLAY
590 cmd_des_t const cmd_des_lwip = {
591         0,0,
592         "lwip","Prints statistics for the LwIP stack",
593
594         "### Command syntax ###\n"
595         "\n"
596         "    lwip\n"
597         "\n"
598         "### Description ###\n"
599         "\n"
600         "Sections printed:\n"
601         "LINK\n"
602         "ETHARP\n"
603         "IP\n"
604         "ICMP\n"
605         "UDP\n"
606         "TCP\n"
607         "MEM HEAP\n"
608         "MEM RAW_PCB\n"
609         "MEM UDP_PCB\n"
610         "MEM TCP_PCB\n"
611         "MEM TCP_PCB_LISTEN\n"
612         "MEM TCP_SEB\n"
613         "MEM NETBUF\n"
614         "MEM NETCONN\n"
615         "MEM TCPIP_MSG_API\n"
616         "MEM TCPIP_MSG_INPKT\n"
617         "MEM SYS_TIMEOUT\n"
618         "MEM PBUF_REF/ROM\n"
619         "MEM PBUF_POOL\n"
620         "SYS\n"
621         ".\n"
622         "Shown sections depends on modules compiled in.\n"
623         "    \n",
624         CMD_HANDLER(cmd_do_lwip), (void *)&cmd_list_netstats
625 };
626 #endif /* if LWIP_STATS_DISPLAY */
627
628 cmd_des_t const cmd_des_ethinit = {
629         0,0,
630         "ethinit","Post OS startup eth initialization",
631
632         "### Command syntax ###\n"
633         "\n"
634         "    ethinit\n"
635         "\n"
636         "### Description ###\n"
637         "This command finishes autonegotiation of PHY and initialize LwIP stack.\n"
638         "\n"
639         "\n"
640         "### Example ###\n"
641         "\n"
642         "    --> ethinit\n"
643         "    \n",
644         CMD_HANDLER(cmd_do_ethinit), (void *)&cmd_list_netstats
645 };
646
647 /** List of commands for lwip, defined as external */
648 cmd_des_t const *cmd_list_netstats[] = {
649         &cmd_des_linkstat,
650         &cmd_des_mac,
651         &cmd_des_ip,
652         &cmd_des_bufferdescriptors,
653 #if LWIP_DHCP
654         &cmd_des_dhcp,
655 #endif
656 #if LWIP_STATS_DISPLAY
657         &cmd_des_lwip,
658 #endif
659         &cmd_des_ethinit,
660         NULL
661 };