Skip to content

Commit

Permalink
fix DPDK 24.11.0-rcs compat issues
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Wiles <keith.wiles@intel.com>
  • Loading branch information
KeithWiles committed Nov 12, 2024
1 parent c171176 commit 12fb93c
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24.10.2
24.10.3
4 changes: 3 additions & 1 deletion app/lpktgenlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -3383,7 +3383,9 @@ port_info(lua_State *L, port_info_t *pinfo)
setf_string(L, "src_mac", buff);
lua_rawset(L, -3);

rte_eth_dev_info_get(pinfo->pid, &dev);
if (rte_eth_dev_info_get(pinfo->pid, &dev) < 0)
rte_exit(EXIT_FAILURE, "Cannot get device info for port %u\n", pinfo->pid);

const struct rte_bus *bus = NULL;
if (dev.device)
bus = rte_bus_find_by_device(dev.device);
Expand Down
3 changes: 2 additions & 1 deletion app/pktgen-latency.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ pktgen_print_static_data(void)
inet_mtoa(buff, sizeof(buff), &pkt->eth_dst_addr));
scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1,
inet_mtoa(buff, sizeof(buff), &pkt->eth_src_addr));
rte_eth_dev_info_get(pid, &dev);
if (rte_eth_dev_info_get(pid, &dev) < 0)
rte_exit(EXIT_FAILURE, "Cannot get device info for port %u", pid);
const struct rte_bus *bus = NULL;
if (dev.device)
bus = rte_bus_find_by_device(dev.device);
Expand Down
8 changes: 5 additions & 3 deletions app/pktgen-port-cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ initialize_port_info(uint16_t pid)
pinfo->pid = pid;
l2p_set_port_pinfo(pid, pinfo);

rte_eth_dev_info_get(pid, &pinfo->dev_info);
if (rte_eth_dev_info_get(pid, &pinfo->dev_info) < 0)
rte_exit(EXIT_FAILURE, "Cannot get device info for port %u", pid);

/* Get a clean copy of the configuration structure */
rte_memcpy(&conf, &default_port_conf, sizeof(struct rte_eth_conf));
Expand Down Expand Up @@ -230,7 +231,8 @@ initialize_port_info(uint16_t pid)
struct rte_eth_rxconf rxq_conf;
struct rte_eth_conf conf = {0};

rte_eth_dev_conf_get(pid, &conf);
if (rte_eth_dev_conf_get(pid, &conf) < 0)
pktgen_log_panic("rte_eth_dev_conf_get: err=%d, port=%d", ret, pid);

rxq_conf = pinfo->dev_info.default_rxconf;
rxq_conf.offloads = conf.rxmode.offloads;
Expand All @@ -256,7 +258,7 @@ initialize_port_info(uint16_t pid)
pktgen_log_info("%*sPort memory used = %6lu KB", 57, " ", (pktgen.mem_used + 1023) / 1024);

if (pktgen.verbose)
rte_eth_dev_info_dump(NULL, pid);
rte_eth_dev_info_dump(stderr, pid);

/* If enabled, put device in promiscuous mode. */
if (pktgen.flags & PROMISCUOUS_ON_FLAG) {
Expand Down
5 changes: 4 additions & 1 deletion app/pktgen-port-cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,10 @@ rte_eth_dev_info_dump(FILE *f, uint16_t pid)
struct rte_eth_dev_info *di = &dev_info;
char buf[512];

rte_eth_dev_info_get(pid, &dev_info);
if (rte_eth_dev_info_get(pid, &dev_info) < 0) {
fprintf(f, "Failed to get eth dev info for port %u\n", pid);
return;
}

if (!f)
f = stderr;
Expand Down
3 changes: 2 additions & 1 deletion app/pktgen-stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ pktgen_print_static_data(void)
scrn_printf(row++, col, "%*s", COLUMN_WIDTH_1,
inet_mtoa(buff, sizeof(buff), &pkt->eth_src_addr));

rte_eth_dev_info_get(pid, &dev);
if (rte_eth_dev_info_get(pid, &dev) < 0)
rte_exit(EXIT_FAILURE, "Cannot get device info for port %u\n", pid);

const struct rte_bus *bus = NULL;
if (dev.device)
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Pktgen-DPDK - Traffic Generator powered by DPDK
** (Pktgen) Sounds like 'Packet-Gen'**

**=== Modifications ===**
- 24.10.3 - fix DPDK compatibility issues with 24.11.0-rc2
- 24.10.2 = fix tcp flags setting code.
- 24.10.1 - fix compiler warnings on packed-not-aligned for ubuntu 24.10
- 24.10.0 - fix a number of bugs for pcap crash, tcp flags, socket crash, random and startup.
Expand Down
12 changes: 6 additions & 6 deletions examples/pktperf/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
void
print_stats(void)
{
struct rte_eth_link link;
struct rte_eth_stats rate;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
char twirl[] = "|/-\\";
Expand All @@ -63,8 +62,6 @@ print_stats(void)
continue;
}

memset(&port->link, 0, sizeof(port->link));
rte_eth_link_get_nowait(port->pid, &port->link);
packet_rate(port);

rte_eth_stats_get(port->pid, &port->stats);
Expand Down Expand Up @@ -96,9 +93,12 @@ print_stats(void)
memcpy(p, c, sizeof(qstats_t));
}

memset(&link, 0, sizeof(link));
rte_eth_link_get_nowait(pid, &link);
rte_eth_link_to_str(link_status_text, sizeof(link_status_text), &link);
memset(&port->link, 0, sizeof(port->link));
if (rte_eth_link_get_nowait(port->pid, &port->link) < 0) {
printf("Port %u: Failed to get link status\n", pid);
continue;
}
rte_eth_link_to_str(link_status_text, sizeof(link_status_text), &port->link);

printf("%2u >> %s, ", pid, link_status_text);

Expand Down
5 changes: 4 additions & 1 deletion lib/lua/lua_dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ link_state(lua_State *L, uint16_t pid)
char buff[32];

lua_pushinteger(L, pid); /* Push the table index */
rte_eth_link_get_nowait(pid, &link);
if (rte_eth_link_get_nowait(pid, &link) < 0) {
fprintf(stderr, "Port %u: Failed to get link status\n", pid);
return;
}

if (link.link_status)
snprintf(buff, sizeof(buff), "<UP-%u-%s>", (uint32_t)link.link_speed,
Expand Down

0 comments on commit 12fb93c

Please sign in to comment.