From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B81C642DD1; Wed, 5 Jul 2023 13:37:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 907184021F; Wed, 5 Jul 2023 13:37:51 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2050.outbound.protection.outlook.com [40.107.93.50]) by mails.dpdk.org (Postfix) with ESMTP id 2299340150 for ; Wed, 5 Jul 2023 13:37:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fpVtPnjI+hQlo6ipe1AtPPGK80eFFE8FUaqtPbj99RTcZNJ4w+cDX+rNXjbw7E5v5MRasvbDar5nY5DQUFLHfXMwF2pD/LKhC9Yuvg8VMUnxnhnEtwCKZoOteJEjiOMgtNtBV7F3KEPNULoMk+eur8dbOEBRpgSZ3sWnTIgYLxipUB/V+qovsUUVmItuwPehQTTA2t+gf85NAttH4joa47t/7I7r8H8o2NvTBZmCVpQHYYQbpf/vzU11jBv4iBluP4f6Fg+FoXQvPCgnQX18PBDAwRWBpc0lZwp1FpmUz5evxxm0IMbyckeXQN9iecpn1NwX+BOOTz2L3HkEgUNPmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0itkompYUFJZ82JlDzJ0WIFMsFAtyB0j9L914nvts9g=; b=MXRYu79hO21T0zMBShQ5Naf6c7pEm9JLhZRKogDMao/n/AU4ysHG2Qmntl41OZL4ydNdsyIZ4aaQC0F23tPd+dgH3TbVcxs/OcjE9R4uM7pPs3khABNFlcBlw27hnjWGQ2/5ZlApXNs3ZjGQWBoj2u1clkPVUk2cYNGotVdCkq8MR4G31lp2NIhiqvb4zjUtvSAYyartQ2+ofRDRc0x4osNo5EH6CvuHq2iVGwPdNinw+eZZKaUZjGvytiQ9ZksSx5E2xPvBM5Fc7KXD+D0b7QDzcuAdSBdSPmCkqrpqAbIM4UTjQvkGQKKmAdjXLf0Ufr3dGu9O5j7J+Ce+Z2o7ig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0itkompYUFJZ82JlDzJ0WIFMsFAtyB0j9L914nvts9g=; b=UqKDD8zjNmWHJOFEHIelFdcq76t2+MgVReCGsbE/KHl9h3Twj+4fJBOgSyLrC8g4Ucw4RNAeE5VcnV9ub4wJasFLMYkmzaFOLYztchhsy9ozfLs23xTcS414YVIlOgC3qfwAUN6Ofqsa8zIZZiReIJugOs+YXZF4mqyYb0So6Oo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by DM6PR12MB4266.namprd12.prod.outlook.com (2603:10b6:5:21a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Wed, 5 Jul 2023 11:37:48 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::369d:5f05:aaba:ebd8]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::369d:5f05:aaba:ebd8%3]) with mapi id 15.20.6565.016; Wed, 5 Jul 2023 11:37:47 +0000 Message-ID: Date: Wed, 5 Jul 2023 12:37:41 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US To: Stephen Hemminger , dev@dpdk.org Cc: Ido Goshen References: <20220317174347.110909-1-ido@cgstowernetworks.com> <20230704210237.72933-1-stephen@networkplumber.org> From: Ferruh Yigit Subject: Re: [PATCH v2] pcap: support MTU set In-Reply-To: <20230704210237.72933-1-stephen@networkplumber.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P302CA0020.GBRP302.PROD.OUTLOOK.COM (2603:10a6:600:2c1::9) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|DM6PR12MB4266:EE_ X-MS-Office365-Filtering-Correlation-Id: fb386155-041c-49ee-7d29-08db7d4c414e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5Wt0/TEOAsQmzlun45n0hv71KlDOzhBYQVApjE1ca8nbOzElSsLRV6LJKwpaTXCGxnYTw/nNEH1eykTY70UM2pYgdKlUU/8MfA2RHWpkXSLJskey1rSF5U+k//C6DmuIha3ntjyDrPF+X80pZUSUyGIQ/Trzn67pUxm2BKREyCJbvL92eruCwBKgXATVmUk5S/zP1hGnD8kFjfMyg/OCbIgh3fbCnF9VbTvyDasHj3Vep3oJ5kSYX6sJtdz2U1gCuFek+PUadGAqHTNpVyydQcI3s04tV/Cr+N6mJrG23z4QcySdAWP3DjJX4DRD1reD/93ItJgesrL7LA4fWSU8zdGPoIPb7I0FP6dZQg/OkMqux3nhjfXFMBKFBCwbCllfqMwphH0Is4oHM2xBrINQyJ1NrmhvvHLlK30Oa4f9xkPIU3u9mxO3g9GqhBFBXRV4txpxsDLnMb0mH4X9U1dVWdferlLeWfgycVga5Q2WffPtOnuXGEFDYla5+KuoGzHkjeygr+3GvRkjyXCVwg0azW+njebv4yWT7geUWTKKOituBJMyusNalBd6IKGawqriT6FAuK6HMC1SxED6Xa1v4pId4pPIVLVt0D3UcBHhxLg48Q8YmEK4GNuKHP1QfE53XPHaL83BVKLnDz9qDO4EUw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(366004)(376002)(346002)(396003)(451199021)(8936002)(8676002)(2906002)(2616005)(5660300002)(31686004)(6506007)(53546011)(44832011)(26005)(186003)(41300700001)(6666004)(6486002)(4326008)(66946007)(66556008)(66476007)(36756003)(316002)(83380400001)(478600001)(6512007)(38100700002)(86362001)(31696002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZkVHOXh6dnI3NmUwb3pyRGRNZ3o1bWhwRVVXNW5kaUpDekhUUEhCRjdBR3JE?= =?utf-8?B?dFVKQ2NWMVkxenJiVytCSTJ1dXVPSTViUHliSS9xdngvaE94YXIvYmpFVzAy?= =?utf-8?B?dTZSbzZRM2gvRVJBcmlJdHEyajRQcnVybE83cjZ1SWxUQ0ZKT0s1blI2UlIr?= =?utf-8?B?aUxBUE00YXhTMUhxN3FSWjBEanNzK3FpZ2ZJeFU2R3BvUzhDMkdrTjJOWGps?= =?utf-8?B?Yy9Nd2Y1RXJ1MFBPM1BZTGQwdmd2eUFIN0RWR2FpclpUMzRGMTdYNFdMVWt5?= =?utf-8?B?UFpMcXowaE41Rm1Xcm1VMHQzem5zWjdUTUNYQVlBYllRS242TDZ1TXJnMnZL?= =?utf-8?B?amtMbHh4dEZEcklSb0svM3V3c3FiSkN6R0JTVHA1Q1BQcmlCK0ltVVhnT2VJ?= =?utf-8?B?WlZWWEZ1V1dWWk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?utf-8?B?OVJ4cXVXa015RjRISHczeFBySHZJamtvTjllWElZdUlhQkcvR2ZwYW01NjFM?= =?utf-8?B?QVZQT1pWVHF4amxOSDhuajdoc3Z1aHBoTGFSU0xXY2ZBTE5zRmdBTE5heS9E?= =?utf-8?B?K0xnQXBNUHV0RzhEU2JrdzJnQlF6UG5RVGUxekh4Wk5mNVY3SmRkc1dWdndR?= =?utf-8?B?OWlheUlmV0tPRFp6YURJYmN2VjF6Vk9KUU5VWXNROWozK2ExODltSDE2dTdH?= =?utf-8?B?NUZkeXM1SGxURGRvd05FTUo5S0k3RU1BVDR5SVg1REErS1pXTFJsUUY5eEo1?= =?utf-8?B?VG41STJWc3UzdmlWd3FZNmN0MEx4WWxJRkxwTWJJeFNLc3kvNHFySzZ4a2pH?= =?utf-8?B?QXZISE9WNzgxSnVCdythR1dLenptRzVvWmVrOEh5TUxRQm5wMENFamJ0Tkhw?= =?utf-8?B?ZWlxa1RlR1RhbGtmTlgvRi9ubUtVUU44ZXc0eHhSQW5YaFRCeGxvaWZzeVhi?= =?utf-8?B?cEQrdTVSSmt1TnZMNW44VWNYalNFRy8rR1FQTzJLZ0RLR1pCNC9aa0hmckRz?= =?utf-8?B?Y1RGUFpUMFJvdTE0NVFuV2E4VGxid2d0UXBZbnBnalh5MmtiS05OaVpwOVp3?= =?utf-8?B?M2ZHUnNDSkJxTXdIbldZUFV0NUdPZVdmNTdudlpEVTFlalpXdHAwZlpyZkRh?= =?utf-8?B?WFJ0em9kMmtKMVNhQmw1RWRKd3hzUmNhbCszZThGbTlQUEZnQWcvNU5HZHZk?= =?utf-8?B?Q3ptd0hFRERQTDE4dmxsTVpFVFl6TWpCS0Y5dkgzNkRDN2ZXWlFJd2JaL0pM?= =?utf-8?Q?fJo5Xq/uJybJTwI61VfHh+BLn?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb386155-041c-49ee-7d29-08db7d4c414e X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2023 11:37:47.2597 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: L7UxzLh9dODbvEdquoNBOytPTNWEOFD7mr5vn40rCcNj28YlZzF461eXz9e+6PTC X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4266 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 7/4/2023 10:02 PM, Stephen Hemminger wrote: > Support rte_eth_dev_set_mtu for pcap driver when the > pcap device is convigured to point to a network interface. > > This is rebased an consolidated from earlier version. > Added support for FreeBSD. > As far as I understand motivation is to make pcap PMD behave close the physical NIC and able to test the application MTU feature. If so, Ido's v4 was simpler, which doesn't distinguish if pcap backed by physical interface or .pcap file. What was wrong with that approach? > Signed-off-by: Ido Goshen > Signed-off-by: Stephen Hemminger > --- > v2 - fix FreeBSD part > > drivers/net/pcap/pcap_ethdev.c | 49 ++++++++++++++++++++++++++- > drivers/net/pcap/pcap_osdep.h | 1 + > drivers/net/pcap/pcap_osdep_freebsd.c | 23 +++++++++++++ > drivers/net/pcap/pcap_osdep_linux.c | 21 ++++++++++++ > drivers/net/pcap/pcap_osdep_windows.c | 7 ++++ > 5 files changed, 100 insertions(+), 1 deletion(-) > Better to update driver documentation and release notes too. > diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c > index bfec0850456f..672f42d30d8e 100644 > --- a/drivers/net/pcap/pcap_ethdev.c > +++ b/drivers/net/pcap/pcap_ethdev.c > @@ -5,6 +5,7 @@ > */ > > #include > +#include > #include > > #include > @@ -495,8 +496,13 @@ eth_pcap_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > */ > ret = pcap_sendpacket(pcap, > rte_pktmbuf_read(mbuf, 0, len, temp_data), len); > - if (unlikely(ret != 0)) > + if (unlikely(ret != 0)) { > + /* Oversize packet dropped due to MTU */ > + if (errno == EMSGSIZE) > + continue; This will leak mbuf, since loop continues application will assume driver sent the packet and freed mbuf. Ido's version does it right. > break; > + } > + > num_tx++; > tx_bytes += len; > rte_pktmbuf_free(mbuf); > @@ -808,6 +814,46 @@ eth_stats_reset(struct rte_eth_dev *dev) > return 0; > } > > +static int > +eth_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) > +{ > + struct pmd_internals *internals = dev->data->dev_private; > + unsigned int i; > + bool is_supported = false; > + int ret; > + > + for (i = 0; i < dev->data->nb_rx_queues; i++) { > + struct pcap_rx_queue *queue = &internals->rx_queue[i]; > + > + if ((strcmp(queue->type, ETH_PCAP_IFACE_ARG) == 0) || > + (strcmp(queue->type, ETH_PCAP_RX_IFACE_ARG) == 0) || > + (strcmp(queue->type, ETH_PCAP_RX_IFACE_IN_ARG) == 0)) { > + ret = osdep_iface_mtu_set(queue->name, mtu); > + if (ret < 0) > + return ret; > + is_supported = true; > + } If there are multiple devices (each pcap queue represents a device), and one in the middle one fails to set MTU, there will be mixed MTU values in devices. > + } > + > + for (i = 0; i < dev->data->nb_tx_queues; i++) { > + struct pcap_tx_queue *queue = &internals->tx_queue[i]; > + > + if ((strcmp(queue->type, ETH_PCAP_IFACE_ARG) == 0) || Rx devices and Tx devices can be same device, causing duplicated MTU set for same device, but it is hard to detect if they are same devices. At least it is easier to detect when queue type is 'ETH_PCAP_IFACE_ARG', what about set MTU once for this queue type?