git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
crypto/dpaa_sec: support out of place buffers
[dpdk.git]
/
examples
/
link_status_interrupt
/
main.c
diff --git
a/examples/link_status_interrupt/main.c
b/examples/link_status_interrupt/main.c
index
25da28e
..
9d562f8
100644
(file)
--- a/
examples/link_status_interrupt/main.c
+++ b/
examples/link_status_interrupt/main.c
@@
-37,7
+37,6
@@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <string.h>
#include <sys/queue.h>
#include <netinet/in.h>
#include <setjmp.h>
#include <sys/queue.h>
#include <netinet/in.h>
#include <setjmp.h>
@@
-53,7
+52,6
@@
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_eal.h>
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_eal.h>
-#include <rte_per_lcore.h>
#include <rte_launch.h>
#include <rte_atomic.h>
#include <rte_cycles.h>
#include <rte_launch.h>
#include <rte_atomic.h>
#include <rte_cycles.h>
@@
-147,7
+145,7
@@
print_stats(void)
{
struct rte_eth_link link;
uint64_t total_packets_dropped, total_packets_tx, total_packets_rx;
{
struct rte_eth_link link;
uint64_t total_packets_dropped, total_packets_tx, total_packets_rx;
- u
nsigned
portid;
+ u
int16_t
portid;
total_packets_dropped = 0;
total_packets_tx = 0;
total_packets_dropped = 0;
total_packets_tx = 0;
@@
-167,7
+165,7
@@
print_stats(void)
continue;
memset(&link, 0, sizeof(link));
continue;
memset(&link, 0, sizeof(link));
- rte_eth_link_get_nowait(
(uint8_t)
portid, &link);
+ rte_eth_link_get_nowait(portid, &link);
printf("\nStatistics for port %u ------------------------------"
"\nLink status: %25s"
"\nLink speed: %26u"
printf("\nStatistics for port %u ------------------------------"
"\nLink status: %25s"
"\nLink speed: %26u"
@@
-469,14
+467,16
@@
lsi_parse_args(int argc, char **argv)
* Pointer to(address of) the parameters.
*
* @return
* Pointer to(address of) the parameters.
*
* @return
- *
void
.
+ *
int
.
*/
*/
-static void
-lsi_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
+static int
+lsi_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param,
+ void *ret_param)
{
struct rte_eth_link link;
RTE_SET_USED(param);
{
struct rte_eth_link link;
RTE_SET_USED(param);
+ RTE_SET_USED(ret_param);
printf("\n\nIn registered callback...\n");
printf("Event type: %s\n", type == RTE_ETH_EVENT_INTR_LSC ? "LSC interrupt" : "unknown event");
printf("\n\nIn registered callback...\n");
printf("Event type: %s\n", type == RTE_ETH_EVENT_INTR_LSC ? "LSC interrupt" : "unknown event");
@@
-488,15
+488,18
@@
lsi_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
("full-duplex") : ("half-duplex"));
} else
printf("Port %d Link Down\n\n", port_id);
("full-duplex") : ("half-duplex"));
} else
printf("Port %d Link Down\n\n", port_id);
+
+ return 0;
}
/* Check the link status of all ports in up to 9s, and print them finally */
static void
}
/* Check the link status of all ports in up to 9s, and print them finally */
static void
-check_all_ports_link_status(uint
8
_t port_num, uint32_t port_mask)
+check_all_ports_link_status(uint
16
_t port_num, uint32_t port_mask)
{
#define CHECK_INTERVAL 100 /* 100ms */
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
{
#define CHECK_INTERVAL 100 /* 100ms */
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
- uint8_t portid, count, all_ports_up, print_flag = 0;
+ uint8_t count, all_ports_up, print_flag = 0;
+ uint16_t portid;
struct rte_eth_link link;
printf("\nChecking link status");
struct rte_eth_link link;
printf("\nChecking link status");
@@
-511,14
+514,13
@@
check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
- printf(
"Port %d Link Up - speed %u "
-
"Mbps - %s\n", (uint8_t)portid
,
-
(unsigned)
link.link_speed,
+ printf(
+
"Port%d Link Up. Speed %u Mbps - %s\n"
,
+
portid,
link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex\n"));
else
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex\n"));
else
- printf("Port %d Link Down\n",
- (uint8_t)portid);
+ printf("Port %d Link Down\n", portid);
continue;
}
/* clear all_ports_up flag if any link down */
continue;
}
/* clear all_ports_up flag if any link down */
@@
-551,8
+553,8
@@
main(int argc, char **argv)
struct lcore_queue_conf *qconf;
struct rte_eth_dev_info dev_info;
int ret;
struct lcore_queue_conf *qconf;
struct rte_eth_dev_info dev_info;
int ret;
- uint
8
_t nb_ports;
- uint
8
_t portid, portid_last = 0;
+ uint
16
_t nb_ports;
+ uint
16
_t portid, portid_last = 0;
unsigned lcore_id, rx_lcore_id;
unsigned nb_ports_in_mask = 0;
unsigned lcore_id, rx_lcore_id;
unsigned nb_ports_in_mask = 0;
@@
-646,6
+648,13
@@
main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%u\n",
ret, (unsigned) portid);
rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%u\n",
ret, (unsigned) portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%u\n",
+ ret, (unsigned) portid);
+
/* register lsi interrupt callback, need to be after
* rte_eth_dev_configure(). if (intr_conf.lsc == 0), no
* lsc interrupt will be present, and below callback to
/* register lsi interrupt callback, need to be after
* rte_eth_dev_configure(). if (intr_conf.lsc == 0), no
* lsc interrupt will be present, and below callback to