Skip to contentSkip to conversation

net/pcap: add snaplen argument

PATCH New Tianli Lai 1 participant 1 message Mar 13, 2022 Network drivers

lore
Share & tools
lore

Tianli Lai

author
#0 lore raw

PATCH 1/1 net/pcap: add snaplen argument

snaplen argument would set the length of each packet that will save to pcap file.

---
 doc/guides/nics/pcap_ring.rst  | 16 ++++++-
 drivers/net/pcap/pcap_ethdev.c | 79 ++++++++++++++++------------------
 2 files changed, 52 insertions(+), 43 deletions(-)
doc/guides/nics/pcap_ring.rst +15 -1
index acb1f00e30..8fb309212f 100644
@@ -94,6 +94,13 @@ The different stream types are:
 
         iface=eth0
 
+*   snaplen: Defines the length of one packet that will save pcap file.
+    the length of each packets can be snap by set this value.
+    this value between 64 and 65535.
+
+        snaplen=<packet len>
+
+
 Runtime Config Options
 ^^^^^^^^^^^^^^^^^^^^^^
 
@@ -132,6 +139,13 @@ Runtime Config Options
 
 In this case, one dummy rx queue is created for each tx queue argument passed
 
+ - Receive packets on Tx and set the length of packet, for example::
+
+    --vdev 'net_pcap0,tx_pcap=file_tx.pcap,snaplen=100'
+
+In this case, one dummy rx queue is created for each tx queue argument passed and the length of each packet would not over 100 byte.
+
+
 Examples of Usage
 ^^^^^^^^^^^^^^^^^
 
@@ -140,7 +154,7 @@ Read packets from one pcap file and write them to another:
 .. code-block:: console
 
     ./<build_dir>/app/dpdk-testpmd -l 0-3 -n 4 \
-        --vdev 'net_pcap0,rx_pcap=file_rx.pcap,tx_pcap=file_tx.pcap' \
+        --vdev 'net_pcap0,rx_pcap=file_rx.pcap,tx_pcap=file_tx.pcap,snaplen=100' \
         -- --port-topology=chained
 
 Read packets from a network interface and write them to a pcap file:
drivers/net/pcap/pcap_ethdev.c +37 -42

215 lines not on this page · raw message

Signature · 1 line
2.27.0