From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mail.toke.dk (Postfix) with ESMTPS id A4846982F76 for ; Tue, 28 Jun 2022 21:50:08 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=gZcZvZSM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656445808; x=1687981808; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eOg3zMPpNLqDqX1LA+Vo6P9BOiKuNyiBlLVUYpXAOWM=; b=gZcZvZSMVEOnVFsSLIwUAC36JlvL4A11WmvFkZlwy3mEabIO8XEEZ6q4 AfUOXxC+fEExKt3mp4igpdvHdDPxbfJH63zDq0FaXs9D4GB71+UmnW011 q8BHxB0WN7OBzSDcHoAAPDC0VXeVyxoD3xKYeFRBrQB6ZVwbB1a/p6ueY lmsph7XBRNt75BxW3HcwfKSUxKr68zslnkoYvfvuSR5LkMQJ7T3sZdu2Q Aa2vOBkD9Xn4zBQbN9+VCMosQ6eV5MqqGochnWp83toS+dcHvrOWXvpiQ JW4WyR9ZeicKN3dGxlI6HHQjWs1SwKlcvEEmbeoGiPJtH9Twa7fVfPawJ w==; X-IronPort-AV: E=McAfee;i="6400,9594,10392"; a="262243059" X-IronPort-AV: E=Sophos;i="5.92,229,1650956400"; d="scan'208";a="262243059" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2022 12:50:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,229,1650956400"; d="scan'208";a="658257636" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by fmsmga004.fm.intel.com with ESMTP; 28 Jun 2022 12:50:02 -0700 Received: from newjersey.igk.intel.com (newjersey.igk.intel.com [10.102.20.203]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 25SJmr9o022013; Tue, 28 Jun 2022 20:50:00 +0100 From: Alexander Lobakin To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Date: Tue, 28 Jun 2022 21:48:10 +0200 Message-Id: <20220628194812.1453059-51-alexandr.lobakin@intel.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628194812.1453059-1-alexandr.lobakin@intel.com> References: <20220628194812.1453059-1-alexandr.lobakin@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Message-ID-Hash: P5TF7I52UXGS32MWHF2MME3RNRSN3SW2 X-Message-ID-Hash: P5TF7I52UXGS32MWHF2MME3RNRSN3SW2 X-MailFrom: alexandr.lobakin@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Alexander Lobakin , Larysa Zaremba , Michal Swiatkowski , Jesper Dangaard Brouer , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Toke Hoiland-Jorgensen , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesse Brandeburg , John Fastabend , Yajun Deng , Willem de Bruijn , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, xdp-hints@xdp-project.net X-Mailman-Version: 3.3.5 Precedence: list Subject: [xdp-hints] [PATCH RFC bpf-next 50/52] libbpf: introduce a couple memory access helpers List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: RnJvbTogTGFyeXNhIFphcmVtYmEgPGxhcnlzYS56YXJlbWJhQGludGVsLmNvbT4NCg0KSW4gQlBG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