<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Hey Stephen, I saw the comment you made to re-run UTs but I cant distinguish if anything actually happened, the report still says everything is passing.</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Dylan Schneider <schneide@qti.qualcomm.com><br>
<b>Sent:</b> Monday, June 16, 2025 8:29 AM<br>
<b>To:</b> dev@dpdk.org <dev@dpdk.org>; Thomas Monjalon <thomas@monjalon.net>; Reshma Pattan <reshma.pattan@intel.com>; Stephen Hemminger <stephen@networkplumber.org>; Jerin Jacob <jerinj@marvell.com>; Kiran Kumar K <kirankumark@marvell.com>; Nithin Dabilpuram
 <ndabilpuram@marvell.com>; Zhirun Yan <yanzhirun_163@163.com><br>
<b>Subject:</b> Re: [PATCH v2] pcapng: allow any protocol link type for the interface block</font>
<div> </div>
</div>
<style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<p style="text-align:center"><span style="background-color:#ffff00; font-size:14px; font-family:sans-serif; color:#000000"><strong>WARNING:</strong> This email originated from outside of Qualcomm. Please be wary of any links or attachments, and do not enable
 macros.</span></p>
<div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:11pt; color:rgb(0,0,0)">
Hello Stephen and Thomas,</div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:11pt; color:rgb(0,0,0)">
I uploaded this patch which says it has UT failures, but upon closer inspection, there aren't any signs of any tests failing. Can you please take a look? </div>
<div id="x_appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Schneide <schneide@qti.qualcomm.com><br>
<b>Sent:</b> Friday, June 6, 2025 3:52 PM<br>
<b>To:</b> dev@dpdk.org <dev@dpdk.org>; Thomas Monjalon <thomas@monjalon.net>; Reshma Pattan <reshma.pattan@intel.com>; Stephen Hemminger <stephen@networkplumber.org>; Jerin Jacob <jerinj@marvell.com>; Kiran Kumar K <kirankumark@marvell.com>; Nithin Dabilpuram
 <ndabilpuram@marvell.com>; Zhirun Yan <yanzhirun_163@163.com><br>
<b>Cc:</b> Dylan Schneider <schneide@qti.qualcomm.com><br>
<b>Subject:</b> [PATCH v2] pcapng: allow any protocol link type for the interface block</font>
<div> </div>
</div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_PlainText">From: Dylan Schneider <schneide@qti.qualcomm.com><br>
<br>
Allow the user to specify protocol link type when creating pcapng files.<br>
This change is needed to specify the protocol type in the pcapng file,<br>
DLT_EN10MB specifies ethernet packets only. This will allow dissectors<br>
for other protocols to be used on files generated by pcapng.<br>
<br>
Includes a breaking change to rte_pcapng_add_interface to add link_type<br>
parameter. Existing calls to the function have been updated to pass<br>
DLT_EN10MB for the link type argument.<br>
<br>
Fixes: d1da6d0d04c7 ("pcapng: require per-interface information")<br>
Signed-off-by: Dylan Schneider <schneide@qti.qualcomm.com><br>
Cc: stephen@networkplumber.org<br>
---<br>
 .mailmap                               |  1 +<br>
 app/dumpcap/main.c                     |  4 ++--<br>
 app/test/test_pcapng.c                 |  8 ++++----<br>
 doc/guides/rel_notes/release_25_07.rst |  5 ++++-<br>
 lib/graph/graph_pcap.c                 |  4 +++-<br>
 lib/pcapng/meson.build                 |  2 ++<br>
 lib/pcapng/rte_pcapng.c                | 21 +++++++++++++++------<br>
 lib/pcapng/rte_pcapng.h                |  4 +++-<br>
 8 files changed, 34 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/.mailmap b/.mailmap<br>
index 91e08f4a1f..a585124832 100644<br>
--- a/.mailmap<br>
+++ b/.mailmap<br>
@@ -390,6 +390,7 @@ Dukai Yuan <dukaix.yuan@intel.com><br>
 Dumitru Ceara <dceara@redhat.com> <dumitru.ceara@gmail.com><br>
 Duncan Bellamy <dunk@denkimushi.com><br>
 Dustin Lundquist <dustin@null-ptr.net><br>
+Dylan Schneider <schneide@qti.qualcomm.com><br>
 Dzmitry Sautsa <dzmitryx.sautsa@intel.com><br>
 Ed Czeck <ed.czeck@atomicrules.com><br>
 Eduard Serra <eserra@vmware.com><br>
diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c<br>
index 3d3c0dbc66..e0e2b26269 100644<br>
--- a/app/dumpcap/main.c<br>
+++ b/app/dumpcap/main.c<br>
@@ -800,8 +800,8 @@ static dumpcap_out_t create_output(void)<br>
                 free(os);<br>
 <br>
                 TAILQ_FOREACH(intf, &interfaces, next) {<br>
-                       if (rte_pcapng_add_interface(ret.pcapng, intf->port, intf->ifname,<br>
-                                                    intf->ifdescr, intf->opts.filter) < 0)<br>
+                       if (rte_pcapng_add_interface(ret.pcapng, intf->port, DLT_EN10MB,<br>
+                               intf->ifname, intf->ifdescr, intf->opts.filter) < 0)<br>
                                 rte_exit(EXIT_FAILURE, "rte_pcapng_add_interface %u failed\n",<br>
                                         intf->port);<br>
                 }<br>
diff --git a/app/test/test_pcapng.c b/app/test/test_pcapng.c<br>
index 8f2cff36c3..bcf99724fa 100644<br>
--- a/app/test/test_pcapng.c<br>
+++ b/app/test/test_pcapng.c<br>
@@ -345,7 +345,7 @@ test_add_interface(void)<br>
         }<br>
 <br>
         /* Add interface to the file */<br>
