X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvhost%2Fmain.c;h=ab649bf147e16b3267a6a2b4e337f47f0598408a;hb=2d20636989c8935efa36bf03cb18645c2460d7b5;hp=d7b34b3d411bc025f1049b8c3ba7a8b0d77d681a;hpb=35b2d13fd6fdcbd191f2a30d74648faeb1186c65;p=dpdk.git diff --git a/examples/vhost/main.c b/examples/vhost/main.c index d7b34b3d41..ab649bf147 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -228,7 +228,14 @@ port_init(uint16_t port) uint16_t q; /* The max pool number from dev_info will be used to validate the pool number specified in cmd line */ - rte_eth_dev_info_get (port, &dev_info); + retval = rte_eth_dev_info_get(port, &dev_info); + if (retval != 0) { + RTE_LOG(ERR, VHOST_PORT, + "Error during getting device (port %u) info: %s\n", + port, strerror(-retval)); + + return retval; + } rxconf = &dev_info.default_rxconf; txconf = &dev_info.default_txconf; @@ -329,10 +336,24 @@ port_init(uint16_t port) return retval; } - if (promiscuous) - rte_eth_promiscuous_enable(port); + if (promiscuous) { + retval = rte_eth_promiscuous_enable(port); + if (retval != 0) { + RTE_LOG(ERR, VHOST_PORT, + "Failed to enable promiscuous mode on port %u: %s\n", + port, rte_strerror(-retval)); + return retval; + } + } + + retval = rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]); + if (retval < 0) { + RTE_LOG(ERR, VHOST_PORT, + "Failed to get MAC address on port %u: %s\n", + port, rte_strerror(-retval)); + return retval; + } - rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]); RTE_LOG(INFO, VHOST_PORT, "Max virtio devices supported: %u\n", num_devices); RTE_LOG(INFO, VHOST_PORT, "Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", @@ -858,15 +879,15 @@ get_psd_sum(void *l3_hdr, uint64_t ol_flags) { if (ol_flags & PKT_TX_IPV4) return rte_ipv4_phdr_cksum(l3_hdr, ol_flags); - else /* assume ethertype == RTE_ETHER_TYPE_IPv6 */ + else /* assume ethertype == RTE_ETHER_TYPE_IPV6 */ return rte_ipv6_phdr_cksum(l3_hdr, ol_flags); } static void virtio_tx_offload(struct rte_mbuf *m) { void *l3_hdr; - struct ipv4_hdr *ipv4_hdr = NULL; - struct tcp_hdr *tcp_hdr = NULL; + struct rte_ipv4_hdr *ipv4_hdr = NULL; + struct rte_tcp_hdr *tcp_hdr = NULL; struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); @@ -878,7 +899,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) m->ol_flags |= PKT_TX_IP_CKSUM; } - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + m->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + m->l3_len); tcp_hdr->cksum = get_psd_sum(l3_hdr, m->ol_flags); }