struct cmdline *cl,
__attribute__((unused)) void *data)
{
- cmdline_printf(cl, "History buffer size: %u\n",
+ cmdline_printf(cl, "History buffer size: %zu\n",
sizeof(cl->rdl.history_buf));
}
/* copy string to buffer */
rte_snprintf(buf, sizeof(buf), "%s",
- ether_addr_valid_strs[0]);
+ ether_addr_valid_strs[0].str);
ret = cmdline_parse_etheraddr(NULL, buf, NULL);
if (ret == -1) {
/* copy string all the way from second char up to start of _config */
rte_snprintf(prefix, size, "%.*s",
- strnlen(buf, sizeof(buf)) - sizeof("_config"), &buf[1]);
+ (int)(strnlen(buf, sizeof(buf)) - sizeof("_config")),
+ &buf[1]);
return prefix;
}
/* copy string all the way from second char up to start of _config */
rte_snprintf(prefix, size, "%.*s",
- strnlen(buf, sizeof(buf)) - sizeof("_config"), &buf[1]);
+ (int)(strnlen(buf, sizeof(buf)) - sizeof("_config")),
+ &buf[1]);
return prefix;
}
/* copy string all the way from second char up to start of _config */
rte_snprintf(prefix, size, "%.*s",
- strnlen(buf, sizeof(buf)) - sizeof("_config"), &buf[1]);
+ (int)(strnlen(buf, sizeof(buf)) - sizeof("_config")),
+ &buf[1]);
return prefix;
}
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
if (name && *name)
- rte_snprintf(ifr.ifr_name, IFNAMSIZ, name);
+ rte_snprintf(ifr.ifr_name, IFNAMSIZ, "%s", name);
ret = ioctl(fd, TUNSETIFF, (void *) &ifr);
if (ret < 0) {
}
if (name)
- rte_snprintf(name, IFNAMSIZ, ifr.ifr_name);
+ rte_snprintf(name, IFNAMSIZ, "%s", ifr.ifr_name);
return fd;
}
if (ret < 0) {
RTE_LOG(ERR, USER1,
- "Couldn't configure TX queue %hhu of "
- "port %hu\n",
+ "Couldn't configure TX queue %"PRIu16" of "
+ "port %"PRIu8"\n",
i, portid);
return (ret);
}
if (ret < 0) {
RTE_LOG(ERR, USER1,
- "Couldn't configure RX queue %hu of "
- "port %hhu\n",
+ "Couldn't configure RX queue %"PRIu16" of "
+ "port %"PRIu8"\n",
i, portid);
return (ret);
}
}
if (pconf->rx_port >= RTE_MAX_ETHPORTS) {
- RTE_LOG(ERR, APP, "pfc %u: invalid rx port %hu index\n", nb_pfc, pconf->rx_port);
+ RTE_LOG(ERR, APP, "pfc %u: invalid rx port %"PRIu8" index\n",
+ nb_pfc, pconf->rx_port);
return -1;
}
if (pconf->tx_port >= RTE_MAX_ETHPORTS) {
- RTE_LOG(ERR, APP, "pfc %u: invalid tx port %hu index\n", nb_pfc, pconf->rx_port);
+ RTE_LOG(ERR, APP, "pfc %u: invalid tx port %"PRIu8" index\n",
+ nb_pfc, pconf->rx_port);
return -1;
}
mask = 1lu << pconf->rx_port;
if (app_used_rx_port_mask & mask) {
- RTE_LOG(ERR, APP, "pfc %u: rx port %hu is used already\n", nb_pfc, pconf->rx_port);
+ RTE_LOG(ERR, APP, "pfc %u: rx port %"PRIu8" is used already\n",
+ nb_pfc, pconf->rx_port);
return -1;
}
app_used_rx_port_mask |= mask;
mask = 1lu << pconf->tx_port;
if (app_used_tx_port_mask & mask) {
- RTE_LOG(ERR, APP, "pfc %u: port %hu is used already\n", nb_pfc, pconf->tx_port);
+ RTE_LOG(ERR, APP, "pfc %u: port %"PRIu8" is used already\n",
+ nb_pfc, pconf->tx_port);
return -1;
}
app_used_tx_port_mask |= mask;
tx_conf.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS;
/* init port */
- RTE_LOG(INFO, APP, "Initializing port %hu... ", portid);
+ RTE_LOG(INFO, APP, "Initializing port %"PRIu8"... ", portid);
fflush(stdout);
ret = rte_eth_dev_configure(portid, 1, 1, &port_conf);
if (ret < 0)
- rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%hu\n",
- ret, portid);
+ rte_exit(EXIT_FAILURE, "Cannot configure device: "
+ "err=%d, port=%"PRIu8"\n", ret, portid);
/* init one RX queue */
fflush(stdout);
ret = rte_eth_rx_queue_setup(portid, 0, (uint16_t)ring_conf.rx_size,
rte_eth_dev_socket_id(portid), &rx_conf, mp);
if (ret < 0)
- rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, port=%hu\n",
- ret, portid);
+ rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: "
+ "err=%d, port=%"PRIu8"\n", ret, portid);
/* init one TX queue */
fflush(stdout);
(uint16_t)ring_conf.tx_size, rte_eth_dev_socket_id(portid), &tx_conf);
if (ret < 0)
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, "
- "port=%hu queue=%d\n",
- ret, portid, 0);
+ "port=%"PRIu8" queue=%d\n", ret, portid, 0);
/* Start device */
ret = rte_eth_dev_start(portid);
if (ret < 0)
- rte_exit(EXIT_FAILURE, "rte_pmd_port_start: err=%d, port=%hu\n",
- ret, portid);
+ rte_exit(EXIT_FAILURE, "rte_pmd_port_start: "
+ "err=%d, port=%"PRIu8"\n", ret, portid);
printf("done: ");
/* initialize mbuf memory */
if (mode == APP_RX_MODE) {
for (i = 0; i < rx_idx; i++) {
- RTE_LOG(INFO, APP, "flow %u lcoreid %u reading port %hu\n",
- i, lcore_id, rx_confs[i]->rx_port);
+ RTE_LOG(INFO, APP, "flow %u lcoreid %u "
+ "reading port %"PRIu8"\n",
+ i, lcore_id, rx_confs[i]->rx_port);
}
app_rx_thread(rx_confs);
if (wt_confs[i]->m_table == NULL)
rte_panic("flow %u unable to allocate memory buffer\n", i);
- RTE_LOG(INFO, APP, "flow %u lcoreid %u sched+write port %hu\n",
- i, lcore_id, wt_confs[i]->tx_port);
+ RTE_LOG(INFO, APP, "flow %u lcoreid %u sched+write "
+ "port %"PRIu8"\n",
+ i, lcore_id, wt_confs[i]->tx_port);
}
app_mixed_thread(wt_confs);
if (tx_confs[i]->m_table == NULL)
rte_panic("flow %u unable to allocate memory buffer\n", i);
- RTE_LOG(INFO, APP, "flow %u lcoreid %u writing port %hu\n",
- i, lcore_id, tx_confs[i]->tx_port);
+ RTE_LOG(INFO, APP, "flow %u lcoreid %u "
+ "writing port %"PRIu8"\n",
+ i, lcore_id, tx_confs[i]->tx_port);
}
app_tx_thread(tx_confs);
struct flow_conf *flow = &qos_conf[i];
rte_eth_stats_get(flow->rx_port, &stats);
- printf("\nRX port %hu: rx: %"PRIu64 " err: %"PRIu64 " no_mbuf: %"PRIu64 "\n",
- flow->rx_port,
- stats.ipackets - rx_stats[i].ipackets,
- stats.ierrors - rx_stats[i].ierrors,
- stats.rx_nombuf - rx_stats[i].rx_nombuf);
+ printf("\nRX port %"PRIu8": rx: %"PRIu64 " err: %"PRIu64
+ " no_mbuf: %"PRIu64 "\n",
+ flow->rx_port,
+ stats.ipackets - rx_stats[i].ipackets,
+ stats.ierrors - rx_stats[i].ierrors,
+ stats.rx_nombuf - rx_stats[i].rx_nombuf);
memcpy(&rx_stats[i], &stats, sizeof(stats));
rte_eth_stats_get(flow->tx_port, &stats);
- printf("TX port %hu: tx: %" PRIu64 " err: %" PRIu64 "\n",
- flow->tx_port,
- stats.opackets - tx_stats[i].opackets,
- stats.oerrors - tx_stats[i].oerrors);
+ printf("TX port %"PRIu8": tx: %" PRIu64 " err: %" PRIu64 "\n",
+ flow->tx_port,
+ stats.opackets - tx_stats[i].opackets,
+ stats.oerrors - tx_stats[i].oerrors);
memcpy(&tx_stats[i], &stats, sizeof(stats));
//printf("MP = %d\n", rte_mempool_count(conf->app_pktmbuf_pool));
struct cmdline *cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_in, int s_out);
void cmdline_set_prompt(struct cmdline *cl, const char *prompt);
void cmdline_free(struct cmdline *cl);
-void cmdline_printf(const struct cmdline *cl, const char *fmt, ...);
+void cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
+ __attribute__((format(printf,2,3)));
int cmdline_in(struct cmdline *cl, const char *buf, int size);
int cmdline_write_char(struct rdline *rdl, char c);
void cmdline_interact(struct cmdline *cl);
* - 0: Success.
* - Negative on error.
*/
-int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap);
+int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
+ __attribute__((format(printf,3,0)));
/**
* Generates a log message.
*
*/
int
-rte_snprintf(char *buffer, int buflen, const char *format, ...);
+rte_snprintf(char *buffer, int buflen, const char *format, ...)
+ __attribute__((format(printf,3,4)));
/**
* Takes string "string" parameter and splits it at character "delim"
ivshmem_config->pci_devs[ivshmem_config->pci_devs_idx].ioremap_addr = res->phys_addr;
rte_snprintf(ivshmem_config->pci_devs[ivshmem_config->pci_devs_idx].path,
sizeof(ivshmem_config->pci_devs[ivshmem_config->pci_devs_idx].path),
- path);
+ "%s", path);
ivshmem_config->pci_devs_idx++;
}
/* add /dev/zero to command-line to fill the space */
tmplen = rte_snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
"/dev/zero",
- 0x0,
+ (uint64_t)0x0,
zero_size);
cmdline_ptr = RTE_PTR_ADD(cmdline_ptr, tmplen);
/* add metadata file to the end of command-line */
tmplen = rte_snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
cfg_file_path,
- 0x0,
+ (uint64_t)0x0,
METADATA_SIZE_ALIGNED);
cmdline_ptr = RTE_PTR_ADD(cmdline_ptr, tmplen);
}
}
- rte_snprintf(intf_name, RTE_KNI_NAMESIZE, conf->name);
+ rte_snprintf(intf_name, RTE_KNI_NAMESIZE, "%s", conf->name);
rte_snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "KNI_INFO_%s", intf_name);
mz = kni_memzone_reserve(mz_name, sizeof(struct rte_kni),
SOCKET_ID_ANY, 0);
dev_info.group_id = conf->group_id;
dev_info.mbuf_size = conf->mbuf_size;
- rte_snprintf(ctx->name, RTE_KNI_NAMESIZE, intf_name);
- rte_snprintf(dev_info.name, RTE_KNI_NAMESIZE, intf_name);
+ rte_snprintf(ctx->name, RTE_KNI_NAMESIZE, "%s", intf_name);
+ rte_snprintf(dev_info.name, RTE_KNI_NAMESIZE, "%s", intf_name);
RTE_LOG(INFO, KNI, "pci: %02x:%02x:%02x \t %02x:%02x\n",
dev_info.bus, dev_info.devid, dev_info.function,
if (!kni || !kni->in_use)
return -1;
- rte_snprintf(dev_info.name, sizeof(dev_info.name), kni->name);
+ rte_snprintf(dev_info.name, sizeof(dev_info.name), "%s", kni->name);
if (ioctl(kni_fd, RTE_KNI_IOCTL_RELEASE, &dev_info) < 0) {
RTE_LOG(ERR, KNI, "Fail to release kni device\n");
return -1;
return I40E_ERR_PARAM;
id++;
- rte_snprintf(z_name, sizeof(z_name), "i40e_dma_%lu", id);
+ rte_snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
mz = rte_memzone_reserve_aligned(z_name, size, 0, 0, alignment);
if (!mz)
return I40E_ERR_NO_MEMORY;