[PATCH] net/pcap: support MTU set

Ferruh Yigit ferruh.yigit at xilinx.com
Tue Apr 26 19:03:49 CEST 2022


On 3/22/2022 1:02 PM, Ido Goshen wrote:
> This test https://doc.dpdk.org/dts/test_plans/jumboframes_test_plan.html#test-case-jumbo-frames-with-no-jumbo-frame-support fails for pcap pmd
> Jumbo packet is unexpectedly received and transmitted
> 

Hi Ido,

Yes, pcap ignores MTU, but I don't see why it should use MTU (except 
from making above DTS test pass).

For the cases packets written to .pcap file or read from a .pcap file, 
most probably user is interested in all packets, I don't think using MTU 
to filter the packets is a good idea, missing packets (because of MTU) 
can confuse users.

Unless there is a good use case, I am for rejecting this feature.

> ----------------------------------------------------------------------------------------
> without patch:
> 
> root at u18c_3nbp:/home/cgs/workspace/master/jumbo# ./dpdk-testpmd --no-huge -m1024 -l 0-2  --vdev='net_pcap0,rx_pcap=rx_pcap=jumbo_9000.pcap,tx_pcap=file_tx.pcap' -- --no-flush-rx --total-num-mbufs=2048 -i
> ...
> testpmd> start
> ...
> testpmd> show port stats 0
> 
>    ######################## NIC statistics for port 0  ########################
>    RX-packets: 1          RX-missed: 0          RX-bytes:  8996
>    RX-errors: 0
>    RX-nombuf:  0
>    TX-packets: 1          TX-errors: 0          TX-bytes:  8996
> 
>    Throughput (since last show)
>    Rx-pps:            0          Rx-bps:            0
>    Tx-pps:            0          Tx-bps:            0
>    ############################################################################
> 
> ----------------------------------------------------------------------------------------
> While with the patch it will fail unless --max-pkt-len is used to support jumbo
> 
> root at u18c_3nbp:/home/cgs/workspace/master/jumbo# ./dpdk-testpmd-patch --no-huge -m1024 -l 0-2  --vdev='net_pcap0,rx_pcap=rx_pcap=jumbo_9000.pcap,tx_pcap=file_tx.pcap' -- --no-flush-rx --total-num-mbufs=2048 -i
> ...
> testpmd> start
> ...
> testpmd> show port stats 0
> 
>    ######################## NIC statistics for port 0  ########################
>    RX-packets: 0          RX-missed: 0          RX-bytes:  0
>    RX-errors: 1
>    RX-nombuf:  0
>    TX-packets: 0          TX-errors: 0          TX-bytes:  0
> 
>    Throughput (since last show)
>    Rx-pps:            0          Rx-bps:            0
>    Tx-pps:            0          Tx-bps:            0
>    ############################################################################
> 
> root at u18c_3nbp:/home/cgs/workspace/master/jumbo# ./dpdk-testpmd-patch --no-huge -m1024 -l 0-2  --vdev='net_pcap0,rx_pcap=rx_pcap=jumbo_9000.pcap,tx_pcap=file_tx.pcap' -- --no-flush-rx --total-num-mbufs=2048 -i --max-pkt-len 9400
> ...
> testpmd> start
> ...
> testpmd> show port stats 0
> 
>    ######################## NIC statistics for port 0  ########################
>    RX-packets: 1          RX-missed: 0          RX-bytes:  8996
>    RX-errors: 0
>    RX-nombuf:  0
>    TX-packets: 1          TX-errors: 0          TX-bytes:  8996
> 
>    Throughput (since last show)
>    Rx-pps:            0          Rx-bps:            0
>    Tx-pps:            0          Tx-bps:            0
>    ############################################################################
> 
>> -----Original Message-----
>> From: Ido Goshen
>> Sent: Thursday, 17 March 2022 21:12
>> To: Stephen Hemminger <stephen at networkplumber.org>
>> Cc: Ferruh Yigit <ferruh.yigit at intel.com>; dev at dpdk.org
>> Subject: RE: [PATCH] net/pcap: support MTU set
>>
>> As far as I can see the initial device MTU is derived from port *RX* configuration
>> in struct rte_eth_rxmode https://doc.dpdk.org/api-
>> 21.11/structrte__eth__rxmode.html
>> Couple of real NICs I've tested (ixgbe, i40e based) don't allow oversized, tests
>> details can be seen in https://bugs.dpdk.org/show_bug.cgi?id=961
>>
>>> -----Original Message-----
>>> From: Stephen Hemminger <stephen at networkplumber.org>
>>> Sent: Thursday, 17 March 2022 20:21
>>> To: Ido Goshen <Ido at cgstowernetworks.com>
>>> Cc: Ferruh Yigit <ferruh.yigit at intel.com>; dev at dpdk.org
>>> Subject: Re: [PATCH] net/pcap: support MTU set
>>>
>>> On Thu, 17 Mar 2022 19:43:47 +0200
>>> ido g <ido at cgstowernetworks.com> wrote:
>>>
>>>> +		if (unlikely(header.caplen > dev->data->mtu)) {
>>>> +			pcap_q->rx_stat.err_pkts++;
>>>> +			rte_pktmbuf_free(mbuf);
>>>> +			break;
>>>> +		}
>>>
>>> MTU should only be enforced on transmit.
>>> Other real network devices allow oversized packets.
>>>
>>> Since the pcap file is something user provides, if you don't want that
>>> then use something to filter the file.



More information about the dev mailing list