[EXT] Re: [RFC PATCH] graph: add support for pcap trace for graph

Amit Prakash Shukla amitprakashs at marvell.com
Fri Jan 6 11:40:30 CET 2023


Thanks Stephen for the review. Sure, will use lib/pcapng.

I see dpdk libpcapng adds most of the debugging data, however I would like to add a node name to the packets which I am thinking of adding using 'comment' option under 'Enhanced Packet Block' .

Please let me know if that's fine.

Thanks,
Amit Shukla

> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Friday, December 23, 2022 10:17 PM
> To: Amit Prakash Shukla <amitprakashs at marvell.com>
> Cc: Jerin Jacob Kollanukkaran <jerinj at marvell.com>; Kiran Kumar
> Kokkilagadda <kirankumark at marvell.com>; Nithin Kumar Dabilpuram
> <ndabilpuram at marvell.com>; dev at dpdk.org
> Subject: [EXT] Re: [RFC PATCH] graph: add support for pcap trace for graph
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Fri, 23 Dec 2022 17:32:35 +0530
> Amit Prakash Shukla <amitprakashs at marvell.com> 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


More information about the dev mailing list