X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fl3fwd-power%2Fmain.c;h=7f7be22c6221f17b674e743716443bfc66271a75;hb=538da7a1cad25fbdffe298c8ca76fc4dbd262d1b;hp=c07eeff10f9ff2f0732501598c59bb02ccab911c;hpb=a137d012a0dd7be982367687ea6cd10de6f12c69;p=dpdk.git diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index c07eeff10f..7f7be22c62 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -135,7 +135,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* ethernet addresses of ports */ static rte_spinlock_t locks[RTE_MAX_ETHPORTS]; @@ -373,10 +373,6 @@ signal_exit_now(int sigtype) unsigned int portid; int ret; - RTE_SET_USED(lcore_id); - RTE_SET_USED(portid); - RTE_SET_USED(ret); - if (sigtype == SIGINT) { if (empty_poll_on) empty_poll_stop = true; @@ -622,11 +618,11 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, static inline void parse_ptype_one(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; @@ -665,18 +661,18 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; void *d_addr_bytes; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -704,7 +700,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, #endif /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], + ð_hdr->s_addr); send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -714,7 +711,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -729,7 +726,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], + ð_hdr->s_addr); send_single_packet(m, dst_port); #else @@ -1388,7 +1386,7 @@ parse_ep_config(const char *q_arg) ep_med_edpi = EMPTY_POLL_MED_THRESHOLD; ep_hgh_edpi = EMPTY_POLL_MED_THRESHOLD; - snprintf(s, sizeof(s), "%s", p); + strlcpy(s, p, sizeof(s)); num_arg = rte_strsplit(s, sizeof(s), str_fld, 3, ','); @@ -1581,10 +1579,10 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -1961,7 +1959,7 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n"); if (init_power_library()) - rte_exit(EXIT_FAILURE, "init_power_library failed\n"); + RTE_LOG(ERR, L3FWD_POWER, "init_power_library failed\n"); if (update_lcore_params() < 0) rte_exit(EXIT_FAILURE, "update_lcore_params failed\n");