-       ret = rte_pcapng_add_interface(pcapng, port_id,<br>
+       ret = rte_pcapng_add_interface(pcapng, port_id, DLT_EN10MB,<br>
                                        NULL, NULL, NULL);<br>
         if (ret < 0) {<br>
                 fprintf(stderr, "can not add port %u\n", port_id);<br>
@@ -353,7 +353,7 @@ test_add_interface(void)<br>
         }<br>
 <br>
         /* Add interface with ifname and ifdescr */<br>
-       ret = rte_pcapng_add_interface(pcapng, port_id,<br>
+       ret = rte_pcapng_add_interface(pcapng, port_id, DLT_EN10MB,<br>
                                        "myeth", "Some long description", NULL);<br>
         if (ret < 0) {<br>
                 fprintf(stderr, "can not add port %u with ifname\n", port_id);<br>
@@ -361,7 +361,7 @@ test_add_interface(void)<br>
         }<br>
 <br>
         /* Add interface with filter */<br>
-       ret = rte_pcapng_add_interface(pcapng, port_id,<br>
+       ret = rte_pcapng_add_interface(pcapng, port_id, DLT_EN10MB,<br>
                                        NULL, NULL, "tcp port 8080");<br>
         if (ret < 0) {<br>
                 fprintf(stderr, "can not add port %u with filter\n", port_id);<br>
@@ -406,7 +406,7 @@ test_write_packets(void)<br>
         }<br>
 <br>
         /* Add interface to the file */<br>
-       ret = rte_pcapng_add_interface(pcapng, port_id,<br>
+       ret = rte_pcapng_add_interface(pcapng, port_id, DLT_EN10MB,<br>
                                        NULL, NULL, NULL);<br>
         if (ret < 0) {<br>
                 fprintf(stderr, "can not add port %u\n", port_id);<br>
diff --git a/doc/guides/rel_notes/release_25_07.rst b/doc/guides/rel_notes/release_25_07.rst<br>
index 6b070801de..2396c7b014 100644<br>
--- a/doc/guides/rel_notes/release_25_07.rst<br>
+++ b/doc/guides/rel_notes/release_25_07.rst<br>
@@ -108,7 +108,10 @@ API Changes<br>
    This section is a comment. Do not overwrite or remove it.<br>
    Also, make sure to start the actual text at the margin.<br>
    =======================================================<br>
-<br>
+* pcapng: Changed the API for adding interfaces to include a link type argument.<br>
+  The link type was previously hardcoded to the ethernet link type in the API.<br>
+  This argument is added to ``rte_pcapng_add_interface``.<br>
+  These functions are versioned to retain binary compatibility until the next LTS release.<br>
 <br>
 ABI Changes<br>
 -----------<br>
diff --git a/lib/graph/graph_pcap.c b/lib/graph/graph_pcap.c<br>
index 89525f1220..13d86b7a18 100644<br>
--- a/lib/graph/graph_pcap.c<br>
+++ b/lib/graph/graph_pcap.c<br>
@@ -11,6 +11,8 @@<br>
 #include <rte_mbuf.h><br>
 #include <rte_pcapng.h><br>
 <br>
+#include <pcap/pcap.h><br>
+<br>
 #include "rte_graph_worker.h"<br>
 <br>
 #include "graph_pcap_private.h"<br>
@@ -117,7 +119,7 @@ graph_pcap_file_open(const char *filename)<br>
 <br>
         /* Add the configured interfaces as possible capture ports */<br>
         RTE_ETH_FOREACH_DEV(portid) {<br>
-               ret = rte_pcapng_add_interface(pcapng_fd, portid,<br>
+               ret = rte_pcapng_add_interface(pcapng_fd, portid, DLT_EN10MB,<br>
                                                NULL, NULL, NULL);<br>
                 if (ret < 0) {<br>
                         graph_err("Graph rte_pcapng_add_interface port %u failed: %d",<br>
diff --git a/lib/pcapng/meson.build b/lib/pcapng/meson.build<br>
index 4549925d41..3aa7ba5155 100644<br>
--- a/lib/pcapng/meson.build<br>
+++ b/lib/pcapng/meson.build<br>
@@ -5,3 +5,5 @@ sources = files('rte_pcapng.c')<br>
 headers = files('rte_pcapng.h')<br>
 <br>
 deps += ['ethdev']<br>
+<br>
+use_function_versioning = true<br>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c<br>
index cacbefdc50..f18af25983 100644<br>
--- a/lib/pcapng/rte_pcapng.c<br>
+++ b/lib/pcapng/rte_pcapng.c<br>
@@ -200,11 +200,10 @@ pcapng_section_block(rte_pcapng_t *self,<br>
 }<br>
 <br>
 /* Write an interface block for a DPDK port */<br>
-RTE_EXPORT_SYMBOL(rte_pcapng_add_interface)<br>
-int<br>
-rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port,<br>
-                        const char *ifname, const char *ifdescr,<br>
-                        const char *filter)<br>
+RTE_DEFAULT_SYMBOL(26, int, rte_pcapng_add_interface,<br>
+                       (rte_pcapng_t *self, uint16_t port, uint16_t link_type,<br>
+                       const char *ifname, const char *ifdescr,<br>
+                       const char *filter))<br>
 {<br>
         struct pcapng_interface_block *hdr;<br>
         struct rte_eth_dev_info dev_info;<br>
@@ -274,7 +273,7 @@ rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port,<br>
         hdr = (struct pcapng_interface_block *)buf;<br>
         *hdr = (struct pcapng_interface_block) {<br>
                 .block_type = PCAPNG_INTERFACE_BLOCK,<br>
-               .link_type = 1,         /* DLT_EN10MB - Ethernet */<br>
+               .link_type = link_type,<br>
                 .block_length = len,<br>
         };<br>
 <br>
@@ -319,6 +318,16 @@ rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port,<br>
         return write(self->outfd, buf, len);<br>
 }<br>
 <br>
+RTE_VERSION_SYMBOL(25, int, rte_pcapng_add_interface,<br>
+                                 (rte_pcapng_t *self, uint16_t port,<br>
+                                  const char *ifname, const char *ifdescr,<br>
+                                  const char *filter))<br>
+{<br>
+       /* Call the new version with a default link_type (Ethernet) */<br>
+       return rte_pcapng_add_interface(self, port, DLT_EN10MB,<br>
+                                                                       ifname, ifdescr, filter);<br>
+}<br>
+<br>
 /*<br>
  * Write an Interface statistics block at the end of capture.<br>
  */<br>
diff --git a/lib/pcapng/rte_pcapng.h b/lib/pcapng/rte_pcapng.h<br>
index 48f2b57564..9880d415c4 100644<br>
--- a/lib/pcapng/rte_pcapng.h<br>
+++ b/lib/pcapng/rte_pcapng.h<br>
@@ -71,6 +71,8 @@ rte_pcapng_close(rte_pcapng_t *self);<br>
  *  The handle to the packet capture file<br>
  * @param port<br>
  *  The Ethernet port to report stats on.<br>
+ * @param link_type<br>
+ *   The link type (e.g., DLT_EN10MB).<br>
  * @param ifname (optional)<br>
  *  Interface name to record in the file.<br>
  *  If not specified, name will be constructed from port<br>
@@ -84,7 +86,7 @@ rte_pcapng_close(rte_pcapng_t *self);<br>
  * must be added.<br>
  */<br>
 int<br>
-rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port,<br>
+rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port, uint16_t link_type,<br>
                          const char *ifname, const char *ifdescr,<br>
                          const char *filter);<br>
 <br>
-- <br>
2.27.0<br>
<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>