Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A705C43381 for ; Tue, 5 Mar 2019 14:36:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F148220848 for ; Tue, 5 Mar 2019 14:36:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="n+WfB5fA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727861AbfCEOgS (ORCPT ); Tue, 5 Mar 2019 09:36:18 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:34586 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727424AbfCEOgS (ORCPT ); Tue, 5 Mar 2019 09:36:18 -0500 Received: by mail-qk1-f193.google.com with SMTP id a15so4869163qkc.1 for ; Tue, 05 Mar 2019 06:36:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3q0J1m4X9gvt+XYs+u42GNqHOztSg9JdMP3MgG6xqJw=; b=n+WfB5fAwDgVLW4qfwGpKjWf7Y1qTP7esIip46EQeAE+Tf5wHtvrvEdkYwSboniYx7 rQ8ODdrI0NicTnCb94P3I+05t6xTWuRPZJHc7OdwDF6zcvr1atcZfQqNhP0VP4l4Uy2p dEEaGNJqQjz3JCf4lzwjDkwHIdpEEg1Qa8aA692WzyiFFBqRz6c8a1831PjnE1pLNgdg xPVDAj/hn8/WCsX6fqUvCBcMWh5kYYTfPwm25pGUiT8FQkzncT8mWSXjVuSvm3LSluC6 SgagkADiGYMxSJDIU1aIfDFpH4HSW0dOWMi40MBUjT9nBfrq01tPuq5aV/XehZYC7QhS ApGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3q0J1m4X9gvt+XYs+u42GNqHOztSg9JdMP3MgG6xqJw=; b=b8+SO2DJl6HlN3ep43Mm5Ashr/ImQist9D2J+JM22P145yJQAmFqjE7QtvQ6W7t2TA e16SQ7E1G3L8bDLiBvd7qHTf4Hmam/gptho1h+Jyr7esCcWGg7ejpmZn0GXzJj/MoTPz 4cPHK8tQtug8veQJQtXtYxdAbA5/4P29zlxWUmaw3RHAVx+D7ksOMQpmFWoKL1/ufNJP eqaVRGrf1TBRZcELSZuEOv7QKuPKbvOGqaxHYECi/Zsz8NPEdQ2zCs324BHy7c3qQqKR r+KBMJXrgi8/FIhHMlKp2R5yKm59HY3YpVI30j29FQAo2XUr7+61eHbS9rLy7lnVSlWN Kkqg== X-Gm-Message-State: APjAAAXupEcvZ2Vh9L73c1BTV3o47pF2SqxgEZOHZotBwfWUruaVn73W MHZIBFyu+d7vKtGdkghbwp4FBu2EVyY= X-Google-Smtp-Source: APXvYqz7xXk8SF3XoE9PSTwEMCvwyCiG//HjqM++WKHz5Vj/OqWwmHbC5xdvarawxQ1qimshzyAEHQ== X-Received: by 2002:a37:9e11:: with SMTP id h17mr1945037qke.80.1551796576944; Tue, 05 Mar 2019 06:36:16 -0800 (PST) Received: from localhost.localdomain ([201.17.97.178]) by smtp.gmail.com with ESMTPSA id n42sm5334407qtb.43.2019.03.05.06.36.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 06:36:16 -0800 (PST) From: Pedro Tammela To: netdev@vger.kernel.org, "David S. Miller" Cc: Pedro Tammela Subject: [PATCH] net: add missing documentation in linux/skbuff.h Date: Tue, 5 Mar 2019 11:35:54 -0300 Message-Id: <20190305143554.12559-1-pctammela@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds missing documentation for some inline functions on linux/skbuff.h. The patch is incomplete and a lot more can be added, just wondering if it's of interest of the netdev developers. Also fixed some whitespaces. Signed-off-by: Pedro Tammela --- include/linux/skbuff.h | 64 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bdb9563c64a0..1db80806c030 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -327,26 +327,49 @@ struct skb_frag_struct { #endif }; +/** + * skb_frag_size - Returns the size of a skb fragment + * @frag: skb fragment + */ static inline unsigned int skb_frag_size(const skb_frag_t *frag) { return frag->size; } +/** + * skb_frag_size_set - Sets the size of a skb fragment + * @frag: skb fragment + * @size: size of fragment + */ static inline void skb_frag_size_set(skb_frag_t *frag, unsigned int size) { frag->size = size; } +/** + * skb_frag_size_add - Incrementes the size of a skb fragment by %delta + * @frag: skb fragment + * @delta: value to add + */ static inline void skb_frag_size_add(skb_frag_t *frag, int delta) { frag->size += delta; } +/** + * skb_frag_size_sub - Decrements the size of a skb fragment by %delta + * @frag: skb fragment + * @delta: value to subtract + */ static inline void skb_frag_size_sub(skb_frag_t *frag, int delta) { frag->size -= delta; } +/** + * skb_frag_must_loop - Test if %p is a high memory page + * @p: fragment's page + */ static inline bool skb_frag_must_loop(struct page *p) { #if defined(CONFIG_HIGHMEM) @@ -590,7 +613,7 @@ typedef unsigned int sk_buff_data_t; typedef unsigned char *sk_buff_data_t; #endif -/** +/** * struct sk_buff - socket buffer * @next: Next buffer in list * @prev: Previous buffer in list @@ -648,7 +671,7 @@ typedef unsigned char *sk_buff_data_t; * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL * @dst_pending_confirm: need to confirm neighbour * @decrypted: Decrypted SKB - * @napi_id: id of the NAPI struct this skb came from + * @napi_id: id of the NAPI struct this skb came from * @secmark: security marking * @mark: Generic packet mark * @vlan_proto: vlan encapsulation protocol @@ -883,7 +906,10 @@ struct sk_buff { #define SKB_ALLOC_RX 0x02 #define SKB_ALLOC_NAPI 0x04 -/* Returns true if the skb was allocated from PFMEMALLOC reserves */ +/** + * skb_pfmemalloc - Test if the skb was allocated from PFMEMALLOC reserves + * @skb: buffer + */ static inline bool skb_pfmemalloc(const struct sk_buff *skb) { return unlikely(skb->pfmemalloc); @@ -905,7 +931,7 @@ static inline bool skb_pfmemalloc(const struct sk_buff *skb) */ static inline struct dst_entry *skb_dst(const struct sk_buff *skb) { - /* If refdst was not refcounted, check we still are in a + /* If refdst was not refcounted, check we still are in a * rcu_read_lock section */ WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) && @@ -952,6 +978,10 @@ static inline bool skb_dst_is_noref(const struct sk_buff *skb) return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb); } +/** + * skb_rtable - Returns the skb &rtable + * @skb: buffer + */ static inline struct rtable *skb_rtable(const struct sk_buff *skb) { return (struct rtable *)skb_dst(skb); @@ -966,6 +996,10 @@ static inline bool skb_pkt_type_ok(u32 ptype) return ptype <= PACKET_OTHERHOST; } +/** + * skb_napi_id - Returns the skb's NAPI id + * @skb: buffer + */ static inline unsigned int skb_napi_id(const struct sk_buff *skb) { #ifdef CONFIG_NET_RX_BUSY_POLL @@ -975,7 +1009,12 @@ static inline unsigned int skb_napi_id(const struct sk_buff *skb) #endif } -/* decrement the reference count and return true if we can free the skb */ +/** + * skb_unref - decrement the skb's reference count + * @skb: buffer + * + * Returns true if we can free the skb. + */ static inline bool skb_unref(struct sk_buff *skb) { if (unlikely(!skb)) @@ -1005,6 +1044,14 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags, int node); struct sk_buff *__build_skb(void *data, unsigned int frag_size); struct sk_buff *build_skb(void *data, unsigned int frag_size); + +/** + * alloc_skb - allocate a network buffer + * @size: size to allocate + * @priority: allocation mask + * + * This function is a convenient wrapper around __alloc_skb(). + */ static inline struct sk_buff *alloc_skb(unsigned int size, gfp_t priority) { @@ -1047,6 +1094,13 @@ static inline bool skb_fclone_busy(const struct sock *sk, fclones->skb2.sk == sk; } +/** + * alloc_skb_fclone - allocate a network buffer from fclone cache + * @size: size to allocate + * @priority: allocation mask + * + * This function is a convenient wrapper around __alloc_skb(). + */ static inline struct sk_buff *alloc_skb_fclone(unsigned int size, gfp_t priority) { -- 2.21.0