mirror of
				https://github.com/xdp-project/bpf-examples.git
				synced 2024-05-06 15:54:53 +00:00 
			
		
		
		
	lib_xsk_extend: Add comment describing XDP metadata and BTF
Add a large comments to the most central piece of code that access the right offset into the metadata based on the BTF info we have extracted. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
This commit is contained in:
		@@ -180,6 +180,11 @@ int xsk_btf__read_member(void **dest, size_t size,
 | 
			
		||||
	if (entry->size != size)
 | 
			
		||||
		return -EFAULT;
 | 
			
		||||
 | 
			
		||||
	/* Remember XDP-hints are located in metadata (xdp_ctx->data_meta),
 | 
			
		||||
	 * which is located just before packet data starts.  Thus, accessing BTF
 | 
			
		||||
	 * described memory area via a negative offset, based on the size of the
 | 
			
		||||
	 * BTF struct that XDP-prog used.
 | 
			
		||||
	 */
 | 
			
		||||
	*dest = (void *)((char *)addr - xbi->type->size + entry->offset);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user