The return value of rte_eth_macaddr_get() was changed from void to int.
Update the usage of the functions according to the new return type.
Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
return ret;
}
- rte_eth_macaddr_get(port_id, &bbdev_port_eth_addr);
+ ret = rte_eth_macaddr_get(port_id, &bbdev_port_eth_addr);
+ if (ret < 0) {
+ printf("rte_eth_macaddr_get: err=%d, queue=%u\n",
+ ret, q);
+ return -1;
+ }
+
print_mac(port_id, &bbdev_port_eth_addr);
return 0;
struct rte_ether_addr addr;
- rte_eth_macaddr_get(portid, &addr);
+ retval = rte_eth_macaddr_get(portid, &addr);
+ if (retval != 0)
+ rte_exit(retval,
+ "Mac address get port %d failed (res=%d)",
+ portid, retval);
+
printf("Port %u MAC: ", portid);
PRINT_MAC(addr);
printf("\n");
struct rte_ether_addr addr;
- rte_eth_macaddr_get(BOND_PORT, &addr);
+ retval = rte_eth_macaddr_get(BOND_PORT, &addr);
+ if (retval != 0)
+ rte_exit(retval, "port %u: Mac address get failed (res=%d)",
+ BOND_PORT, retval);
+
printf("Port %u MAC: ", (unsigned)BOND_PORT);
PRINT_MAC(addr);
printf("\n");
struct rte_mbuf *pkts[MAX_PKT_BURST] __rte_cache_aligned;
struct rte_ether_addr d_addr;
+ struct rte_ether_addr bond_mac_addr;
struct rte_ether_hdr *eth_hdr;
struct rte_arp_hdr *arp_hdr;
struct rte_ipv4_hdr *ipv4_hdr;
uint32_t bond_ip;
int i = 0;
uint8_t is_free;
+ int ret;
bond_ip = BOND_IP_1 | (BOND_IP_2 << 8) |
(BOND_IP_3 << 16) | (BOND_IP_4 << 24);
continue;
}
+ ret = rte_eth_macaddr_get(BOND_PORT, &bond_mac_addr);
+ if (ret != 0) {
+ printf("Bond (port %u) MAC address get failed: %s.\n"
+ "%u packets dropped", BOND_PORT, strerror(-ret),
+ rx_cnt);
+ rte_pktmbuf_free(pkts[i]);
+ continue;
+ }
+
/* Search incoming data for ARP packets and prepare response */
for (i = 0; i < rx_cnt; i++) {
if (rte_spinlock_trylock(&global_flag_stru_p->lock) == 1) {
arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY);
/* Switch src and dst data and set bonding MAC */
rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr);
- rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr);
+ rte_ether_addr_copy(&bond_mac_addr, ð_hdr->s_addr);
rte_ether_addr_copy(&arp_hdr->arp_data.arp_sha,
&arp_hdr->arp_data.arp_tha);
arp_hdr->arp_data.arp_tip = arp_hdr->arp_data.arp_sip;
- rte_eth_macaddr_get(BOND_PORT, &d_addr);
+ rte_ether_addr_copy(&bond_mac_addr, &d_addr);
rte_ether_addr_copy(&d_addr, &arp_hdr->arp_data.arp_sha);
arp_hdr->arp_data.arp_sip = bond_ip;
rte_eth_tx_burst(BOND_PORT, 0, &pkts[i], 1);
ipv4_hdr = (struct rte_ipv4_hdr *)((char *)(eth_hdr + 1) + offset);
if (ipv4_hdr->dst_addr == bond_ip) {
rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr);
- rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr);
+ rte_ether_addr_copy(&bond_mac_addr, ð_hdr->s_addr);
ipv4_hdr->dst_addr = ipv4_hdr->src_addr;
ipv4_hdr->src_addr = bond_ip;
rte_eth_tx_burst(BOND_PORT, 0, &pkts[i], 1);
struct cmd_obj_send_result *res = parsed_result;
char ip_str[INET6_ADDRSTRLEN];
+ struct rte_ether_addr bond_mac_addr;
struct rte_mbuf *created_pkt;
struct rte_ether_hdr *eth_hdr;
struct rte_arp_hdr *arp_hdr;
uint32_t bond_ip;
size_t pkt_size;
+ int ret;
if (res->ip.family == AF_INET)
get_string(res, ip_str, INET_ADDRSTRLEN);
bond_ip = BOND_IP_1 | (BOND_IP_2 << 8) |
(BOND_IP_3 << 16) | (BOND_IP_4 << 24);
+ ret = rte_eth_macaddr_get(BOND_PORT, &bond_mac_addr);
+ if (ret != 0) {
+ cmdline_printf(cl,
+ "Failed to get bond (port %u) MAC address: %s\n",
+ BOND_PORT, strerror(-ret));
+ }
+
created_pkt = rte_pktmbuf_alloc(mbuf_pool);
if (created_pkt == NULL) {
cmdline_printf(cl, "Failed to allocate mbuf\n");
created_pkt->pkt_len = pkt_size;
eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *);
- rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr);
+ rte_ether_addr_copy(&bond_mac_addr, ð_hdr->s_addr);
memset(ð_hdr->d_addr, 0xFF, RTE_ETHER_ADDR_LEN);
eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP);
arp_hdr->arp_plen = sizeof(uint32_t);
arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REQUEST);
- rte_eth_macaddr_get(BOND_PORT, &arp_hdr->arp_data.arp_sha);
+ rte_ether_addr_copy(&bond_mac_addr, &arp_hdr->arp_data.arp_sha);
arp_hdr->arp_data.arp_sip = bond_ip;
memset(&arp_hdr->arp_data.arp_tha, 0, RTE_ETHER_ADDR_LEN);
arp_hdr->arp_data.arp_tip =
uint16_t slaves[16] = {0};
uint8_t len = 16;
struct rte_ether_addr addr;
- uint16_t i = 0;
+ uint16_t i;
+ int ret;
+
+ for (i = 0; i < slaves_count; i++) {
+ ret = rte_eth_macaddr_get(i, &addr);
+ if (ret != 0) {
+ cmdline_printf(cl,
+ "Failed to get port %u MAC address: %s\n",
+ i, strerror(-ret));
+ continue;
+ }
- while (i < slaves_count) {
- rte_eth_macaddr_get(i, &addr);
PRINT_MAC(addr);
printf("\n");
- i++;
}
rte_spinlock_trylock(&global_flag_stru_p->lock);
}
struct rte_ether_addr addr;
- rte_eth_macaddr_get(port, &addr);
+ retval = rte_eth_macaddr_get(port, &addr);
+ if (retval < 0) {
+ printf("Failed to get MAC address (port %u): %s\n",
+ port, rte_strerror(-retval));
+ return retval;
+ }
+
printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
port,
"%s:%i: rte_eth_dev_start failed",
__FILE__, __LINE__
);
- rte_eth_macaddr_get(idx_port, &ptr_port->mac_addr);
+ ret = rte_eth_macaddr_get(idx_port, &ptr_port->mac_addr);
+ if (ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_macaddr_get failed (port %u): %s\n",
+ idx_port, rte_strerror(-ret));
+
rte_spinlock_init(&ptr_port->lock);
}
}
uint16_t cnt_sent;
uint16_t idx_port;
uint16_t lock_result;
+ int ret;
while (app_cfg.exit_now == 0) {
for (idx_port = 0; idx_port < app_cfg.cnt_ports; idx_port++) {
/* MAC address was updated */
if (ptr_port->port_dirty == 1) {
- rte_eth_macaddr_get(ptr_port->idx_port,
+ ret = rte_eth_macaddr_get(ptr_port->idx_port,
&ptr_port->mac_addr);
+ if (ret != 0) {
+ rte_spinlock_unlock(&ptr_port->lock);
+ printf("Failed to get MAC address (port %u): %s",
+ ptr_port->idx_port,
+ rte_strerror(-ret));
+ return ret;
+ }
+
ptr_port->port_dirty = 0;
}
int
rte_ethtool_net_get_mac_addr(uint16_t port_id, struct rte_ether_addr *addr)
{
+ int ret;
+
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
if (addr == NULL)
return -EINVAL;
- rte_eth_macaddr_get(port_id, addr);
+
+ ret = rte_eth_macaddr_get(port_id, addr);
+ if (ret != 0)
+ return ret;
return 0;
}
/* Display the port MAC address. */
struct rte_ether_addr addr;
- rte_eth_macaddr_get(port, &addr);
+ retval = rte_eth_macaddr_get(port, &addr);
+ if (retval != 0) {
+ printf("Failed to get MAC address (port %u): %s\n",
+ port, rte_strerror(-retval));
+ return retval;
+ }
+
printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
" %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
(unsigned int)port,
return retval;
/* Display the port MAC address. */
- rte_eth_macaddr_get(port, &addr);
+ retval = rte_eth_macaddr_get(port, &addr);
+ if (retval != 0)
+ return retval;
+
printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
" %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
port,
ret, portid);
}
- rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ if (ret < 0) {
+ printf("\n");
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_macaddr_get: err=%d, port=%d\n",
+ ret, portid);
+ }
+
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf("\n");
memset(&stats, 0, sizeof(stats));
rte_eth_stats_get(link->port_id, &stats);
- rte_eth_macaddr_get(link->port_id, &mac_addr);
+ ret = rte_eth_macaddr_get(link->port_id, &mac_addr);
+ if (ret != 0) {
+ snprintf(out, out_size, "\n%s: MAC address get failed: %s",
+ link->name, rte_strerror(-ret));
+ return;
+ }
+
ret = rte_eth_link_get(link->port_id, ð_link);
if (ret < 0) {
snprintf(out, out_size, "\n%s: link get failed: %s",
ret, portid);
}
- rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ if (ret < 0) {
+ printf("\n");
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_macaddr_get: err=%d, port=%d\n",
+ ret, portid);
+ }
+
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf("\n");
printf("Configuring device port %u:\n", portid);
- rte_eth_macaddr_get(portid, ðaddr);
+ ret = rte_eth_macaddr_get(portid, ðaddr);
+ if (ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "Error getting MAC address (port %u): %s\n",
+ portid, rte_strerror(-ret));
+
ethaddr_tbl[portid].src = ETHADDR_TO_UINT64(ðaddr);
print_ethaddr("Address: ", ðaddr);
printf("\n");
"Cannot adjust number of descriptors: err=%d, port=%d\n",
ret, portid);
- rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot get MAC address: err=%d, port=%d\n",
+ ret, portid);
+
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
port_id, strerror(-ret));
/* Get the interface default mac address */
- rte_eth_macaddr_get(port_id,
+ ret = rte_eth_macaddr_get(port_id,
(struct rte_ether_addr *)&conf.mac_addr);
+ if (ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "Failed to get MAC address (port %u): %s\n",
+ port_id, rte_strerror(-ret));
rte_eth_dev_get_mtu(port_id, &conf.mtu);
/* Display the port MAC address. */
struct rte_ether_addr addr;
- rte_eth_macaddr_get(port, &addr);
+ retval = rte_eth_macaddr_get(port, &addr);
+ if (retval < 0)
+ return retval;
+
printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
" %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
port,
return -1;
}
- rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]);
+ retval = rte_eth_macaddr_get(portid,
+ &l2fwd_ports_eth_addr[portid]);
+ if (retval < 0) {
+ printf("rte_eth_macaddr_get :err=%d, port=%u\n",
+ retval, portid);
+ return -1;
+ }
printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
portid,
"Cannot adjust number of descriptors: err=%d, port=%u\n",
ret, portid);
- rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid,
+ &l2fwd_ports_eth_addr[portid]);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot get MAC address: err=%d, port=%u\n",
+ ret, portid);
/* init one RX queue */
fflush(stdout);
"Cannot adjust number of descriptors: err=%d, port=%u\n",
ret, portid);
- rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid,
+ &l2fwd_ports_eth_addr[portid]);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot mac address: err=%d, port=%u\n",
+ ret, portid);
/* init one RX queue */
fflush(stdout);
"Cannot adjust number of descriptors: err=%d, port=%u\n",
ret, portid);
- rte_eth_macaddr_get(portid,&l2fwd_ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid,
+ &l2fwd_ports_eth_addr[portid]);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot get MAC address: err=%d, port=%u\n",
+ ret, portid);
/* init one RX queue */
fflush(stdout);
"rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%d\n",
ret, portid);
- rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_macaddr_get: err=%d, port=%d\n",
+ ret, portid);
+
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
"Cannot adjust number of descriptors: err=%d, port=%d\n",
ret, portid);
- rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot get MAC address: err=%d, port=%d\n",
+ ret, portid);
+
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
"Cannot adjust number of descriptors: err=%d, port=%d\n",
ret, portid);
- rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot get MAC address: err=%d, port=%d\n",
+ ret, portid);
+
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
"Cannot adjust number of descriptors: err=%d, "
"port=%d\n", ret, portid);
- rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot get MAC address: err=%d, port=%d\n",
+ ret, portid);
+
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
print_ethaddr("Destination:",
rte_eth_dev_callback_register(portid,
RTE_ETH_EVENT_INTR_LSC, lsi_event_callback, NULL);
- rte_eth_macaddr_get(portid,
+ ret = rte_eth_macaddr_get(portid,
&lsi_ports_eth_addr[portid]);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_macaddr_get: err=%d, port=%u\n",
+ ret, (unsigned int)portid);
/* init one RX queue */
fflush(stdout);
{
static const char err_address[] = "00:00:00:00:00:00";
static char addresses[RTE_MAX_ETHPORTS][sizeof(err_address)];
+ int ret;
if (unlikely(port >= RTE_MAX_ETHPORTS))
return err_address;
if (unlikely(addresses[port][0]=='\0')){
struct rte_ether_addr mac;
- rte_eth_macaddr_get(port, &mac);
+ ret = rte_eth_macaddr_get(port, &mac);
+ if (ret != 0) {
+ printf("Failed to get MAC address (port %u): %s\n",
+ port, rte_strerror(-ret));
+ return err_address;
+ }
snprintf(addresses[port], sizeof(addresses[port]),
"%02x:%02x:%02x:%02x:%02x:%02x\n",
mac.addr_bytes[0], mac.addr_bytes[1], mac.addr_bytes[2],
if (ret < 0)
return ret;
- rte_eth_macaddr_get(port_id, &addr);
+ ret = rte_eth_macaddr_get(port_id, &addr);
+ if (ret != 0) {
+ printf("Failed to get MAC address (port %u): %s\n",
+ port_id, rte_strerror(-ret));
+ return ret;
+ }
+
printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
port_id,
"rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%d\n",
ret, portid);
- rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_macaddr_get: err=%d, port=%d\n",
+ ret, portid);
+
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
print_ethaddr("Destination:",
parse_fup(struct ptpv2_data_slave_ordinary *ptp_data)
{
struct rte_ether_hdr *eth_hdr;
+ struct rte_ether_addr eth_addr;
struct ptp_header *ptp_hdr;
struct clock_id *client_clkid;
struct ptp_message *ptp_msg;
size_t pkt_size;
int wait_us;
struct rte_mbuf *m = ptp_data->m;
+ int ret;
eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *)
(((uint64_t)ntohs(origin_tstamp->sec_msb)) << 32);
if (ptp_data->seqID_FOLLOWUP == ptp_data->seqID_SYNC) {
+ ret = rte_eth_macaddr_get(ptp_data->portid, ð_addr);
+ if (ret != 0) {
+ printf("\nCore %u: port %u failed to get MAC address: %s\n",
+ rte_lcore_id(), ptp_data->portid,
+ rte_strerror(-ret));
+ return;
+ }
created_pkt = rte_pktmbuf_alloc(mbuf_pool);
pkt_size = sizeof(struct rte_ether_hdr) +
created_pkt->data_len = pkt_size;
created_pkt->pkt_len = pkt_size;
eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *);
- rte_eth_macaddr_get(ptp_data->portid, ð_hdr->s_addr);
+ rte_ether_addr_copy(ð_addr, ð_hdr->s_addr);
/* Set multicast address 01-1B-19-00-00-00. */
rte_ether_addr_copy(ð_multicast, ð_hdr->d_addr);
struct ether_fc_frame *pause_frame;
struct rte_ether_hdr *hdr;
struct rte_ether_addr mac_addr;
+ int ret;
RTE_LOG_DP(DEBUG, USER1,
"Sending PAUSE frame (duration=%d) on port %d\n",
duration, port_id);
+ ret = rte_eth_macaddr_get(port_id, &mac_addr);
+ if (ret != 0) {
+ RTE_LOG_DP(ERR, USER1,
+ "Failed to get MAC address (port %u): %s\n",
+ port_id, rte_strerror(-ret));
+ return;
+ }
+
/* Get a mbuf from the pool */
mbuf = rte_pktmbuf_alloc(mbuf_pool);
if (unlikely(mbuf == NULL))
hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *);
pause_frame = (struct ether_fc_frame *) &hdr[1];
- rte_eth_macaddr_get(port_id, &mac_addr);
rte_ether_addr_copy(&mac_addr, &hdr->s_addr);
void *tmp = &hdr->d_addr.addr_bytes[0];
struct rte_ether_addr addr;
- rte_eth_macaddr_get(port, &addr);
+ retval = rte_eth_macaddr_get(port, &addr);
+ if (retval < 0) {
+ printf("Failed to get MAC address on port %u: %s\n",
+ port, rte_strerror(-retval));
+ return retval;
+ }
printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
(unsigned)port,
static const char err_address[] = "00:00:00:00:00:00";
static char addresses[RTE_MAX_ETHPORTS][sizeof(err_address)];
struct rte_ether_addr mac;
+ int ret;
if (unlikely(port >= RTE_MAX_ETHPORTS))
return err_address;
if (unlikely(addresses[port][0] == '\0')) {
- rte_eth_macaddr_get(port, &mac);
+ ret = rte_eth_macaddr_get(port, &mac);
+ if (ret != 0) {
+ printf("Failed to get MAC address (port %u): %s\n",
+ port, rte_strerror(-ret));
+ return err_address;
+ }
+
snprintf(addresses[port], sizeof(addresses[port]),
"%02x:%02x:%02x:%02x:%02x:%02x\n",
mac.addr_bytes[0], mac.addr_bytes[1],
/* Display the port MAC address. */
struct rte_ether_addr addr;
- rte_eth_macaddr_get(port, &addr);
+ retval = rte_eth_macaddr_get(port, &addr);
+ if (retval != 0)
+ return retval;
+
printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
" %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
port,
retval = rte_eth_dev_udp_tunnel_port_add(port, &tunnel_udp);
if (retval < 0)
return retval;
- rte_eth_macaddr_get(port, &ports_eth_addr[port]);
+ retval = rte_eth_macaddr_get(port, &ports_eth_addr[port]);
+ if (retval < 0)
+ return retval;
+
RTE_LOG(INFO, PORT, "Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
port,
}
}
- rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]);
+ 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_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",
int i, cnt, idx;
policy = get_policy();
- set_policy_defaults(policy);
+ ret = set_policy_defaults(policy);
+ if (ret != 0) {
+ printf("Failed to set policy defaults\n");
+ return -1;
+ }
argvopt = argv;
for (i = 0; i < MAX_VCPU_PER_VM; i++) {
if (ports[i]) {
printf("***Using port %d\n", i);
- set_policy_mac(i, idx++);
+ if (set_policy_mac(i, idx++) != 0) {
+ printf("Cannot set policy MAC");
+ return -1;
+ }
}
}
policy->nb_mac_to_monitor = idx;
{
struct channel_packet *policy;
union PFID pfid;
+ int ret;
/* Use port MAC address as the vfid */
- rte_eth_macaddr_get(port, &pfid.addr);
+ ret = rte_eth_macaddr_get(port, &pfid.addr);
+ if (retval != 0) {
+ printf("Failed to get device (port %u) MAC address: %s\n",
+ port, rte_strerror(-retval));
+ return retval;
+ }
printf("Port %u MAC: %02" PRIx8 ":%02" PRIx8 ":%02" PRIx8 ":"
"%02" PRIx8 ":%02" PRIx8 ":%02" PRIx8 "\n",
return 0;
}
-void
+int
set_policy_defaults(struct channel_packet *pkt)
{
- set_policy_mac(0, 0);
+ int ret;
+
+ ret = set_policy_mac(0, 0);
+ if (ret != 0)
+ return ret;
+
pkt->nb_mac_to_monitor = 1;
pkt->t_boost_status.tbEnabled = false;
int set_policy_mac(int port, int idx);
-void set_policy_defaults(struct channel_packet *pkt);
+int set_policy_defaults(struct channel_packet *pkt);
void run_cli(__attribute__((unused)) void *arg);
/* Display the port MAC address. */
struct rte_ether_addr addr;
- rte_eth_macaddr_get(port, &addr);
+ retval = rte_eth_macaddr_get(port, &addr);
+ if (retval != 0) {
+ printf("Failed to get device (port %u) MAC address: %s\n",
+ port, rte_strerror(-retval));
+ return retval;
+ }
+
printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
" %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
(unsigned int)port,
return retval;
}
- rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]);
+ retval = rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]);
+ if (retval < 0) {
+ printf("port %d MAC address get failed: %s\n", port,
+ rte_strerror(-retval));
+ return retval;
+ }
printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
(unsigned)port,
return retval;
}
- rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]);
+ retval = rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]);
+ if (retval < 0) {
+ printf("port %d MAC address get failed: %s\n", port,
+ rte_strerror(-retval));
+ return retval;
+ }
printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
(unsigned)port,