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;
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",
TAILQ_FOREACH(vdev, &vhost_dev_list, global_vdev_entry) {
if (vdev->ready == DEVICE_RX &&
- is_same_ether_addr(mac, &vdev->mac_address))
+ rte_is_same_ether_addr(mac, &vdev->mac_address))
return vdev;
}
return -1;
}
- for (i = 0; i < ETHER_ADDR_LEN; i++)
+ for (i = 0; i < RTE_ETHER_ADDR_LEN; i++)
vdev->mac_address.addr_bytes[i] = pkt_hdr->s_addr.addr_bytes[i];
/* vlan_tag currently uses the device_id. */
{
if (ol_flags & PKT_TX_IPV4)
return rte_ipv4_phdr_cksum(l3_hdr, ol_flags);
- else /* assume ethertype == 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 *);
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);
}
nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
- if (unlikely(is_broadcast_ether_addr(&nh->d_addr))) {
+ if (unlikely(rte_is_broadcast_ether_addr(&nh->d_addr))) {
struct vhost_dev *vdev2;
TAILQ_FOREACH(vdev2, &vhost_dev_list, global_vdev_entry) {
tx_q = &lcore_tx_queue[lcore_id];
nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
- if (unlikely(nh->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN))) {
+ if (unlikely(nh->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN))) {
/* Guest has inserted the vlan tag. */
struct rte_vlan_hdr *vh = (struct rte_vlan_hdr *) (nh + 1);
uint16_t vlan_tag_be = rte_cpu_to_be_16(vlan_tag);