linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs: af_xdp: consistent indentation in examples
@ 2021-06-22 18:56 Ilya Maximets
  2021-06-22 19:07 ` Ilya Maximets
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ilya Maximets @ 2021-06-22 18:56 UTC (permalink / raw)
  To: Björn Töpel
  Cc: Magnus Karlsson, Jonathan Lemon, David S. Miller, Jakub Kicinski,
	Jonathan Corbet, netdev, bpf, linux-doc, linux-kernel,
	Ilya Maximets

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 <i.maximets@ovn.org>
---
 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;
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] docs: af_xdp: consistent indentation in examples
  2021-06-22 18:56 [PATCH] docs: af_xdp: consistent indentation in examples Ilya Maximets
@ 2021-06-22 19:07 ` Ilya Maximets
  2021-06-23  6:32 ` Magnus Karlsson
  2021-06-23  8:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ilya Maximets @ 2021-06-22 19:07 UTC (permalink / raw)
  To: Ilya Maximets, Björn Töpel
  Cc: Magnus Karlsson, Jonathan Lemon, David S. Miller, Jakub Kicinski,
	Jonathan Corbet, netdev, bpf, linux-doc, linux-kernel

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 <i.maximets@ovn.org>
> ---

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;
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] docs: af_xdp: consistent indentation in examples
  2021-06-22 18:56 [PATCH] docs: af_xdp: consistent indentation in examples Ilya Maximets
  2021-06-22 19:07 ` Ilya Maximets
@ 2021-06-23  6:32 ` Magnus Karlsson
  2021-06-23  8:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Magnus Karlsson @ 2021-06-23  6:32 UTC (permalink / raw)
  To: Ilya Maximets
  Cc: Björn Töpel, Magnus Karlsson, Jonathan Lemon,
	David S. Miller, Jakub Kicinski, Jonathan Corbet, netdev, bpf,
	linux-doc, linux-kernel

On Tue, Jun 22, 2021 at 8:57 PM Ilya Maximets <i.maximets@ovn.org> 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 <i.maximets@ovn.org>
> ---
>  Documentation/networking/af_xdp.rst | 32 ++++++++++++++---------------
>  1 file changed, 16 insertions(+), 16 deletions(-)

Thanks for the cleanup Ilya.

Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>

> 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;
> --
> 2.26.3
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] docs: af_xdp: consistent indentation in examples
  2021-06-22 18:56 [PATCH] docs: af_xdp: consistent indentation in examples Ilya Maximets
  2021-06-22 19:07 ` Ilya Maximets
  2021-06-23  6:32 ` Magnus Karlsson
@ 2021-06-23  8:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-23  8:00 UTC (permalink / raw)
  To: Ilya Maximets
  Cc: bjorn, magnus.karlsson, jonathan.lemon, davem, kuba, corbet,
	netdev, bpf, linux-doc, linux-kernel

Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

On Tue, 22 Jun 2021 20:56:47 +0200 you 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 <i.maximets@ovn.org>
> ---
>  Documentation/networking/af_xdp.rst | 32 ++++++++++++++---------------
>  1 file changed, 16 insertions(+), 16 deletions(-)

Here is the summary with links:
  - docs: af_xdp: consistent indentation in examples
    https://git.kernel.org/bpf/bpf-next/c/4b9718b5a201

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-23  8:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 18:56 [PATCH] docs: af_xdp: consistent indentation in examples Ilya Maximets
2021-06-22 19:07 ` Ilya Maximets
2021-06-23  6:32 ` Magnus Karlsson
2021-06-23  8:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).