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 248E3A0093; Fri, 23 Dec 2022 17:47:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0667B41156; Fri, 23 Dec 2022 17:47:18 +0100 (CET) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mails.dpdk.org (Postfix) with ESMTP id 23BBA410F9 for ; Fri, 23 Dec 2022 17:47:17 +0100 (CET) Received: by mail-pf1-f180.google.com with SMTP id 65so3656187pfx.9 for ; Fri, 23 Dec 2022 08:47:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=zeF/9TBEns2LJpjpNSPasBTCZNoVjmiPLqk0gVOuWys=; b=73G9vn1jQpnvbhpvS8Q2bpCLOn3v3AgGFzQrIWGAnoCsnLpi8kTmcnuCF5HHgvw2GU /6DOSTtotJe+7Is335mBEkXrxluJbB8tS68fGmPMChK9dIjz996ppJ+nM/iSvEMxzJoH F2bNKjl7iezU2XIqL0rpZxVvVN+bmrdFPjMc+eDa/5zMHpw/kYwhykzwqIjYMbhLwXRT TfNmiXlIPVQwJW54LHBO0ZoJU6X0XlDMOLZPbj4smFVvhUSFNrGdr1Sksidw3Y+DCuny 70IwEjEwyckdHEB7EQfz/mSS7vZ7rq4gF8zUI3IC3JuiTSYxL6B/9ShPiCvRucF56OMd 4PxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zeF/9TBEns2LJpjpNSPasBTCZNoVjmiPLqk0gVOuWys=; b=lpUmpfhQUZbUvgANWSByVNpDvfv5V3YF2mg+edBkUGI1PCaEqjvZ8KFXvQwvv8nlxg KNNM9tf7Wojz+bvfxM7VtCzhndY8ykqrbFPw0P4SKZnK037N2TppGjF3DaQ27vMyx467 00RQFQarsu8V63FKHSqfSFBozWYtOZgfylUGgIgo1r5voTTiyYUx7IxQ7rBWBE1ZClc6 FgTPLz1p7i+wHK0gRyNwAzVb1MlKKOIZ8oDvXvKUWzmdz1VV01UdMgDIX1IgnQQXcUx4 38iQKeHN4LgUF6AWybE1eCwFAUY76qifTOc3jibG5gGQo7Iyxl7RyJVxHAW9cgfDuxmg aEoA== X-Gm-Message-State: AFqh2kqNGG7+dPBxlX6amgZsesSS2BA3WyuSyOGWo2+hqaBk6iJOsMiN i2VWRCKUaZIOOccs7cAc/cOGFg== X-Google-Smtp-Source: AMrXdXszGOFwqxKy9nqZfIY1A95HVYzOFbzLralxGSu4mgJZgiOOxLX+jIRR4uLRuHCzoIe+SqE5QQ== X-Received: by 2002:a62:aa17:0:b0:57f:ebff:7ef6 with SMTP id e23-20020a62aa17000000b0057febff7ef6mr10718128pff.3.1671814036340; Fri, 23 Dec 2022 08:47:16 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id b27-20020aa7951b000000b00580c8a15d13sm622774pfp.11.2022.12.23.08.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Dec 2022 08:47:16 -0800 (PST) Date: Fri, 23 Dec 2022 08:47:14 -0800 From: Stephen Hemminger To: Amit Prakash Shukla Cc: Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram , Subject: Re: [RFC PATCH] graph: add support for pcap trace for graph Message-ID: <20221223084714.446ebc08@hermes.local> In-Reply-To: <20221223120235.3171516-1-amitprakashs@marvell.com> References: <20221223120235.3171516-1-amitprakashs@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Fri, 23 Dec 2022 17:32:35 +0530 Amit Prakash Shukla wrote: > + > + pcap_trace.file_descriptor = open(pcap_trace.file_name, > + O_CREAT | O_TRUNC | O_WRONLY, 0664); > + if (pcap_trace.file_descriptor < 0) { > + ret = 1; > + goto done; > + } > + pcap_trace.n_pcap_data_written = 0; > + > + /* Write file header. */ > + memset(&file_hdr, 0, sizeof(file_hdr)); > + file_hdr.magic = 0xa1b2c3d4; > + file_hdr.major_version = 2; > + file_hdr.minor_version = 4; > + file_hdr.time_zone = 0; > + file_hdr.max_packet_size_in_bytes = ((1 << 16) - 1); > + file_hdr.packet_type = pcap_trace.packet_type; > + n = write(pcap_trace.file_descriptor, &file_hdr, sizeof(file_hdr)); > + if (n != sizeof(file_hdr)) { > + ret = 1; > + goto done; > + } > + > + while (pcap_trace.n_bytes > pcap_trace.n_pcap_data_written) { > + int n = pcap_trace.n_bytes - pcap_trace.n_pcap_data_written; > + > + n = write(pcap_trace.file_descriptor, NAK please use lib/pcapng rather than rolling your own pcap format code