On Tue, Jan 9, 2024 at 7:40 PM <jerinj@marvell.com> wrote: > > From: Jerin Jacob <jerinj@marvell.com> > > Define qualification criteria for external library > based on a techboard meeting minutes [1] and past > learnings from mailing list discussion. > > [1] > http://mails.dpdk.org/archives/dev/2019-June/135847.html > https://mails.dpdk.org/archives/dev/2024-January/284849.html > > Signed-off-by: Jerin Jacob <jerinj@marvell.com> > Acked-by: Thomas Monjalon <thomas@monjalon.net> Ping for merge > --- > > v6: > - Address Morten's comments at https://mails.dpdk.org/archives/dev/2024-January/285029.html > > v5: > - Added "Dependency nature" section based on Stephen's input > > v4: > - Address Thomas comments from https://patches.dpdk.org/project/dpdk/patch/20240105121215.3950532-1-jerinj@marvell.com/ > > v3: > - Updated the content based on TB discussion which is documented at > https://mails.dpdk.org/archives/dev/2024-January/284849.html > > v2: > - Added "Meson build integration" and "Code readability" sections. > > doc/guides/contributing/index.rst | 1 + > .../contributing/library_dependency.rst | 53 +++++++++++++++++++ > 2 files changed, 54 insertions(+) > create mode 100644 doc/guides/contributing/library_dependency.rst > > diff --git a/doc/guides/contributing/index.rst b/doc/guides/contributing/index.rst > index dcb9b1fbf0..e5a8c2b0a3 100644 > --- a/doc/guides/contributing/index.rst > +++ b/doc/guides/contributing/index.rst > @@ -15,6 +15,7 @@ Contributor's Guidelines > documentation > unit_test > new_library > + library_dependency > patches > vulnerability > stable > diff --git a/doc/guides/contributing/library_dependency.rst b/doc/guides/contributing/library_dependency.rst > new file mode 100644 > index 0000000000..3b275f1c52 > --- /dev/null > +++ b/doc/guides/contributing/library_dependency.rst > @@ -0,0 +1,53 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright(c) 2024 Marvell. > + > +External Library dependency > +=========================== > + > +This document defines the qualification criteria for external libraries that may be > +used as dependencies in DPDK drivers or libraries. > +The final decision to accept or reject is at the discretion of the DPDK Project's Technical Board. > + > +#. **Documentation:** > + > + - Must have adequate documentation for the steps to build it. > + - Must have clear license documentation on distribution and usage aspects of external library. > + > +#. **Free availability:** > + > + - The library must be freely available to build in either source or binary form. > + - It shall be downloadable from a direct link. There shall not be any requirement to explicitly > + login or sign a user agreement. > + > +#. **Usage License:** > + > + - Both permissive (e.g., BSD-3 or Apache) and non-permissive (e.g., GPLv3) licenses are acceptable. > + - In the case of a permissive license, automatic inclusion in the build process is assumed. > + For non-permissive licenses, an additional build configuration option is required. > + > +#. **Distribution License:** > + > + - No specific constraints, but clear documentation on distribution usage aspects is required. > + > +#. **Compiler compatibility:** > + > + - The library must be able to compile with a DPDK supported compiler for the given target > + environment. > + For example, for Linux, the library must be able to compile with GCC and/or clang. > + - Library may be limited to a specific OS and/or specific hardware. > + > +#. **Meson build integration:** > + > + - The library must have standard method like ``pkg-config`` for seamless integration with > + DPDK's build environment. > + > +#. **Code readability:** > + > + - Optional dependencies should use stubs to minimize ``ifdef`` clutter, promoting improved > + code readability. > + > +#. **Dependency nature:** > + > + - The external library dependency must be optional. > + i.e Missing external library must not impact the core functionality of the DPDK, specific > + library and/or driver will not be built if dependencies are not met. > -- > 2.43.0 >
On Wed, Feb 21, 2024 at 9:43 PM <pbhagavatula@marvell.com> wrote: > > From: Pavan Nikhilesh <pbhagavatula@marvell.com> > > Deprecate rte_node, rte_node_register and rte_graph_cluster_node_stats > structures as will be extended to include node specific error counters > and error description. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com> Implementation patches for 24.11 at https://patches.dpdk.org/project/dpdk/list/?series=31181. The deprecation notice looks good to me. Acked-by: Jerin Jacob <jerinj@marvell.com> > --- > doc/guides/rel_notes/deprecation.rst | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst > index 10630ba255..b3dfd06ed6 100644 > --- a/doc/guides/rel_notes/deprecation.rst > +++ b/doc/guides/rel_notes/deprecation.rst > @@ -142,3 +142,8 @@ Deprecation Notices > will be deprecated and subsequently removed in DPDK 24.11 release. > Before this, the new port library API (functions rte_swx_port_*) > will gradually transition from experimental to stable status. > + > +* graph: The graph library data structures will be modified to > + support node specific errors, the structures ``rte_node``, > + ``rte_node_register`` and ``rte_graph_cluster_node_stats`` will be > + extended to include node error counters and error description. > -- > 2.25.1 >
On Tue, 12 Mar 2024 15:52:36 +0800
Dengdui Huang <huangdengdui@huawei.com> wrote:
> - ret = snprintf(str, len, "Link up at %s %s %s",
> + ret = snprintf(str, len, "Link up at %s %ulanes %s %s",
Don't you want a space after %u?
Could you make it so that lanes is only part of the message if non-default value
is used?
[-- Attachment #1: Type: text/plain, Size: 1669 bytes --] I tested below 18 scenarios on RHEL 9.2 and didn't find any new dpdk issues. - VM with device assignment(PF) throughput testing(1G hugepage size): PASS - VM with device assignment(PF) throughput testing(2M hugepage size) : PASS - VM with device assignment(VF) throughput testing: PASS - PVP (host dpdk testpmd as vswitch) 1Q: throughput testing: PASS - PVP vhost-user 2Q throughput testing: PASS - PVP vhost-user 1Q - cross numa node throughput testing: PASS - VM with vhost-user 2 queues throughput testing: PASS - vhost-user reconnect with dpdk-client, qemu-server qemu reconnect: PASS - vhost-user reconnect with dpdk-client, qemu-server ovs reconnect: PASS - PVP reconnect with dpdk-client, qemu-server: PASS - PVP 1Q live migration testing: PASS - PVP 1Q cross numa node live migration testing: PASS - VM with ovs+dpdk+vhost-user 1Q live migration testing: PASS - VM with ovs+dpdk+vhost-user 1Q live migration testing (2M): PASS - VM with ovs+dpdk+vhost-user 2Q live migration testing: PASS - VM with ovs+dpdk+vhost-user 4Q live migration testing: PASS - Host PF + DPDK testing: PASS - Host VF + DPDK testing: PASS Test Versions: - qemu-kvm-7.2.0 - kernel 5.14 - libvirt 9.0 - git log commit 80ecef6d1f71fcebc0a51d7cabc51f73ee142ff2 Author: Thomas Monjalon <thomas@monjalon.net> Date: Mon Mar 18 04:34:16 2024 +0100 version: 24.03-rc3 Signed-off-by: Thomas Monjalon <thomas@monjalon.net> - Test device : X540-AT2 NIC(ixgbe, 10G) Tested-by: Yanghang Liu<yanghliu@redhat.com> [-- Attachment #2: Type: text/html, Size: 3601 bytes --]
On 2024/3/16 5:47, Damodharam Ammepalli wrote: > On Tue, Mar 12, 2024 at 12:52 AM Dengdui Huang <huangdengdui@huawei.com> wrote: >> >> Extended speed command for setting lane number and >> Show info print lane number. >> >> Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> >> --- >> app/test-pmd/cmdline.c | 110 +++++++++++--------- >> app/test-pmd/config.c | 60 +++++++---- >> doc/guides/rel_notes/release_24_03.rst | 1 + >> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 3 +- >> 4 files changed, 103 insertions(+), 71 deletions(-) >> >> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c >> index f521a1fe9e..e66daf4bba 100644 >> --- a/app/test-pmd/cmdline.c >> +++ b/app/test-pmd/cmdline.c >> @@ -1356,15 +1356,20 @@ struct cmd_config_speed_all { >> cmdline_fixed_string_t keyword; >> cmdline_fixed_string_t all; >> cmdline_fixed_string_t item1; >> + cmdline_fixed_string_t lanes_item; >> cmdline_fixed_string_t item2; >> cmdline_fixed_string_t value1; >> + uint8_t lanes_value; >> cmdline_fixed_string_t value2; >> }; >> >> static int >> -parse_and_check_speed_duplex(char *speedstr, char *duplexstr, uint32_t *speed) >> +parse_and_check_speed_duplex(char *speedstr, uint8_t lanes, char *duplexstr, >> + uint32_t *speed) >> { >> > We internally implemented a similar feature, without changing the > existing testpmd speed cmd. > Instead of modifying the existing command set we can have a separate > cmd for the lanes > configuration similar to FEC configuration. Our internal > implementation looks something like this, > without affecting existing implementations. > testpmd> port stop 0 > testpmd> port config 0 speed_lanes 4 Hi, Damodharam, Thanks for your review. I think the lanes should be configured with speed and duplex, they will eventually map to Link speed capabilities(RTE_ETH_LINK_SPEED_*). Would it be better to add the following new command? testpmd> port config 0 speed 200000 lanes 4 duplex full It can be used when the driver supports setting lanes; It cannot be used when the driver does not support the setting lanes. what do you think? > testpmd> port config 0 speed 200000 duplex full > testpmd> port start 0 > testpmd> show port summary 0 > Number of available ports: 2 > Port MAC Address Name Driver Status Link Lanes > 0 14:23:F2:C3:BA:D2 0000:b1:00.0 net_bnxt up 200 Gbps 4 The summary command adds print of the number of lanes. I will implement this in the next version. > testpmd> > testpmd> show port info 0 > > ********************* Infos for port 0 ********************* > MAC address: 14:23:F2:C3:BA:D2 > Device name: 0000:b1:00.0 > Driver name: net_bnxt > Firmware-version: 228.9.115.0 > Connect to socket: 2 > memory allocation on the socket: 2 > Link status: up > Link speed: 200 Gbps > Lanes: 4 > Link duplex: full-duplex > Autoneg status: Off > >> + uint32_t speed_num; >> + char *endptr; >> int duplex; >> >> if (!strcmp(duplexstr, "half")) { >> @@ -1378,47 +1383,22 @@ parse_and_check_speed_duplex(char *speedstr, char *duplexstr, uint32_t *speed) >> return -1; >> } >> >> - if (!strcmp(speedstr, "10")) { >> - *speed = (duplex == RTE_ETH_LINK_HALF_DUPLEX) ? >> - RTE_ETH_LINK_SPEED_10M_HD : RTE_ETH_LINK_SPEED_10M; >> - } else if (!strcmp(speedstr, "100")) { >> - *speed = (duplex == RTE_ETH_LINK_HALF_DUPLEX) ? >> - RTE_ETH_LINK_SPEED_100M_HD : RTE_ETH_LINK_SPEED_100M; >> - } else { >> - if (duplex != RTE_ETH_LINK_FULL_DUPLEX) { >> - fprintf(stderr, "Invalid speed/duplex parameters\n"); >> - return -1; >> - } >> - if (!strcmp(speedstr, "1000")) { >> - *speed = RTE_ETH_LINK_SPEED_1G; >> - } else if (!strcmp(speedstr, "2500")) { >> - *speed = RTE_ETH_LINK_SPEED_2_5G; >> - } else if (!strcmp(speedstr, "5000")) { >> - *speed = RTE_ETH_LINK_SPEED_5G; >> - } else if (!strcmp(speedstr, "10000")) { >> - *speed = RTE_ETH_LINK_SPEED_10G; >> - } else if (!strcmp(speedstr, "25000")) { >> - *speed = RTE_ETH_LINK_SPEED_25G; >> - } else if (!strcmp(speedstr, "40000")) { >> - *speed = RTE_ETH_LINK_SPEED_40G; >> - } else if (!strcmp(speedstr, "50000")) { >> - *speed = RTE_ETH_LINK_SPEED_50G; >> - } else if (!strcmp(speedstr, "100000")) { >> - *speed = RTE_ETH_LINK_SPEED_100G; >> - } else if (!strcmp(speedstr, "200000")) { >> - *speed = RTE_ETH_LINK_SPEED_200G; >> - } else if (!strcmp(speedstr, "400000")) { >> - *speed = RTE_ETH_LINK_SPEED_400G; >> - } else if (!strcmp(speedstr, "auto")) { >> - *speed = RTE_ETH_LINK_SPEED_AUTONEG; >> - } else { >> - fprintf(stderr, "Unknown speed parameter\n"); >> - return -1; >> - } >> + if (!strcmp(speedstr, "auto")) { >> + *speed = RTE_ETH_LINK_SPEED_AUTONEG; >> + return 0; >> } >> >> - if (*speed != RTE_ETH_LINK_SPEED_AUTONEG) >> - *speed |= RTE_ETH_LINK_SPEED_FIXED; >> + speed_num = strtol(speedstr, &endptr, 10); >> + if (*endptr != '\0') { >> + fprintf(stderr, "Unknown speed parameter\n"); >> + return -1; >> + } >> + >> + *speed = rte_eth_speed_bitflag(speed_num, lanes, duplex); >> + if (*speed == 0) { >> + fprintf(stderr, "param error\n"); >> + return -1; >> + } >> >> return 0; >> } >> @@ -1429,19 +1409,27 @@ cmd_config_speed_all_parsed(void *parsed_result, >> __rte_unused void *data) >> { >> struct cmd_config_speed_all *res = parsed_result; >> + struct rte_eth_dev_info dev_info; >> uint32_t link_speed; >> portid_t pid; >> + int ret; >> >> if (!all_ports_stopped()) { >> fprintf(stderr, "Please stop all ports first\n"); >> return; >> } >> >> - if (parse_and_check_speed_duplex(res->value1, res->value2, >> - &link_speed) < 0) >> + if (parse_and_check_speed_duplex(res->value1, res->lanes_value, >> + res->value2, &link_speed) < 0) >> return; >> >> RTE_ETH_FOREACH_DEV(pid) { >> + ret = eth_dev_info_get_print_err(pid, &dev_info); >> + if (ret != 0) >> + return; >> + if ((dev_info.dev_capa & RTE_ETH_DEV_CAPA_SETTING_LANES) == 0) >> + fprintf(stderr, "The setting lane may not take effect because " >> + "the port (%u) does not support it\n", pid); >> ports[pid].dev_conf.link_speeds = link_speed; >> } >> >> @@ -1460,6 +1448,11 @@ static cmdline_parse_token_string_t cmd_config_speed_all_item1 = >> static cmdline_parse_token_string_t cmd_config_speed_all_value1 = >> TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all, value1, >> "10#100#1000#2500#5000#10000#25000#40000#50000#100000#200000#400000#auto"); >> +static cmdline_parse_token_string_t cmd_config_speed_all_lanes_item = >> + TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all, lanes_item, "lanes"); >> +static cmdline_parse_token_num_t cmd_config_speed_all_lanes_value = >> + TOKEN_NUM_INITIALIZER(struct cmd_config_speed_all, lanes_value, >> + RTE_UINT8); >> static cmdline_parse_token_string_t cmd_config_speed_all_item2 = >> TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all, item2, "duplex"); >> static cmdline_parse_token_string_t cmd_config_speed_all_value2 = >> @@ -1470,14 +1463,16 @@ static cmdline_parse_inst_t cmd_config_speed_all = { >> .f = cmd_config_speed_all_parsed, >> .data = NULL, >> .help_str = "port config all speed " >> - "10|100|1000|2500|5000|10000|25000|40000|50000|100000|200000|400000|auto duplex " >> - "half|full|auto", >> + "10|100|1000|2500|5000|10000|25000|40000|50000|100000|200000|400000|auto" >> + " lanes 1|2|4|8 duplex half|full|auto", >> .tokens = { >> (void *)&cmd_config_speed_all_port, >> (void *)&cmd_config_speed_all_keyword, >> (void *)&cmd_config_speed_all_all, >> (void *)&cmd_config_speed_all_item1, >> (void *)&cmd_config_speed_all_value1, >> + (void *)&cmd_config_speed_all_lanes_item, >> + (void *)&cmd_config_speed_all_lanes_value, >> (void *)&cmd_config_speed_all_item2, >> (void *)&cmd_config_speed_all_value2, >> NULL, >> @@ -1490,8 +1485,10 @@ struct cmd_config_speed_specific { >> cmdline_fixed_string_t keyword; >> portid_t id; >> cmdline_fixed_string_t item1; >> + cmdline_fixed_string_t lanes_item; >> cmdline_fixed_string_t item2; >> cmdline_fixed_string_t value1; >> + uint8_t lanes_value; >> cmdline_fixed_string_t value2; >> }; >> >> @@ -1501,7 +1498,9 @@ cmd_config_speed_specific_parsed(void *parsed_result, >> __rte_unused void *data) >> { >> struct cmd_config_speed_specific *res = parsed_result; >> + struct rte_eth_dev_info dev_info; >> uint32_t link_speed; >> + int ret; >> >> if (port_id_is_invalid(res->id, ENABLED_WARN)) >> return; >> @@ -1511,8 +1510,15 @@ cmd_config_speed_specific_parsed(void *parsed_result, >> return; >> } >> >> - if (parse_and_check_speed_duplex(res->value1, res->value2, >> - &link_speed) < 0) >> + ret = eth_dev_info_get_print_err(res->id, &dev_info); >> + if (ret != 0) >> + return; >> + if ((dev_info.dev_capa & RTE_ETH_DEV_CAPA_SETTING_LANES) == 0) >> + fprintf(stderr, "The setting lane may not take effect because " >> + "the port (%d) does not support it\n", res->id); >> + >> + if (parse_and_check_speed_duplex(res->value1, res->lanes_value, >> + res->value2, &link_speed) < 0) >> return; >> >> ports[res->id].dev_conf.link_speeds = link_speed; >> @@ -1535,6 +1541,12 @@ static cmdline_parse_token_string_t cmd_config_speed_specific_item1 = >> static cmdline_parse_token_string_t cmd_config_speed_specific_value1 = >> TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific, value1, >> "10#100#1000#2500#5000#10000#25000#40000#50000#100000#200000#400000#auto"); >> +static cmdline_parse_token_string_t cmd_config_speed_specific_lanes_item = >> + TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific, lanes_item, >> + "lanes"); >> +static cmdline_parse_token_num_t cmd_config_speed_specific_lanes_value = >> + TOKEN_NUM_INITIALIZER(struct cmd_config_speed_specific, lanes_value, >> + RTE_UINT8); >> static cmdline_parse_token_string_t cmd_config_speed_specific_item2 = >> TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific, item2, >> "duplex"); >> @@ -1546,14 +1558,16 @@ static cmdline_parse_inst_t cmd_config_speed_specific = { >> .f = cmd_config_speed_specific_parsed, >> .data = NULL, >> .help_str = "port config <port_id> speed " >> - "10|100|1000|2500|5000|10000|25000|40000|50000|100000|200000|400000|auto duplex " >> - "half|full|auto", >> + "10|100|1000|2500|5000|10000|25000|40000|50000|100000|200000|400000|auto" >> + " lanes 1|2|4|8 duplex half|full|auto", >> .tokens = { >> (void *)&cmd_config_speed_specific_port, >> (void *)&cmd_config_speed_specific_keyword, >> (void *)&cmd_config_speed_specific_id, >> (void *)&cmd_config_speed_specific_item1, >> (void *)&cmd_config_speed_specific_value1, >> + (void *)&cmd_config_speed_specific_lanes_item, >> + (void *)&cmd_config_speed_specific_lanes_value, >> (void *)&cmd_config_speed_specific_item2, >> (void *)&cmd_config_speed_specific_value2, >> NULL, >> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c >> index 968d2164ab..c104327878 100644 >> --- a/app/test-pmd/config.c >> +++ b/app/test-pmd/config.c >> @@ -587,39 +587,51 @@ device_infos_display_speeds(uint32_t speed_capa) >> if (speed_capa == RTE_ETH_LINK_SPEED_AUTONEG) >> printf(" Autonegotiate (all speeds)"); >> if (speed_capa & RTE_ETH_LINK_SPEED_FIXED) >> - printf(" Disable autonegotiate (fixed speed) "); >> + printf(" Disable autonegotiate (fixed speed) /"); >> if (speed_capa & RTE_ETH_LINK_SPEED_10M_HD) >> - printf(" 10 Mbps half-duplex "); >> + printf(" 10Mbps_1lane_half-duplex /"); >> if (speed_capa & RTE_ETH_LINK_SPEED_10M) >> - printf(" 10 Mbps full-duplex "); >> + printf(" 10Mbps_1lane_full-duplex /"); >> if (speed_capa & RTE_ETH_LINK_SPEED_100M_HD) >> - printf(" 100 Mbps half-duplex "); >> + printf(" 100Mbps_lane_half-duplex /"); >> if (speed_capa & RTE_ETH_LINK_SPEED_100M) >> - printf(" 100 Mbps full-duplex "); >> + printf(" 100Mbps_1lane_full-duplex /"); >> if (speed_capa & RTE_ETH_LINK_SPEED_1G) >> - printf(" 1 Gbps "); >> + printf(" 1Gbps_1lane_full-duplex /"); >> if (speed_capa & RTE_ETH_LINK_SPEED_2_5G) >> - printf(" 2.5 Gbps "); >> + printf(" 2.5Gbps_1lane_full-duplex /"); >> if (speed_capa & RTE_ETH_LINK_SPEED_5G) >> - printf(" 5 Gbps "); >> + printf(" 5Gbps_1lane_full-duplex /"); >> if (speed_capa & RTE_ETH_LINK_SPEED_10G) >> - printf(" 10 Gbps "); >> - if (speed_capa & RTE_ETH_LINK_SPEED_20G) >> - printf(" 20 Gbps "); >> + printf(" 10Gbps_1lane_full-duplex /"); >> + if (speed_capa & RTE_ETH_LINK_SPEED_10G_4LANES) >> + printf(" 10Gbps_4lane_full-duplex /"); >> + if (speed_capa & RTE_ETH_LINK_SPEED_20G_2LANES) >> + printf(" 20Gbps_2lane_full-duplex /"); >> if (speed_capa & RTE_ETH_LINK_SPEED_25G) >> - printf(" 25 Gbps "); >> - if (speed_capa & RTE_ETH_LINK_SPEED_40G) >> - printf(" 40 Gbps "); >> + printf(" 25Gbps_1lane_full-duplex /"); >> + if (speed_capa & RTE_ETH_LINK_SPEED_40G_4LANES) >> + printf(" 40Gbps_4lane_full-duplex /"); >> if (speed_capa & RTE_ETH_LINK_SPEED_50G) >> - printf(" 50 Gbps "); >> - if (speed_capa & RTE_ETH_LINK_SPEED_56G) >> - printf(" 56 Gbps "); >> + printf(" 50Gbps_1lane_full-duplex /"); >> + if (speed_capa & RTE_ETH_LINK_SPEED_50G_2LANES) >> + printf(" 50Gbps_2lane_full-duplex /"); >> + if (speed_capa & RTE_ETH_LINK_SPEED_56G_4LANES) >> + printf(" 56Gbps_4lane_full-duplex /"); >> if (speed_capa & RTE_ETH_LINK_SPEED_100G) >> - printf(" 100 Gbps "); >> - if (speed_capa & RTE_ETH_LINK_SPEED_200G) >> - printf(" 200 Gbps "); >> - if (speed_capa & RTE_ETH_LINK_SPEED_400G) >> - printf(" 400 Gbps "); >> + printf(" 100Gbps_1lane_full-duplex /"); >> + if (speed_capa & RTE_ETH_LINK_SPEED_100G_2LANES) >> + printf(" 100Gbps_2lane_full-duplex /"); >> + if (speed_capa & RTE_ETH_LINK_SPEED_100G_4LANES) >> + printf(" 100Gbps_4lane_full-duplex /"); >> + if (speed_capa & RTE_ETH_LINK_SPEED_200G_4LANES) >> + printf(" 200Gbps_4lane_full-duplex /"); >> + if (speed_capa & RTE_ETH_LINK_SPEED_200G_2LANES) >> + printf(" 200Gbps_2lane_full-duplex /"); >> + if (speed_capa & RTE_ETH_LINK_SPEED_400G_4LANES) >> + printf(" 400Gbps_4lane_full-duplex /"); >> + if (speed_capa & RTE_ETH_LINK_SPEED_400G_8LANES) >> + printf(" 400Gbps_8lane_full-duplex /"); >> } >> >> void >> @@ -828,6 +840,10 @@ port_infos_display(portid_t port_id) >> >> printf("\nLink status: %s\n", (link.link_status) ? ("up") : ("down")); >> printf("Link speed: %s\n", rte_eth_link_speed_to_str(link.link_speed)); >> + if (link.link_lanes == 0) >> + printf("Link lanes: unknown\n"); >> + else >> + printf("Link lanes: %u\n", link.link_lanes); >> printf("Link duplex: %s\n", (link.link_duplex == RTE_ETH_LINK_FULL_DUPLEX) ? >> ("full-duplex") : ("half-duplex")); >> printf("Autoneg status: %s\n", (link.link_autoneg == RTE_ETH_LINK_AUTONEG) ? >> diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst >> index c17334ac25..46aceeee93 100644 >> --- a/doc/guides/rel_notes/release_24_03.rst >> +++ b/doc/guides/rel_notes/release_24_03.rst >> @@ -79,6 +79,7 @@ New Features >> * **Support setting lanes for ethdev.** >> * Support setting lanes by extended ``RTE_ETH_LINK_SPEED_*``. >> * Added function to convert bitmap flag to the struct of link speed info. >> + ``rte_eth_speed_capa_to_info()`` >> >> * **Added hash calculation of an encapsulated packet as done by the HW.** >> >> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst >> index 2fbf9220d8..087f7fe853 100644 >> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst >> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst >> @@ -190,6 +190,7 @@ For example: >> memory allocation on the socket: 0 >> Link status: up >> Link speed: 40000 Mbps >> + Link lanes: 4 >> Link duplex: full-duplex >> Promiscuous mode: enabled >> Allmulticast mode: disabled >> @@ -2065,7 +2066,7 @@ port config - speed >> Set the speed and duplex mode for all ports or a specific port:: >> >> testpmd> port config (port_id|all) speed (10|100|1000|2500|5000|10000|25000|40000|50000|100000|200000|400000|auto) \ >> - duplex (half|full|auto) >> + lanes 1|2|4|8 duplex (half|full|auto) >> >> port config - queues/descriptors >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> -- >> 2.33.0 >> >
On 2024/3/15 19:17, Ferruh Yigit wrote:
> On 3/15/2024 3:00 AM, Jie Hai wrote:
>> The RSS algorithm from user is parased but not passed to the
>> rte_eth_dev_rss_hash_update() API as we wanted, this patch
>> fixes it.
>>
>> Fixes: 3da59f30a23f ("app/testpmd: set RSS hash algorithm")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>>
>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
>
> Applied to dpdk-next-net/main, thanks.
>
>
> Sorry to see we missed something this simple, wasn't this tested when
> command is added?
>
> .
I'm sorry for my mistake.
After the first round of functional tests passed,
I didn't double check it carefully after the second round of changes.
Hi Akhil Sorry for the late reply. > -----Original Message----- > From: Akhil Goyal <gakhil@marvell.com> > Sent: Friday, March 15, 2024 2:45 AM > To: Suanming Mou <suanmingm@nvidia.com>; Anoob Joseph > <anoobj@marvell.com>; ciara.power@intel.com > Cc: dev@dpdk.org > Subject: RE: [EXT] [PATCH] app/test-crypto-perf: add throughput OOP decryption > > > During throughput running, re-filling the test data will impact the > > performance test result. So for now, to run decrypt throughput testing > > is not supported since the test data is not filled. > > > > But if user requires OOP(out-of-place) mode, the test data from source > > mbuf will never be modified, and if the test data can be prepared out > > of the running loop, the decryption test should be fine. > > > > This commit adds the support of out-of-place decryption testing for > > throughput. > > > > > > Signed-off-by: Suanming Mou <suanmingm@nvidia.com> > > --- > > app/test-crypto-perf/cperf_ops.c | 5 ++- > > app/test-crypto-perf/cperf_options_parsing.c | 8 +++++ > > app/test-crypto-perf/cperf_test_throughput.c | 37 +++++++++++++++++--- > > 3 files changed, 44 insertions(+), 6 deletions(-) > > > > diff --git a/app/test-crypto-perf/cperf_ops.c > > b/app/test-crypto-perf/cperf_ops.c > > index 84945d1313..1d57b78c2b 100644 > > --- a/app/test-crypto-perf/cperf_ops.c > > +++ b/app/test-crypto-perf/cperf_ops.c > > @@ -608,7 +608,10 @@ cperf_set_ops_aead(struct rte_crypto_op **ops, > > } > > > > if ((options->test == CPERF_TEST_TYPE_VERIFY) || > > - (options->test == CPERF_TEST_TYPE_LATENCY)) { > > + (options->test == CPERF_TEST_TYPE_LATENCY) || > > + (options->test == CPERF_TEST_TYPE_THROUGHPUT && > > + (options->aead_op == RTE_CRYPTO_AEAD_OP_DECRYPT || > > + options->cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT))) { > > for (i = 0; i < nb_ops; i++) { > > uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ops[i], > > uint8_t *, iv_offset); > > diff --git a/app/test-crypto-perf/cperf_options_parsing.c > > b/app/test-crypto- perf/cperf_options_parsing.c index > > 75afedc7fd..6caca44371 100644 > > --- a/app/test-crypto-perf/cperf_options_parsing.c > > +++ b/app/test-crypto-perf/cperf_options_parsing.c > > @@ -1291,6 +1291,14 @@ cperf_options_check(struct cperf_options *options) > > } > > } > > > > + if (options->test == CPERF_TEST_TYPE_THROUGHPUT && > > + (options->aead_op == RTE_CRYPTO_AEAD_OP_DECRYPT || > > + options->cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT) && > > + !options->out_of_place) { > > + RTE_LOG(ERR, USER1, "Only out-of-place is allowed in > > throughput decryption.\n"); > > + return -EINVAL; > > + } > > This check is blocking cipher_only decryption which should pass irrespective of > inplace/oop and Data correct/incorrect. Sorry, in that case I will remove "options->cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT" and only kept " options->aead_op == RTE_CRYPTO_AEAD_OP_DECRYPT ", what do you think? > > > + > > if (options->op_type == CPERF_CIPHER_ONLY || > > options->op_type == CPERF_CIPHER_THEN_AUTH || > > options->op_type == CPERF_AUTH_THEN_CIPHER) { diff > --git > > a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto- > > perf/cperf_test_throughput.c index f8f8bd717f..eab25ec863 100644 > > --- a/app/test-crypto-perf/cperf_test_throughput.c > > +++ b/app/test-crypto-perf/cperf_test_throughput.c > > @@ -98,6 +98,29 @@ cperf_throughput_test_constructor(struct > > rte_mempool *sess_mp, > > return NULL; > > } > > > > +static void > > +cperf_verify_init_ops(struct rte_mempool *mp __rte_unused, > > + void *opaque_arg, > > + void *obj, > > + __rte_unused unsigned int i) > > +{ > > + uint16_t iv_offset = sizeof(struct rte_crypto_op) + > > + sizeof(struct rte_crypto_sym_op); > > + uint32_t imix_idx = 0; > > + struct cperf_throughput_ctx *ctx = opaque_arg; > > + struct rte_crypto_op *op = obj; > > + > > + (ctx->populate_ops)(&op, ctx->src_buf_offset, > > + ctx->dst_buf_offset, > > + 1, ctx->sess, ctx->options, > > + ctx->test_vector, iv_offset, &imix_idx, NULL); > > + > > + cperf_mbuf_set(op->sym->m_src, > > + ctx->options, > > + ctx->test_vector); > Unnecessary line break. > > > + > Extra line Will update. > > > +} > > + > > int > > cperf_throughput_test_runner(void *test_ctx) { @@ -143,6 +166,9 @@ > > cperf_throughput_test_runner(void *test_ctx) > > uint16_t iv_offset = sizeof(struct rte_crypto_op) + > > sizeof(struct rte_crypto_sym_op); > > > > + if (ctx->options->out_of_place) > > + rte_mempool_obj_iter(ctx->pool, cperf_verify_init_ops, (void > > *)ctx); > > + > > while (test_burst_size <= ctx->options->max_burst_size) { > > uint64_t ops_enqd = 0, ops_enqd_total = 0, ops_enqd_failed = 0; > > uint64_t ops_deqd = 0, ops_deqd_total = 0, ops_deqd_failed = 0; > @@ > > -175,11 +201,12 @@ cperf_throughput_test_runner(void *test_ctx) > > } > > > > /* Setup crypto op, attach mbuf etc */ > > - (ctx->populate_ops)(ops, ctx->src_buf_offset, > > - ctx->dst_buf_offset, > > - ops_needed, ctx->sess, > > - ctx->options, ctx->test_vector, > > - iv_offset, &imix_idx, &tsc_start); > > + if (!ctx->options->out_of_place) > > + (ctx->populate_ops)(ops, ctx->src_buf_offset, > > + ctx->dst_buf_offset, > > + ops_needed, ctx->sess, > > + ctx->options, ctx->test_vector, > > + iv_offset, &imix_idx, > > &tsc_start); > > > > /** > > * When ops_needed is smaller than ops_enqd, the > > -- > > 2.34.1
[-- Attachment #1: Type: text/plain, Size: 1881 bytes --] On Mon, Mar 18, 2024 at 2:42 PM Stephen Hemminger <stephen@networkplumber.org> wrote: > > On Mon, 18 Mar 2024 14:26:33 -0700 > Damodharam Ammepalli <damodharam.ammepalli@broadcom.com> wrote: > > > On Mon, Mar 18, 2024 at 7:56 AM Thomas Monjalon <thomas@monjalon.net> wrote: > > > > > > 12/03/2024 08:52, Dengdui Huang: > > > > Some speeds can be achieved with different number of lanes. For example, > > > > 100Gbps can be achieved using two lanes of 50Gbps or four lanes of 25Gbps. > > > > When use different lanes, the port cannot be up. > > > > > > I'm not sure what you are referring to. > > > I suppose it is not PCI lanes. > > > Please could you link to an explanation of how a port is split in lanes? > > > Which hardware does this? > > > > > > > > > > > This is a snapshot of 100Gb that the latest BCM576xx supports. > > 100Gb (NRZ: 25G per lane, 4 lanes) link speed > > 100Gb (PAM4-56: 50G per lane, 2 lanes) link speed > > 100Gb (PAM4-112: 100G per lane, 1 lane) link speed > > > > Let the user feed in lanes=< integer value> and the NIC driver decides > > the matching combination speed x lanes that works. In future if a new speed > > is implemented with more than 8 lanes, there wouldn't be a need > > to touch this speed command. Using separate lane command would > > be a better alternative to support already shipped products and only new > > drivers would consider this lanes configuration, if applicable. > > > > The DPDK does not need more driver specific knobs. > Shouldn't the PMD be able to auto negotiate the speed? Yes. Its possible to auto negotiate. And that's the default. Even for the lane count, a default number can be arrived at. > What does Linux do? ethtool has been extended a while ago to allow configuring the number of lanes along with speed and other settings. But as usual, autoneg is possible. [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 4218 bytes --]
On Mon, 1 Nov 2021 23:14:47 +0530
Harman Kalra <hkalra@marvell.com> wrote:
> Fixing the error logs level, as currently default level is
> set to debug. Due to this failure is not getting captured.
>
> Fixes: b7c984291611 ("interrupts: add allocator and accessors")
>
> Signed-off-by: Harman Kalra <hkalra@marvell.com>
Patch concept is good, but no longer applies cleanly.
Please rebase and resubmit
On Mon, 5 Apr 2021 21:39:52 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:
> The description of the EAL options was printed before the application
> description provided via the hook.
> It is better to let the application print the global syntax
> and describes the detail of the EAL options below.
>
> Also, some useless lines are removed,
> and the alignment of few options is fixed.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
This patch no longer applies, please rebase and resubmit
When debugging driver or startup issues, it is useful to have a timestamp on each message printed. The messages in syslog already have a timestamp, but often syslog is not available during testing. The timestamp format is chosen to look like the default Linux dmesg timestamp. The first few lines are not timestamped because the flag is stored in internal configuration which is stored in shared memory which is not setup up until a little later in startup process. This logging skips the unnecessary step of going through stdio, which makes it more robust against being called in interrupt handlers etc. Example: $ dpdk-testpmd --log-timestamp -- -i EAL: Detected CPU lcores: 16 EAL: Detected NUMA nodes: 1 EAL: Detected static linkage of DPDK EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' [ 0.112264] testpmd: No probed ethernet devices Interactive-mode selected [ 0.184573] testpmd: create a new mbuf pool <mb_pool_0>: n=163456, size=2176, socket=0 [ 0.184612] testpmd: preferred mempool ops selected: ring_mp_mc Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test/test_eal_flags.c | 9 ++++++++ doc/guides/prog_guide/log_lib.rst | 10 +++++++++ lib/eal/common/eal_common_options.c | 10 +++++++-- lib/eal/common/eal_options.h | 2 ++ lib/log/log_internal.h | 9 ++++++++ lib/log/log_unix.c | 32 +++++++++++++++++++++++++++-- lib/log/log_windows.c | 6 ++++++ lib/log/version.map | 1 + 8 files changed, 75 insertions(+), 4 deletions(-) diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index 6cb4b0675730..07a038fb6051 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -1055,6 +1055,10 @@ test_misc_flags(void) const char * const argv22[] = {prgname, prefix, mp_flag, "--huge-worker-stack=512"}; + /* Try running with --log-timestamp */ + const char * const argv23[] = {prgname, prefix, mp_flag, + "--log-timestamp" }; + /* run all tests also applicable to FreeBSD first */ if (launch_proc(argv0) == 0) { @@ -1162,6 +1166,11 @@ test_misc_flags(void) printf("Error - process did not run ok with --huge-worker-stack=size parameter\n"); goto fail; } + if (launch_proc(argv23) != 0) { + printf("Error - process did not run ok with --log-timestamp parameter\n"); + goto fail; + } + rmdir(hugepath_dir3); rmdir(hugepath_dir2); diff --git a/doc/guides/prog_guide/log_lib.rst b/doc/guides/prog_guide/log_lib.rst index aacb36c36ce0..1d6b2e3cea5d 100644 --- a/doc/guides/prog_guide/log_lib.rst +++ b/doc/guides/prog_guide/log_lib.rst @@ -73,6 +73,16 @@ For example:: /path/to/app --syslog local0 +Console timestamp +~~~~~~~~~~~~~~~~~ + +On Linux and FreeBSD, an optional timestamp can be added before each +message by adding the ``--log-timestamp`` option. +For example:: + + /path/to/app --log-level=lib.*:debug --log-timestamp + + Using Logging APIs to Generate Log Messages ------------------------------------------- diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index 7310d10dfd78..9bc95433d27c 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -77,6 +77,7 @@ eal_long_options[] = { {OPT_IOVA_MODE, 1, NULL, OPT_IOVA_MODE_NUM }, {OPT_LCORES, 1, NULL, OPT_LCORES_NUM }, {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM }, + {OPT_LOG_TIMESTAMP, 0, NULL, OPT_LOG_TIMESTAMP_NUM }, {OPT_TRACE, 1, NULL, OPT_TRACE_NUM }, {OPT_TRACE_DIR, 1, NULL, OPT_TRACE_DIR_NUM }, {OPT_TRACE_BUF_SIZE, 1, NULL, OPT_TRACE_BUF_SIZE_NUM }, @@ -1663,6 +1664,7 @@ eal_log_level_parse(int argc, char * const argv[]) switch (opt) { case OPT_LOG_LEVEL_NUM: + case OPT_LOG_TIMESTAMP_NUM: if (eal_parse_common_option(opt, optarg, internal_conf) < 0) return -1; break; @@ -1890,7 +1892,7 @@ eal_parse_common_option(int opt, const char *optarg, break; #endif - case OPT_LOG_LEVEL_NUM: { + case OPT_LOG_LEVEL_NUM: if (eal_parse_log_level(optarg) < 0) { EAL_LOG(ERR, "invalid parameters for --" @@ -1898,7 +1900,10 @@ eal_parse_common_option(int opt, const char *optarg, return -1; } break; - } + + case OPT_LOG_TIMESTAMP_NUM: + eal_log_enable_timestamp(); + break; #ifndef RTE_EXEC_ENV_WINDOWS case OPT_TRACE_NUM: { @@ -2261,6 +2266,7 @@ eal_common_usage(void) " --"OPT_PROC_TYPE" Type of this process (primary|secondary|auto)\n" #ifndef RTE_EXEC_ENV_WINDOWS " --"OPT_SYSLOG" Set syslog facility\n" + " --"OPT_LOG_TIMESTAMP" Timestamp log output\n" #endif " --"OPT_LOG_LEVEL"=<level> Set global log level\n" " --"OPT_LOG_LEVEL"=<type-match>:<level>\n" diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h index f3f2e104f6d7..e24c9eca53ca 100644 --- a/lib/eal/common/eal_options.h +++ b/lib/eal/common/eal_options.h @@ -35,6 +35,8 @@ enum { OPT_LCORES_NUM, #define OPT_LOG_LEVEL "log-level" OPT_LOG_LEVEL_NUM, +#define OPT_LOG_TIMESTAMP "log-timestamp" + OPT_LOG_TIMESTAMP_NUM, #define OPT_TRACE "trace" OPT_TRACE_NUM, #define OPT_TRACE_DIR "trace-dir" diff --git a/lib/log/log_internal.h b/lib/log/log_internal.h index c77e687e28bc..1af27fe8f9d3 100644 --- a/lib/log/log_internal.h +++ b/lib/log/log_internal.h @@ -5,8 +5,10 @@ #ifndef LOG_INTERNAL_H #define LOG_INTERNAL_H +#include <stdbool.h> #include <stdio.h> #include <stdint.h> +#include <time.h> #include <rte_compat.h> @@ -44,4 +46,11 @@ const char *eal_log_level2str(uint32_t level); __rte_internal void rte_eal_log_cleanup(void); +/* + * Add timestamp to console logs + */ +__rte_internal +void eal_log_enable_timestamp(void); + + #endif /* LOG_INTERNAL_H */ diff --git a/lib/log/log_unix.c b/lib/log/log_unix.c index a415bae5774d..71ce366b6825 100644 --- a/lib/log/log_unix.c +++ b/lib/log/log_unix.c @@ -2,24 +2,52 @@ * Copyright(c) 2010-2014 Intel Corporation */ +#include <stdbool.h> #include <stdio.h> #include <sys/types.h> +#include <sys/uio.h> #include <syslog.h> +#include <time.h> +#include <unistd.h> #include <rte_log.h> #include "log_internal.h" +static bool timestamp_enabled; +static struct timespec log_started; + +void +eal_log_enable_timestamp(void) +{ + timestamp_enabled = true; + clock_gettime(CLOCK_MONOTONIC, &log_started); +} + /* * default log function */ static ssize_t console_log_write(__rte_unused void *c, const char *buf, size_t size) { + struct timespec ts; ssize_t ret; - /* write on stderr */ - ret = fwrite(buf, 1, size, stderr); + if (timestamp_enabled) { + clock_gettime(CLOCK_MONOTONIC, &ts); + ts.tv_sec -= log_started.tv_sec; + ts.tv_nsec -= log_started.tv_nsec; + if (ts.tv_nsec < 0) { + --ts.tv_sec; + ts.tv_nsec += 1000000000ul; + } + + ret = fprintf(stderr, "[%8lu.%06lu] %.*s", + ts.tv_sec, ts.tv_nsec / 1000u, + (int) size, buf); + } else { + ret = fwrite(buf, 1, size, stderr); + } fflush(stderr); /* Syslog error levels are from 0 to 7, so subtract 1 to convert */ diff --git a/lib/log/log_windows.c b/lib/log/log_windows.c index a6a08895501e..0c471bfb15f6 100644 --- a/lib/log/log_windows.c +++ b/lib/log/log_windows.c @@ -6,6 +6,12 @@ #include <rte_log.h> #include "log_internal.h" +void +eal_log_enable_timestamp(void) +{ + /* not implemented */ +} + /* set the log to default function, called during eal init process. */ int eal_log_init(__rte_unused const char *id, __rte_unused int facility) diff --git a/lib/log/version.map b/lib/log/version.map index 6ecc656d1d65..32c555f29e79 100644 --- a/lib/log/version.map +++ b/lib/log/version.map @@ -25,6 +25,7 @@ DPDK_24 { INTERNAL { global: + eal_log_enable_timestamp; eal_log_get_default; eal_log_init; eal_log_level2str; -- 2.43.0
It is useful for application to be able to set the default log stream before call rte_eal_init(). This makes all messages go to the new default. For example, to skip using syslog; just doing rte_openlog_stream(stderr); There is no reason for helper command line applications to clutter syslog with messages. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/dumpcap/main.c | 3 +++ app/pdump/main.c | 3 +++ app/proc-info/main.c | 3 +++ lib/log/log.c | 6 ++++++ lib/log/log_internal.h | 2 ++ lib/log/log_unix.c | 4 ++++ lib/log/version.map | 1 + 7 files changed, 22 insertions(+) diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c index cc0f66b2bc61..27934ca7e688 100644 --- a/app/dumpcap/main.c +++ b/app/dumpcap/main.c @@ -633,6 +633,9 @@ static void dpdk_init(void) rte_panic("No memory\n"); } + /* keep any logging away from syslog. */ + rte_openlog_stream(stderr); + if (rte_eal_init(eal_argc, eal_argv) < 0) rte_exit(EXIT_FAILURE, "EAL init failed: is primary process running?\n"); } diff --git a/app/pdump/main.c b/app/pdump/main.c index a9205e130bb1..7b9ba68b1a14 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -995,6 +995,9 @@ main(int argc, char **argv) argc += 2; + /* keep any logging away from syslog. */ + rte_openlog_stream(stderr); + diag = rte_eal_init(argc, argp); if (diag < 0) rte_panic("Cannot init EAL\n"); diff --git a/app/proc-info/main.c b/app/proc-info/main.c index b672aaefbe99..24ee52c4ac7a 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -2149,6 +2149,9 @@ main(int argc, char **argv) argc += 4; + /* keep any logging away from syslog. */ + rte_openlog_stream(stderr); + ret = rte_eal_init(argc, argp); if (ret < 0) rte_panic("Cannot init EAL\n"); diff --git a/lib/log/log.c b/lib/log/log.c index 255f757d94cc..4cc944305057 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -519,6 +519,12 @@ eal_log_set_default(FILE *default_log) #endif } +FILE * +eal_log_get_default(void) +{ + return default_log_stream; +} + /* * Called by eal_cleanup */ diff --git a/lib/log/log_internal.h b/lib/log/log_internal.h index 451629f1c1ba..c77e687e28bc 100644 --- a/lib/log/log_internal.h +++ b/lib/log/log_internal.h @@ -21,6 +21,8 @@ int eal_log_init(const char *id, int facility); */ __rte_internal void eal_log_set_default(FILE *default_log); +__rte_internal +FILE *eal_log_get_default(void); /* * Save a log option for later. diff --git a/lib/log/log_unix.c b/lib/log/log_unix.c index 2dfb0c974b1d..a415bae5774d 100644 --- a/lib/log/log_unix.c +++ b/lib/log/log_unix.c @@ -49,6 +49,10 @@ eal_log_init(const char *id, int facility) { FILE *log_stream; + /* skip if user has already setup a log stream */ + if (eal_log_get_default()) + return 0; + log_stream = fopencookie(NULL, "w+", console_log_func); if (log_stream == NULL) return -1; diff --git a/lib/log/version.map b/lib/log/version.map index 0648f8831aff..6ecc656d1d65 100644 --- a/lib/log/version.map +++ b/lib/log/version.map @@ -25,6 +25,7 @@ DPDK_24 { INTERNAL { global: + eal_log_get_default; eal_log_init; eal_log_level2str; eal_log_save_pattern; -- 2.43.0
Want to make sure that as many log messages as possible get added with the real log stream. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eal/freebsd/eal.c | 14 +++++++------- lib/eal/linux/eal.c | 16 ++++++++-------- lib/eal/unix/eal_unix_log.c | 0 3 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 lib/eal/unix/eal_unix_log.c diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index 94927472edfe..6f0080c4d8c6 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -593,6 +593,13 @@ rte_eal_init(int argc, char **argv) internal_conf->in_memory = false; } + if (eal_log_init(getprogname(), internal_conf->syslog_facility) < 0) { + rte_eal_init_alert("Cannot init logging."); + rte_errno = ENOMEM; + rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); + return -1; + } + if (eal_plugins_init() < 0) { rte_eal_init_alert("Cannot init plugins"); rte_errno = EINVAL; @@ -719,13 +726,6 @@ rte_eal_init(int argc, char **argv) #endif } - if (eal_log_init(getprogname(), internal_conf->syslog_facility) < 0) { - rte_eal_init_alert("Cannot init logging."); - rte_errno = ENOMEM; - rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); - return -1; - } - /* in secondary processes, memory init may allocate additional fbarrays * not present in primary processes, so to avoid any potential issues, * initialize memzones first. diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index bffeb1f34eb9..e24f24b1b0ce 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -973,6 +973,14 @@ rte_eal_init(int argc, char **argv) return -1; } + if (eal_log_init(program_invocation_short_name, + internal_conf->syslog_facility) < 0) { + rte_eal_init_alert("Cannot init logging."); + rte_errno = ENOMEM; + rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); + return -1; + } + if (eal_plugins_init() < 0) { rte_eal_init_alert("Cannot init plugins"); rte_errno = EINVAL; @@ -1107,14 +1115,6 @@ rte_eal_init(int argc, char **argv) #endif } - if (eal_log_init(program_invocation_short_name, - internal_conf->syslog_facility) < 0) { - rte_eal_init_alert("Cannot init logging."); - rte_errno = ENOMEM; - rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); - return -1; - } - #ifdef VFIO_PRESENT if (rte_eal_vfio_setup() < 0) { rte_eal_init_alert("Cannot init VFIO"); diff --git a/lib/eal/unix/eal_unix_log.c b/lib/eal/unix/eal_unix_log.c new file mode 100644 index 000000000000..e69de29bb2d1 -- 2.43.0
The code to parse for log-level option should be same on all OS variants. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eal/common/eal_common_options.c | 46 +++++++++++++++++++++++++++++ lib/eal/common/eal_options.h | 1 + lib/eal/freebsd/eal.c | 42 -------------------------- lib/eal/linux/eal.c | 39 ------------------------ lib/eal/windows/eal.c | 35 ---------------------- 5 files changed, 47 insertions(+), 116 deletions(-) diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index e541f0793964..7310d10dfd78 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -1640,6 +1640,51 @@ eal_parse_huge_unlink(const char *arg, struct hugepage_file_discipline *out) return -1; } +/* Parse the all arguments looking for --log-level */ +int +eal_log_level_parse(int argc, char * const argv[]) +{ + struct internal_config *internal_conf = eal_get_internal_configuration(); + int option_index, opt; + const int old_optind = optind; + const int old_optopt = optopt; + const int old_opterr = opterr; + char *old_optarg = optarg; +#ifdef RTE_EXEC_ENV_FREEBSD + const int old_optreset = optreset; + optreset = 1; +#endif + + optind = 1; + opterr = 0; + + while ((opt = getopt_long(argc, argv, eal_short_options, + eal_long_options, &option_index)) != EOF) { + + switch (opt) { + case OPT_LOG_LEVEL_NUM: + if (eal_parse_common_option(opt, optarg, internal_conf) < 0) + return -1; + break; + case '?': + /* getopt is not happy, stop right now */ + goto out; + default: + continue; + } + } +out: + /* restore getopt lib */ + optind = old_optind; + optopt = old_optopt; + optarg = old_optarg; + opterr = old_opterr; +#ifdef RTE_EXEC_ENV_FREEBSD + optreset = old_optreset; +#endif + return 0; +} + int eal_parse_common_option(int opt, const char *optarg, struct internal_config *conf) @@ -2173,6 +2218,7 @@ rte_vect_set_max_simd_bitwidth(uint16_t bitwidth) return 0; } + void eal_common_usage(void) { diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h index 3cc9cb641284..f3f2e104f6d7 100644 --- a/lib/eal/common/eal_options.h +++ b/lib/eal/common/eal_options.h @@ -96,6 +96,7 @@ enum { extern const char eal_short_options[]; extern const struct option eal_long_options[]; +int eal_log_level_parse(int argc, char * const argv[]); int eal_parse_common_option(int opt, const char *argv, struct internal_config *conf); int eal_option_device_parse(void); diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index a57ee8406f0c..94927472edfe 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -364,48 +364,6 @@ eal_get_hugepage_mem_size(void) return (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX; } -/* Parse the arguments for --log-level only */ -static void -eal_log_level_parse(int argc, char **argv) -{ - int opt; - char **argvopt; - int option_index; - const int old_optind = optind; - const int old_optopt = optopt; - const int old_optreset = optreset; - char * const old_optarg = optarg; - struct internal_config *internal_conf = - eal_get_internal_configuration(); - - argvopt = argv; - optind = 1; - optreset = 1; - - while ((opt = getopt_long(argc, argvopt, eal_short_options, - eal_long_options, &option_index)) != EOF) { - - int ret; - - /* getopt is not happy, stop right now */ - if (opt == '?') - break; - - ret = (opt == OPT_LOG_LEVEL_NUM) ? - eal_parse_common_option(opt, optarg, internal_conf) : 0; - - /* common parser is not happy */ - if (ret < 0) - break; - } - - /* restore getopt lib */ - optind = old_optind; - optopt = old_optopt; - optreset = old_optreset; - optarg = old_optarg; -} - /* Parse the argument given in the command line of the application */ static int eal_parse_args(int argc, char **argv) diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index fd422f1f6236..bffeb1f34eb9 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -546,45 +546,6 @@ eal_parse_vfio_vf_token(const char *vf_token) return -1; } -/* Parse the arguments for --log-level only */ -static void -eal_log_level_parse(int argc, char **argv) -{ - int opt; - char **argvopt; - int option_index; - const int old_optind = optind; - const int old_optopt = optopt; - char * const old_optarg = optarg; - struct internal_config *internal_conf = - eal_get_internal_configuration(); - - argvopt = argv; - optind = 1; - - while ((opt = getopt_long(argc, argvopt, eal_short_options, - eal_long_options, &option_index)) != EOF) { - - int ret; - - /* getopt is not happy, stop right now */ - if (opt == '?') - break; - - ret = (opt == OPT_LOG_LEVEL_NUM) ? - eal_parse_common_option(opt, optarg, internal_conf) : 0; - - /* common parser is not happy */ - if (ret < 0) - break; - } - - /* restore getopt lib */ - optind = old_optind; - optopt = old_optopt; - optarg = old_optarg; -} - static int eal_parse_huge_worker_stack(const char *arg) { diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c index 52f0e7462dd8..85171b27687e 100644 --- a/lib/eal/windows/eal.c +++ b/lib/eal/windows/eal.c @@ -96,41 +96,6 @@ eal_usage(const char *prgname) } } -/* Parse the arguments for --log-level only */ -static void -eal_log_level_parse(int argc, char **argv) -{ - int opt; - char **argvopt; - int option_index; - struct internal_config *internal_conf = - eal_get_internal_configuration(); - - argvopt = argv; - - eal_reset_internal_config(internal_conf); - - while ((opt = getopt_long(argc, argvopt, eal_short_options, - eal_long_options, &option_index)) != EOF) { - - int ret; - - /* getopt is not happy, stop right now */ - if (opt == '?') - break; - - ret = (opt == OPT_LOG_LEVEL_NUM) ? - eal_parse_common_option(opt, optarg, - internal_conf) : 0; - - /* common parser is not happy */ - if (ret < 0) - break; - } - - optind = 0; /* reset getopt lib */ -} - /* Parse the argument given in the command line of the application */ static int eal_parse_args(int argc, char **argv) -- 2.43.0
FreeBSD and Linux logging code can use common code. This also fixes FreeBSD not using syslog. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- doc/guides/linux_gsg/linux_eal_parameters.rst | 27 ------------------- doc/guides/prog_guide/log_lib.rst | 18 +++++++++++-- lib/eal/freebsd/eal.c | 8 ++++++ lib/log/log_freebsd.c | 12 --------- lib/log/{log_linux.c => log_unix.c} | 0 lib/log/meson.build | 12 ++++++--- 6 files changed, 32 insertions(+), 45 deletions(-) delete mode 100644 lib/log/log_freebsd.c rename lib/log/{log_linux.c => log_unix.c} (100%) diff --git a/doc/guides/linux_gsg/linux_eal_parameters.rst b/doc/guides/linux_gsg/linux_eal_parameters.rst index ea8f38139119..d86f94d8a85d 100644 --- a/doc/guides/linux_gsg/linux_eal_parameters.rst +++ b/doc/guides/linux_gsg/linux_eal_parameters.rst @@ -108,30 +108,3 @@ Memory-related options * ``--match-allocations`` Free hugepages back to system exactly as they were originally allocated. - -Other options -~~~~~~~~~~~~~ - -* ``--syslog <syslog facility>`` - - Set syslog facility. Valid syslog facilities are:: - - auth - cron - daemon - ftp - kern - lpr - mail - news - syslog - user - uucp - local0 - local1 - local2 - local3 - local4 - local5 - local6 - local7 diff --git a/doc/guides/prog_guide/log_lib.rst b/doc/guides/prog_guide/log_lib.rst index ff9d1b54a2c8..aacb36c36ce0 100644 --- a/doc/guides/prog_guide/log_lib.rst +++ b/doc/guides/prog_guide/log_lib.rst @@ -5,8 +5,8 @@ Log Library =========== The DPDK Log library provides the logging functionality for other DPDK libraries and drivers. -By default, in a Linux application, logs are sent to syslog and also to the console. -On FreeBSD and Windows applications, logs are sent only to the console. +By default, in a Linux (or FreeBSD) application, logs are sent to syslog and also to the console. +In Windows applications, logs are sent only to the console. However, the log function can be overridden by the user to use a different logging mechanism. Log Levels @@ -29,6 +29,7 @@ will be emitted by the application to the log output. That level can be configured either by the application calling the relevant APIs from the logging library, or by the user passing the ``--log-level`` parameter to the EAL via the application. + Setting Global Log Level ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -59,6 +60,19 @@ For example:: Within an application, the same result can be got using the ``rte_log_set_level_pattern()`` or ``rte_log_set_level_regex()`` APIs. + +Setting syslog facility +~~~~~~~~~~~~~~~~~~~~~~~ + +On Linux and FreeBSD, where syslog is used a ``facility`` argument can be +used to specify what type of program is logging. +The default facility is ``daemon`` but it can be overridden +by the ``--syslog`` EAL parameter. See ``syslog.3`` man page for full values. +For example:: + + /path/to/app --syslog local0 + + Using Logging APIs to Generate Log Messages ------------------------------------------- diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index bab77118e967..a57ee8406f0c 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -53,6 +53,7 @@ #include "eal_options.h" #include "eal_memcfg.h" #include "eal_trace.h" +#include "log_internal.h" #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL) @@ -760,6 +761,13 @@ rte_eal_init(int argc, char **argv) #endif } + if (eal_log_init(getprogname(), internal_conf->syslog_facility) < 0) { + rte_eal_init_alert("Cannot init logging."); + rte_errno = ENOMEM; + rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); + return -1; + } + /* in secondary processes, memory init may allocate additional fbarrays * not present in primary processes, so to avoid any potential issues, * initialize memzones first. diff --git a/lib/log/log_freebsd.c b/lib/log/log_freebsd.c deleted file mode 100644 index 698d3c542337..000000000000 --- a/lib/log/log_freebsd.c +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2023 Intel Corporation - */ - -#include <rte_common.h> -#include "log_internal.h" - -int -eal_log_init(__rte_unused const char *id, __rte_unused int facility) -{ - return 0; -} diff --git a/lib/log/log_linux.c b/lib/log/log_unix.c similarity index 100% rename from lib/log/log_linux.c rename to lib/log/log_unix.c diff --git a/lib/log/meson.build b/lib/log/meson.build index 0d4319b36f77..60516a0b2a2d 100644 --- a/lib/log/meson.build +++ b/lib/log/meson.build @@ -2,8 +2,12 @@ # Copyright(c) 2023 Intel Corporation includes += global_inc -sources = files( - 'log.c', - 'log_' + exec_env + '.c', -) +sources = files('log.c') + +if is_windows + sources += files('log_windows.c') +else + sources += files('log_unix.c') +endif + headers = files('rte_log.h') -- 2.43.0
Improvements and unification of logging library (for 24.07 release). This is update to earlier patch set. v9 - reorder patches and fix FreeBSD build v8 - rebase to current code base where logging in in lib/log use stdio for log timestamp initialization changes (setup log earlier) Stephen Hemminger (5): log: unify logging code eal: make eal_log_level_parse common eal: initialize logging before plugins eal: allow user to set default log stream before init eal: add option to put timestamp on console output app/dumpcap/main.c | 3 + app/pdump/main.c | 3 + app/proc-info/main.c | 3 + app/test/test_eal_flags.c | 9 +++ doc/guides/linux_gsg/linux_eal_parameters.rst | 27 --------- doc/guides/prog_guide/log_lib.rst | 28 +++++++++- lib/eal/common/eal_common_options.c | 56 ++++++++++++++++++- lib/eal/common/eal_options.h | 3 + lib/eal/freebsd/eal.c | 50 +++-------------- lib/eal/linux/eal.c | 55 +++--------------- lib/eal/unix/eal_unix_log.c | 0 lib/eal/windows/eal.c | 35 ------------ lib/log/log.c | 6 ++ lib/log/log_freebsd.c | 12 ---- lib/log/log_internal.h | 11 ++++ lib/log/{log_linux.c => log_unix.c} | 36 +++++++++++- lib/log/log_windows.c | 6 ++ lib/log/meson.build | 12 ++-- lib/log/version.map | 2 + 19 files changed, 184 insertions(+), 173 deletions(-) create mode 100644 lib/eal/unix/eal_unix_log.c delete mode 100644 lib/log/log_freebsd.c rename lib/log/{log_linux.c => log_unix.c} (58%) -- 2.43.0
On Mon, 18 Mar 2024 14:26:33 -0700
Damodharam Ammepalli <damodharam.ammepalli@broadcom.com> wrote:
> On Mon, Mar 18, 2024 at 7:56 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > 12/03/2024 08:52, Dengdui Huang:
> > > Some speeds can be achieved with different number of lanes. For example,
> > > 100Gbps can be achieved using two lanes of 50Gbps or four lanes of 25Gbps.
> > > When use different lanes, the port cannot be up.
> >
> > I'm not sure what you are referring to.
> > I suppose it is not PCI lanes.
> > Please could you link to an explanation of how a port is split in lanes?
> > Which hardware does this?
> >
> >
> >
> This is a snapshot of 100Gb that the latest BCM576xx supports.
> 100Gb (NRZ: 25G per lane, 4 lanes) link speed
> 100Gb (PAM4-56: 50G per lane, 2 lanes) link speed
> 100Gb (PAM4-112: 100G per lane, 1 lane) link speed
>
> Let the user feed in lanes=< integer value> and the NIC driver decides
> the matching combination speed x lanes that works. In future if a new speed
> is implemented with more than 8 lanes, there wouldn't be a need
> to touch this speed command. Using separate lane command would
> be a better alternative to support already shipped products and only new
> drivers would consider this lanes configuration, if applicable.
>
The DPDK does not need more driver specific knobs.
Shouldn't the PMD be able to auto negotiate the speed?
What does Linux do?
[-- Attachment #1: Type: text/plain, Size: 1957 bytes --] On Mon, Mar 18, 2024 at 7:56 AM Thomas Monjalon <thomas@monjalon.net> wrote: > > 12/03/2024 08:52, Dengdui Huang: > > Some speeds can be achieved with different number of lanes. For example, > > 100Gbps can be achieved using two lanes of 50Gbps or four lanes of 25Gbps. > > When use different lanes, the port cannot be up. > > I'm not sure what you are referring to. > I suppose it is not PCI lanes. > Please could you link to an explanation of how a port is split in lanes? > Which hardware does this? > > > This is a snapshot of 100Gb that the latest BCM576xx supports. 100Gb (NRZ: 25G per lane, 4 lanes) link speed 100Gb (PAM4-56: 50G per lane, 2 lanes) link speed 100Gb (PAM4-112: 100G per lane, 1 lane) link speed Let the user feed in lanes=< integer value> and the NIC driver decides the matching combination speed x lanes that works. In future if a new speed is implemented with more than 8 lanes, there wouldn't be a need to touch this speed command. Using separate lane command would be a better alternative to support already shipped products and only new drivers would consider this lanes configuration, if applicable. -- This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it. [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 4233 bytes --]
Update dma perf test document with below support features: 1. Memory-to-device and device-to-memory copy. 2. Skip support. 3. Scatter-gather support. Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com> --- v2: - Rebased the patch. doc/guides/tools/dmaperf.rst | 89 ++++++++++++++++++++++++++---------- 1 file changed, 64 insertions(+), 25 deletions(-) diff --git a/doc/guides/tools/dmaperf.rst b/doc/guides/tools/dmaperf.rst index 6f85fceb8a..dadcc97530 100644 --- a/doc/guides/tools/dmaperf.rst +++ b/doc/guides/tools/dmaperf.rst @@ -5,27 +5,23 @@ dpdk-test-dma-perf Application ============================== The ``dpdk-test-dma-perf`` tool is a Data Plane Development Kit (DPDK) application -that enables testing the performance of DMA (Direct Memory Access) devices available within DPDK. -It provides a test framework to assess the performance of CPU and DMA devices -under various scenarios, such as varying buffer lengths. -Doing so provides insight into the potential performance -when using these DMA devices for acceleration in DPDK applications. +that evaluates the performance of DMA (Direct Memory Access) devices accessible in DPDK environment. +It provides a benchmark framework to assess the performance of CPU and DMA devices +under various combinations, such as varying buffer lengths, scatter-gather copy, copying in remote +memory etc. It helps in evaluating performance of DMA device as hardware acceleration vehicle in +DPDK application. -It supports memory copy performance tests for now, -comparing the performance of CPU and DMA automatically in various conditions -with the help of a pre-set configuration file. +In addition, this tool supports memory-to-memory, memory-to-device and device-to-memory copy tests, +to compare the performance of CPU and DMA capabilities under various conditions with the help of a +pre-set configuration file. Configuration ------------- -This application uses inherent DPDK EAL command-line options -as well as custom command-line options in the application. -An example configuration file for the application is provided -and gives the meanings for each parameter. - -Here is an extracted sample from the configuration file -(the complete sample can be found in the application source directory): +Along with EAL command-line arguments, this application supports various parameters for the +benchmarking through a configuration file. An example configuration file is provided below along +with the application to demonstrate all the parameters. .. code-block:: ini @@ -53,14 +49,35 @@ Here is an extracted sample from the configuration file lcore = 3, 4 eal_args=--in-memory --no-pci + [case3] + skip=1 + type=DMA_MEM_COPY + direction=mem2dev + vchan_dev=raddr=0x200000000,coreid=1,pfid=2,vfid=3 + dma_src_sge=4 + dma_dst_sge=1 + mem_size=10 + buf_size=64,8192,2,MUL + dma_ring_size=1024 + kick_batch=32 + src_numa_node=0 + dst_numa_node=0 + cache_flush=0 + test_seconds=2 + lcore_dma=lcore10@0000:00:04.2, lcore11@0000:00:04.3 + eal_args=--in-memory --file-prefix=test + The configuration file is divided into multiple sections, each section represents a test case. -The four variables ``mem_size``, ``buf_size``, ``dma_ring_size``, and ``kick_batch`` -can vary in each test case. -The format for this is ``variable=first,last,increment,ADD|MUL``. -This means that the first value of the variable is 'first', -the last value is 'last', -'increment' is the step size, -and 'ADD|MUL' indicates whether the change is by addition or multiplication. +The four mandatory variables ``mem_size``, ``buf_size``, ``dma_ring_size``, and ``kick_batch`` +can vary in each test case. The format for this is ``variable=first,last,increment,ADD|MUL``. +This means that the first value of the variable is 'first', the last value is 'last', +'increment' is the step size, and 'ADD|MUL' indicates whether the change is by addition or +multiplication. + +The variables for mem2dev and dev2mem copy are ``direction``, ``vchan_dev`` and can vary in each +test case. If the direction is not configured, the default is mem2mem copy. + +For scatter-gather copy test ``dma_src_sge``, ``dma_dst_sge`` must be configured. Each case can only have one variable change, and each change will generate a scenario, so each case can have multiple scenarios. @@ -69,10 +86,32 @@ and each change will generate a scenario, so each case can have multiple scenari Configuration Parameters ~~~~~~~~~~~~~~~~~~~~~~~~ +``skip`` + To skip a test-case, must be configured as ``1`` + ``type`` The type of the test. Currently supported types are ``DMA_MEM_COPY`` and ``CPU_MEM_COPY``. +``direction`` + The direction of data transfer. + Currently supported directions: + + * ``mem2mem`` - memory to memory copy + + * ``mem2dev`` - memory to device copy + + * ``dev2mem`` - device to memory copy + +``vchan_dev`` + Comma separated bus related parameters for ``mem2dev`` and ``dev2mem`` copy. + +``dma_src_sge`` + Number of source segments for scatter-gather. + +``dma_dst_sge`` + Number of destination segments for scatter-gather. + ``mem_size`` The size of the memory footprint in megabytes (MB) for source and destination. @@ -131,6 +170,6 @@ with the same name as the configuration file with the addition of ``_result.csv` Limitations ----------- -Currently, this tool only supports memory copy performance tests. -Additional enhancements are possible in the future -to support more types of tests for DMA devices and CPUs. +DMA copy to/from remote memory address has following limitations: + + * ``vchan_dev`` config will be same for all the configured DMA devices. -- 2.34.1
Want to make sure that as many log messages as possible get added with the real log stream. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eal/freebsd/eal.c | 16 ++++++++-------- lib/eal/linux/eal.c | 16 ++++++++-------- lib/eal/unix/eal_unix_log.c | 0 3 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 lib/eal/unix/eal_unix_log.c diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index b4f8d68b0a65..e4f00f31fbdd 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -592,6 +592,14 @@ rte_eal_init(int argc, char **argv) internal_conf->in_memory = false; } + if (eal_log_init(program_invocation_short_name, + internal_conf->syslog_facility) < 0) { + rte_eal_init_alert("Cannot init logging."); + rte_errno = ENOMEM; + rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); + return -1; + } + if (eal_plugins_init() < 0) { rte_eal_init_alert("Cannot init plugins"); rte_errno = EINVAL; @@ -718,14 +726,6 @@ rte_eal_init(int argc, char **argv) #endif } - if (eal_log_init(program_invocation_short_name, - internal_conf->syslog_facility) < 0) { - rte_eal_init_alert("Cannot init logging."); - rte_errno = ENOMEM; - rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); - return -1; - } - /* in secondary processes, memory init may allocate additional fbarrays * not present in primary processes, so to avoid any potential issues, * initialize memzones first. diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index bffeb1f34eb9..e24f24b1b0ce 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -973,6 +973,14 @@ rte_eal_init(int argc, char **argv) return -1; } + if (eal_log_init(program_invocation_short_name, + internal_conf->syslog_facility) < 0) { + rte_eal_init_alert("Cannot init logging."); + rte_errno = ENOMEM; + rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); + return -1; + } + if (eal_plugins_init() < 0) { rte_eal_init_alert("Cannot init plugins"); rte_errno = EINVAL; @@ -1107,14 +1115,6 @@ rte_eal_init(int argc, char **argv) #endif } - if (eal_log_init(program_invocation_short_name, - internal_conf->syslog_facility) < 0) { - rte_eal_init_alert("Cannot init logging."); - rte_errno = ENOMEM; - rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); - return -1; - } - #ifdef VFIO_PRESENT if (rte_eal_vfio_setup() < 0) { rte_eal_init_alert("Cannot init VFIO"); diff --git a/lib/eal/unix/eal_unix_log.c b/lib/eal/unix/eal_unix_log.c new file mode 100644 index 000000000000..e69de29bb2d1 -- 2.43.0
When debugging driver or startup issues, it is useful to have a timestamp on each message printed. The messages in syslog already have a timestamp, but often syslog is not available during testing. The timestamp format is chosen to look like the default Linux dmesg timestamp. The first few lines are not timestamped because the flag is stored in internal configuration which is stored in shared memory which is not setup up until a little later in startup process. This logging skips the unnecessary step of going through stdio, which makes it more robust against being called in interrupt handlers etc. Example: $ dpdk-testpmd --log-timestamp -- -i EAL: Detected CPU lcores: 16 EAL: Detected NUMA nodes: 1 EAL: Detected static linkage of DPDK EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' [ 0.112264] testpmd: No probed ethernet devices Interactive-mode selected [ 0.184573] testpmd: create a new mbuf pool <mb_pool_0>: n=163456, size=2176, socket=0 [ 0.184612] testpmd: preferred mempool ops selected: ring_mp_mc Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test/test_eal_flags.c | 9 ++++++++ doc/guides/prog_guide/log_lib.rst | 10 +++++++++ lib/eal/common/eal_common_options.c | 10 +++++++-- lib/eal/common/eal_options.h | 2 ++ lib/log/log_internal.h | 9 ++++++++ lib/log/log_unix.c | 32 +++++++++++++++++++++++++++-- lib/log/log_windows.c | 6 ++++++ lib/log/version.map | 1 + 8 files changed, 75 insertions(+), 4 deletions(-) diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index 6cb4b0675730..07a038fb6051 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -1055,6 +1055,10 @@ test_misc_flags(void) const char * const argv22[] = {prgname, prefix, mp_flag, "--huge-worker-stack=512"}; + /* Try running with --log-timestamp */ + const char * const argv23[] = {prgname, prefix, mp_flag, + "--log-timestamp" }; + /* run all tests also applicable to FreeBSD first */ if (launch_proc(argv0) == 0) { @@ -1162,6 +1166,11 @@ test_misc_flags(void) printf("Error - process did not run ok with --huge-worker-stack=size parameter\n"); goto fail; } + if (launch_proc(argv23) != 0) { + printf("Error - process did not run ok with --log-timestamp parameter\n"); + goto fail; + } + rmdir(hugepath_dir3); rmdir(hugepath_dir2); diff --git a/doc/guides/prog_guide/log_lib.rst b/doc/guides/prog_guide/log_lib.rst index aacb36c36ce0..1d6b2e3cea5d 100644 --- a/doc/guides/prog_guide/log_lib.rst +++ b/doc/guides/prog_guide/log_lib.rst @@ -73,6 +73,16 @@ For example:: /path/to/app --syslog local0 +Console timestamp +~~~~~~~~~~~~~~~~~ + +On Linux and FreeBSD, an optional timestamp can be added before each +message by adding the ``--log-timestamp`` option. +For example:: + + /path/to/app --log-level=lib.*:debug --log-timestamp + + Using Logging APIs to Generate Log Messages ------------------------------------------- diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index 7310d10dfd78..9bc95433d27c 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -77,6 +77,7 @@ eal_long_options[] = { {OPT_IOVA_MODE, 1, NULL, OPT_IOVA_MODE_NUM }, {OPT_LCORES, 1, NULL, OPT_LCORES_NUM }, {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM }, + {OPT_LOG_TIMESTAMP, 0, NULL, OPT_LOG_TIMESTAMP_NUM }, {OPT_TRACE, 1, NULL, OPT_TRACE_NUM }, {OPT_TRACE_DIR, 1, NULL, OPT_TRACE_DIR_NUM }, {OPT_TRACE_BUF_SIZE, 1, NULL, OPT_TRACE_BUF_SIZE_NUM }, @@ -1663,6 +1664,7 @@ eal_log_level_parse(int argc, char * const argv[]) switch (opt) { case OPT_LOG_LEVEL_NUM: + case OPT_LOG_TIMESTAMP_NUM: if (eal_parse_common_option(opt, optarg, internal_conf) < 0) return -1; break; @@ -1890,7 +1892,7 @@ eal_parse_common_option(int opt, const char *optarg, break; #endif - case OPT_LOG_LEVEL_NUM: { + case OPT_LOG_LEVEL_NUM: if (eal_parse_log_level(optarg) < 0) { EAL_LOG(ERR, "invalid parameters for --" @@ -1898,7 +1900,10 @@ eal_parse_common_option(int opt, const char *optarg, return -1; } break; - } + + case OPT_LOG_TIMESTAMP_NUM: + eal_log_enable_timestamp(); + break; #ifndef RTE_EXEC_ENV_WINDOWS case OPT_TRACE_NUM: { @@ -2261,6 +2266,7 @@ eal_common_usage(void) " --"OPT_PROC_TYPE" Type of this process (primary|secondary|auto)\n" #ifndef RTE_EXEC_ENV_WINDOWS " --"OPT_SYSLOG" Set syslog facility\n" + " --"OPT_LOG_TIMESTAMP" Timestamp log output\n" #endif " --"OPT_LOG_LEVEL"=<level> Set global log level\n" " --"OPT_LOG_LEVEL"=<type-match>:<level>\n" diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h index f3f2e104f6d7..e24c9eca53ca 100644 --- a/lib/eal/common/eal_options.h +++ b/lib/eal/common/eal_options.h @@ -35,6 +35,8 @@ enum { OPT_LCORES_NUM, #define OPT_LOG_LEVEL "log-level" OPT_LOG_LEVEL_NUM, +#define OPT_LOG_TIMESTAMP "log-timestamp" + OPT_LOG_TIMESTAMP_NUM, #define OPT_TRACE "trace" OPT_TRACE_NUM, #define OPT_TRACE_DIR "trace-dir" diff --git a/lib/log/log_internal.h b/lib/log/log_internal.h index c77e687e28bc..1af27fe8f9d3 100644 --- a/lib/log/log_internal.h +++ b/lib/log/log_internal.h @@ -5,8 +5,10 @@ #ifndef LOG_INTERNAL_H #define LOG_INTERNAL_H +#include <stdbool.h> #include <stdio.h> #include <stdint.h> +#include <time.h> #include <rte_compat.h> @@ -44,4 +46,11 @@ const char *eal_log_level2str(uint32_t level); __rte_internal void rte_eal_log_cleanup(void); +/* + * Add timestamp to console logs + */ +__rte_internal +void eal_log_enable_timestamp(void); + + #endif /* LOG_INTERNAL_H */ diff --git a/lib/log/log_unix.c b/lib/log/log_unix.c index a415bae5774d..71ce366b6825 100644 --- a/lib/log/log_unix.c +++ b/lib/log/log_unix.c @@ -2,24 +2,52 @@ * Copyright(c) 2010-2014 Intel Corporation */ +#include <stdbool.h> #include <stdio.h> #include <sys/types.h> +#include <sys/uio.h> #include <syslog.h> +#include <time.h> +#include <unistd.h> #include <rte_log.h> #include "log_internal.h" +static bool timestamp_enabled; +static struct timespec log_started; + +void +eal_log_enable_timestamp(void) +{ + timestamp_enabled = true; + clock_gettime(CLOCK_MONOTONIC, &log_started); +} + /* * default log function */ static ssize_t console_log_write(__rte_unused void *c, const char *buf, size_t size) { + struct timespec ts; ssize_t ret; - /* write on stderr */ - ret = fwrite(buf, 1, size, stderr); + if (timestamp_enabled) { + clock_gettime(CLOCK_MONOTONIC, &ts); + ts.tv_sec -= log_started.tv_sec; + ts.tv_nsec -= log_started.tv_nsec; + if (ts.tv_nsec < 0) { + --ts.tv_sec; + ts.tv_nsec += 1000000000ul; + } + + ret = fprintf(stderr, "[%8lu.%06lu] %.*s", + ts.tv_sec, ts.tv_nsec / 1000u, + (int) size, buf); + } else { + ret = fwrite(buf, 1, size, stderr); + } fflush(stderr); /* Syslog error levels are from 0 to 7, so subtract 1 to convert */ diff --git a/lib/log/log_windows.c b/lib/log/log_windows.c index a6a08895501e..0c471bfb15f6 100644 --- a/lib/log/log_windows.c +++ b/lib/log/log_windows.c @@ -6,6 +6,12 @@ #include <rte_log.h> #include "log_internal.h" +void +eal_log_enable_timestamp(void) +{ + /* not implemented */ +} + /* set the log to default function, called during eal init process. */ int eal_log_init(__rte_unused const char *id, __rte_unused int facility) diff --git a/lib/log/version.map b/lib/log/version.map index 6ecc656d1d65..32c555f29e79 100644 --- a/lib/log/version.map +++ b/lib/log/version.map @@ -25,6 +25,7 @@ DPDK_24 { INTERNAL { global: + eal_log_enable_timestamp; eal_log_get_default; eal_log_init; eal_log_level2str; -- 2.43.0
It is useful for application to be able to set the default log stream before call rte_eal_init(). This makes all messages go to the new default. For example, to skip using syslog; just doing rte_openlog_stream(stderr); There is no reason for helper command line applications to clutter syslog with messages. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/dumpcap/main.c | 3 +++ app/pdump/main.c | 3 +++ app/proc-info/main.c | 3 +++ lib/log/log.c | 6 ++++++ lib/log/log_internal.h | 2 ++ lib/log/log_unix.c | 4 ++++ lib/log/version.map | 1 + 7 files changed, 22 insertions(+) diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c index cc0f66b2bc61..27934ca7e688 100644 --- a/app/dumpcap/main.c +++ b/app/dumpcap/main.c @@ -633,6 +633,9 @@ static void dpdk_init(void) rte_panic("No memory\n"); } + /* keep any logging away from syslog. */ + rte_openlog_stream(stderr); + if (rte_eal_init(eal_argc, eal_argv) < 0) rte_exit(EXIT_FAILURE, "EAL init failed: is primary process running?\n"); } diff --git a/app/pdump/main.c b/app/pdump/main.c index a9205e130bb1..7b9ba68b1a14 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -995,6 +995,9 @@ main(int argc, char **argv) argc += 2; + /* keep any logging away from syslog. */ + rte_openlog_stream(stderr); + diag = rte_eal_init(argc, argp); if (diag < 0) rte_panic("Cannot init EAL\n"); diff --git a/app/proc-info/main.c b/app/proc-info/main.c index b672aaefbe99..24ee52c4ac7a 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -2149,6 +2149,9 @@ main(int argc, char **argv) argc += 4; + /* keep any logging away from syslog. */ + rte_openlog_stream(stderr); + ret = rte_eal_init(argc, argp); if (ret < 0) rte_panic("Cannot init EAL\n"); diff --git a/lib/log/log.c b/lib/log/log.c index 255f757d94cc..4cc944305057 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -519,6 +519,12 @@ eal_log_set_default(FILE *default_log) #endif } +FILE * +eal_log_get_default(void) +{ + return default_log_stream; +} + /* * Called by eal_cleanup */ diff --git a/lib/log/log_internal.h b/lib/log/log_internal.h index 451629f1c1ba..c77e687e28bc 100644 --- a/lib/log/log_internal.h +++ b/lib/log/log_internal.h @@ -21,6 +21,8 @@ int eal_log_init(const char *id, int facility); */ __rte_internal void eal_log_set_default(FILE *default_log); +__rte_internal +FILE *eal_log_get_default(void); /* * Save a log option for later. diff --git a/lib/log/log_unix.c b/lib/log/log_unix.c index 2dfb0c974b1d..a415bae5774d 100644 --- a/lib/log/log_unix.c +++ b/lib/log/log_unix.c @@ -49,6 +49,10 @@ eal_log_init(const char *id, int facility) { FILE *log_stream; + /* skip if user has already setup a log stream */ + if (eal_log_get_default()) + return 0; + log_stream = fopencookie(NULL, "w+", console_log_func); if (log_stream == NULL) return -1; diff --git a/lib/log/version.map b/lib/log/version.map index 0648f8831aff..6ecc656d1d65 100644 --- a/lib/log/version.map +++ b/lib/log/version.map @@ -25,6 +25,7 @@ DPDK_24 { INTERNAL { global: + eal_log_get_default; eal_log_init; eal_log_level2str; eal_log_save_pattern; -- 2.43.0
The code to parse for log-level option should be same on all OS variants. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eal/common/eal_common_options.c | 46 +++++++++++++++++++++++++++++ lib/eal/common/eal_options.h | 1 + lib/eal/freebsd/eal.c | 42 -------------------------- lib/eal/linux/eal.c | 39 ------------------------ lib/eal/windows/eal.c | 35 ---------------------- 5 files changed, 47 insertions(+), 116 deletions(-) diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index e541f0793964..7310d10dfd78 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -1640,6 +1640,51 @@ eal_parse_huge_unlink(const char *arg, struct hugepage_file_discipline *out) return -1; } +/* Parse the all arguments looking for --log-level */ +int +eal_log_level_parse(int argc, char * const argv[]) +{ + struct internal_config *internal_conf = eal_get_internal_configuration(); + int option_index, opt; + const int old_optind = optind; + const int old_optopt = optopt; + const int old_opterr = opterr; + char *old_optarg = optarg; +#ifdef RTE_EXEC_ENV_FREEBSD + const int old_optreset = optreset; + optreset = 1; +#endif + + optind = 1; + opterr = 0; + + while ((opt = getopt_long(argc, argv, eal_short_options, + eal_long_options, &option_index)) != EOF) { + + switch (opt) { + case OPT_LOG_LEVEL_NUM: + if (eal_parse_common_option(opt, optarg, internal_conf) < 0) + return -1; + break; + case '?': + /* getopt is not happy, stop right now */ + goto out; + default: + continue; + } + } +out: + /* restore getopt lib */ + optind = old_optind; + optopt = old_optopt; + optarg = old_optarg; + opterr = old_opterr; +#ifdef RTE_EXEC_ENV_FREEBSD + optreset = old_optreset; +#endif + return 0; +} + int eal_parse_common_option(int opt, const char *optarg, struct internal_config *conf) @@ -2173,6 +2218,7 @@ rte_vect_set_max_simd_bitwidth(uint16_t bitwidth) return 0; } + void eal_common_usage(void) { diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h index 3cc9cb641284..f3f2e104f6d7 100644 --- a/lib/eal/common/eal_options.h +++ b/lib/eal/common/eal_options.h @@ -96,6 +96,7 @@ enum { extern const char eal_short_options[]; extern const struct option eal_long_options[]; +int eal_log_level_parse(int argc, char * const argv[]); int eal_parse_common_option(int opt, const char *argv, struct internal_config *conf); int eal_option_device_parse(void); diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index 004b8fad2db3..b4f8d68b0a65 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -363,48 +363,6 @@ eal_get_hugepage_mem_size(void) return (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX; } -/* Parse the arguments for --log-level only */ -static void -eal_log_level_parse(int argc, char **argv) -{ - int opt; - char **argvopt; - int option_index; - const int old_optind = optind; - const int old_optopt = optopt; - const int old_optreset = optreset; - char * const old_optarg = optarg; - struct internal_config *internal_conf = - eal_get_internal_configuration(); - - argvopt = argv; - optind = 1; - optreset = 1; - - while ((opt = getopt_long(argc, argvopt, eal_short_options, - eal_long_options, &option_index)) != EOF) { - - int ret; - - /* getopt is not happy, stop right now */ - if (opt == '?') - break; - - ret = (opt == OPT_LOG_LEVEL_NUM) ? - eal_parse_common_option(opt, optarg, internal_conf) : 0; - - /* common parser is not happy */ - if (ret < 0) - break; - } - - /* restore getopt lib */ - optind = old_optind; - optopt = old_optopt; - optreset = old_optreset; - optarg = old_optarg; -} - /* Parse the argument given in the command line of the application */ static int eal_parse_args(int argc, char **argv) diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index fd422f1f6236..bffeb1f34eb9 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -546,45 +546,6 @@ eal_parse_vfio_vf_token(const char *vf_token) return -1; } -/* Parse the arguments for --log-level only */ -static void -eal_log_level_parse(int argc, char **argv) -{ - int opt; - char **argvopt; - int option_index; - const int old_optind = optind; - const int old_optopt = optopt; - char * const old_optarg = optarg; - struct internal_config *internal_conf = - eal_get_internal_configuration(); - - argvopt = argv; - optind = 1; - - while ((opt = getopt_long(argc, argvopt, eal_short_options, - eal_long_options, &option_index)) != EOF) { - - int ret; - - /* getopt is not happy, stop right now */ - if (opt == '?') - break; - - ret = (opt == OPT_LOG_LEVEL_NUM) ? - eal_parse_common_option(opt, optarg, internal_conf) : 0; - - /* common parser is not happy */ - if (ret < 0) - break; - } - - /* restore getopt lib */ - optind = old_optind; - optopt = old_optopt; - optarg = old_optarg; -} - static int eal_parse_huge_worker_stack(const char *arg) { diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c index 52f0e7462dd8..85171b27687e 100644 --- a/lib/eal/windows/eal.c +++ b/lib/eal/windows/eal.c @@ -96,41 +96,6 @@ eal_usage(const char *prgname) } } -/* Parse the arguments for --log-level only */ -static void -eal_log_level_parse(int argc, char **argv) -{ - int opt; - char **argvopt; - int option_index; - struct internal_config *internal_conf = - eal_get_internal_configuration(); - - argvopt = argv; - - eal_reset_internal_config(internal_conf); - - while ((opt = getopt_long(argc, argvopt, eal_short_options, - eal_long_options, &option_index)) != EOF) { - - int ret; - - /* getopt is not happy, stop right now */ - if (opt == '?') - break; - - ret = (opt == OPT_LOG_LEVEL_NUM) ? - eal_parse_common_option(opt, optarg, - internal_conf) : 0; - - /* common parser is not happy */ - if (ret < 0) - break; - } - - optind = 0; /* reset getopt lib */ -} - /* Parse the argument given in the command line of the application */ static int eal_parse_args(int argc, char **argv) -- 2.43.0
FreeBSD and Linux logging code can use common code. This also fixes FreeBSD not using syslog. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- doc/guides/linux_gsg/linux_eal_parameters.rst | 27 ------------------- doc/guides/prog_guide/log_lib.rst | 18 +++++++++++-- lib/eal/freebsd/eal.c | 8 ++++++ lib/log/log_freebsd.c | 12 --------- lib/log/{log_linux.c => log_unix.c} | 0 lib/log/meson.build | 12 ++++++--- 6 files changed, 32 insertions(+), 45 deletions(-) delete mode 100644 lib/log/log_freebsd.c rename lib/log/{log_linux.c => log_unix.c} (100%) diff --git a/doc/guides/linux_gsg/linux_eal_parameters.rst b/doc/guides/linux_gsg/linux_eal_parameters.rst index ea8f38139119..d86f94d8a85d 100644 --- a/doc/guides/linux_gsg/linux_eal_parameters.rst +++ b/doc/guides/linux_gsg/linux_eal_parameters.rst @@ -108,30 +108,3 @@ Memory-related options * ``--match-allocations`` Free hugepages back to system exactly as they were originally allocated. - -Other options -~~~~~~~~~~~~~ - -* ``--syslog <syslog facility>`` - - Set syslog facility. Valid syslog facilities are:: - - auth - cron - daemon - ftp - kern - lpr - mail - news - syslog - user - uucp - local0 - local1 - local2 - local3 - local4 - local5 - local6 - local7 diff --git a/doc/guides/prog_guide/log_lib.rst b/doc/guides/prog_guide/log_lib.rst index ff9d1b54a2c8..aacb36c36ce0 100644 --- a/doc/guides/prog_guide/log_lib.rst +++ b/doc/guides/prog_guide/log_lib.rst @@ -5,8 +5,8 @@ Log Library =========== The DPDK Log library provides the logging functionality for other DPDK libraries and drivers. -By default, in a Linux application, logs are sent to syslog and also to the console. -On FreeBSD and Windows applications, logs are sent only to the console. +By default, in a Linux (or FreeBSD) application, logs are sent to syslog and also to the console. +In Windows applications, logs are sent only to the console. However, the log function can be overridden by the user to use a different logging mechanism. Log Levels @@ -29,6 +29,7 @@ will be emitted by the application to the log output. That level can be configured either by the application calling the relevant APIs from the logging library, or by the user passing the ``--log-level`` parameter to the EAL via the application. + Setting Global Log Level ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -59,6 +60,19 @@ For example:: Within an application, the same result can be got using the ``rte_log_set_level_pattern()`` or ``rte_log_set_level_regex()`` APIs. + +Setting syslog facility +~~~~~~~~~~~~~~~~~~~~~~~ + +On Linux and FreeBSD, where syslog is used a ``facility`` argument can be +used to specify what type of program is logging. +The default facility is ``daemon`` but it can be overridden +by the ``--syslog`` EAL parameter. See ``syslog.3`` man page for full values. +For example:: + + /path/to/app --syslog local0 + + Using Logging APIs to Generate Log Messages ------------------------------------------- diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index bab77118e967..004b8fad2db3 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -760,6 +760,14 @@ rte_eal_init(int argc, char **argv) #endif } + if (eal_log_init(program_invocation_short_name, + internal_conf->syslog_facility) < 0) { + rte_eal_init_alert("Cannot init logging."); + rte_errno = ENOMEM; + rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); + return -1; + } + /* in secondary processes, memory init may allocate additional fbarrays * not present in primary processes, so to avoid any potential issues, * initialize memzones first. diff --git a/lib/log/log_freebsd.c b/lib/log/log_freebsd.c deleted file mode 100644 index 698d3c542337..000000000000 --- a/lib/log/log_freebsd.c +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2023 Intel Corporation - */ - -#include <rte_common.h> -#include "log_internal.h" - -int -eal_log_init(__rte_unused const char *id, __rte_unused int facility) -{ - return 0; -} diff --git a/lib/log/log_linux.c b/lib/log/log_unix.c similarity index 100% rename from lib/log/log_linux.c rename to lib/log/log_unix.c diff --git a/lib/log/meson.build b/lib/log/meson.build index 0d4319b36f77..60516a0b2a2d 100644 --- a/lib/log/meson.build +++ b/lib/log/meson.build @@ -2,8 +2,12 @@ # Copyright(c) 2023 Intel Corporation includes += global_inc -sources = files( - 'log.c', - 'log_' + exec_env + '.c', -) +sources = files('log.c') + +if is_windows + sources += files('log_windows.c') +else + sources += files('log_unix.c') +endif + headers = files('rte_log.h') -- 2.43.0
Improvements and unification of logging library (for 24.07 release). This is update to earlier patch set. v8 - rebase to current code base where logging in in lib/log use stdio for log timestamp initialization changes (setup log earlier) Stephen Hemminger (5): log: unify logging code eal: make eal_log_level_parse common eal: allow user to set default log stream before init eal: add option to put timestamp on console output eal: initialize logging before plugins app/dumpcap/main.c | 3 + app/pdump/main.c | 3 + app/proc-info/main.c | 3 + app/test/test_eal_flags.c | 9 +++ doc/guides/linux_gsg/linux_eal_parameters.rst | 27 --------- doc/guides/prog_guide/log_lib.rst | 28 +++++++++- lib/eal/common/eal_common_options.c | 56 ++++++++++++++++++- lib/eal/common/eal_options.h | 3 + lib/eal/freebsd/eal.c | 50 +++-------------- lib/eal/linux/eal.c | 55 +++--------------- lib/eal/unix/eal_unix_log.c | 0 lib/eal/windows/eal.c | 35 ------------ lib/log/log.c | 6 ++ lib/log/log_freebsd.c | 12 ---- lib/log/log_internal.h | 11 ++++ lib/log/{log_linux.c => log_unix.c} | 36 +++++++++++- lib/log/log_windows.c | 6 ++ lib/log/meson.build | 12 ++-- lib/log/version.map | 2 + 19 files changed, 184 insertions(+), 173 deletions(-) create mode 100644 lib/eal/unix/eal_unix_log.c delete mode 100644 lib/log/log_freebsd.c rename lib/log/{log_linux.c => log_unix.c} (58%) -- 2.43.0