Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4974468pxj; Tue, 22 Jun 2021 12:08:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9U12WCXGWDRsHmZ7VKF5AwRx31zfZJaOm4Jx5VlfL1i31+T5FNlbe3NcYwUog27SybEX7 X-Received: by 2002:a05:6e02:972:: with SMTP id q18mr155392ilt.88.1624388924459; Tue, 22 Jun 2021 12:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624388924; cv=none; d=google.com; s=arc-20160816; b=HIua3Wlsp6x/5XGphIj/ZG7xeTAnCB4eaVxAdpkSTBA8PLtVuqdZ3Tuo1varQo8kyH CHcMMu7TG6MXiz7IcXu6Hb0tfOL22IrYbEnfN6HbzzvP6wXBKe4WnhdiFfQETC5MKe8H URxRcmJADFiPIdVxKnCO7xNT+pvFgA7176OV4HQm3R9xo1aDxl29hOyIWpuwXwnYPZYE shNp01cF6bYC+dFEuJjnaWNw5rsu2L92JckypoLhNTBhylIutY5DbMGQPyLsH4jOSu5A k98T5BKGPYlRPhWdZMWgpFYAtqOsDxRHxxFEJixKiA1H69hOWpP8+W2wX0oNU087r5c/ dN4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=sqkIz23YOfUBXyt7ht8SWBUlAlFc2bb+Pfeq9/PC0Ck=; b=HGASN2hz+CjvY1CHECJRLtJRiCXvw/MXvKdYccWRHJahOezgIIcpRE1UVO8WxNLvvc DwTnHW2RksQ4RRkjZCBcZXlslgZU7zRXnSLexV2oCMHjqhChWMRD0IzP8b81vykcNYyZ 9K6UhD6HFjbBO0qIeiLWUbu+Wl1VbQ5kflIktBf6+WJH60rUFVX14C0w7prcGGng7Mlo kc4qJZYN80t4sZq7zyMFUGZG4d7Ojzpn2YAKDyyxFPJCU/1It2/LUb618HFQGclx5U7E tJoASumEnURgFdZVvPR+0JRH4C33zsnqv6SHUPvKq9GLR82H9KjFVmpmnUtqMA6mcDU3 KuWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si23699758ion.58.2021.06.22.12.08.31; Tue, 22 Jun 2021 12:08:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232680AbhFVTKL (ORCPT + 99 others); Tue, 22 Jun 2021 15:10:11 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:48239 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230146AbhFVTKL (ORCPT ); Tue, 22 Jun 2021 15:10:11 -0400 Received: (Authenticated sender: i.maximets@ovn.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id C16ED200002; Tue, 22 Jun 2021 19:07:51 +0000 (UTC) Subject: Re: [PATCH] docs: af_xdp: consistent indentation in examples To: Ilya Maximets , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= Cc: Magnus Karlsson , Jonathan Lemon , "David S. Miller" , Jakub Kicinski , Jonathan Corbet , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210622185647.3705104-1-i.maximets@ovn.org> From: Ilya Maximets Message-ID: Date: Tue, 22 Jun 2021 21:07:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210622185647.3705104-1-i.maximets@ovn.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/22/21 8:56 PM, Ilya Maximets wrote: > Examples in this document use all kinds of indentation from 3 to 5 > spaces and even mixed with tabs. Making them all even and equal to > 4 spaces. > > Signed-off-by: Ilya Maximets > --- Ugh. Sorry, meant to send for bpf-next, but lost the subject prefix somewhere... Can re-send if needed. > Documentation/networking/af_xdp.rst | 32 ++++++++++++++--------------- > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/Documentation/networking/af_xdp.rst b/Documentation/networking/af_xdp.rst > index 2ccc5644cc98..42576880aa4a 100644 > --- a/Documentation/networking/af_xdp.rst > +++ b/Documentation/networking/af_xdp.rst > @@ -290,19 +290,19 @@ round-robin example of distributing packets is shown below: > #define MAX_SOCKS 16 > > struct { > - __uint(type, BPF_MAP_TYPE_XSKMAP); > - __uint(max_entries, MAX_SOCKS); > - __uint(key_size, sizeof(int)); > - __uint(value_size, sizeof(int)); > + __uint(type, BPF_MAP_TYPE_XSKMAP); > + __uint(max_entries, MAX_SOCKS); > + __uint(key_size, sizeof(int)); > + __uint(value_size, sizeof(int)); > } xsks_map SEC(".maps"); > > static unsigned int rr; > > SEC("xdp_sock") int xdp_sock_prog(struct xdp_md *ctx) > { > - rr = (rr + 1) & (MAX_SOCKS - 1); > + rr = (rr + 1) & (MAX_SOCKS - 1); > > - return bpf_redirect_map(&xsks_map, rr, XDP_DROP); > + return bpf_redirect_map(&xsks_map, rr, XDP_DROP); > } > > Note, that since there is only a single set of FILL and COMPLETION > @@ -379,7 +379,7 @@ would look like this for the TX path: > .. code-block:: c > > if (xsk_ring_prod__needs_wakeup(&my_tx_ring)) > - sendto(xsk_socket__fd(xsk_handle), NULL, 0, MSG_DONTWAIT, NULL, 0); > + sendto(xsk_socket__fd(xsk_handle), NULL, 0, MSG_DONTWAIT, NULL, 0); > > I.e., only use the syscall if the flag is set. > > @@ -442,9 +442,9 @@ purposes. The supported statistics are shown below: > .. code-block:: c > > struct xdp_statistics { > - __u64 rx_dropped; /* Dropped for reasons other than invalid desc */ > - __u64 rx_invalid_descs; /* Dropped due to invalid descriptor */ > - __u64 tx_invalid_descs; /* Dropped due to invalid descriptor */ > + __u64 rx_dropped; /* Dropped for reasons other than invalid desc */ > + __u64 rx_invalid_descs; /* Dropped due to invalid descriptor */ > + __u64 tx_invalid_descs; /* Dropped due to invalid descriptor */ > }; > > XDP_OPTIONS getsockopt > @@ -483,15 +483,15 @@ like this: > .. code-block:: c > > // struct xdp_rxtx_ring { > - // __u32 *producer; > - // __u32 *consumer; > - // struct xdp_desc *desc; > + // __u32 *producer; > + // __u32 *consumer; > + // struct xdp_desc *desc; > // }; > > // struct xdp_umem_ring { > - // __u32 *producer; > - // __u32 *consumer; > - // __u64 *desc; > + // __u32 *producer; > + // __u32 *consumer; > + // __u64 *desc; > // }; > > // typedef struct xdp_rxtx_ring RING; >