From: Shubhankar Kuranagatti <shubhankarvk@gmail.com>
To: davem@davemloft.net
Cc: kuba@kernel.org, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org, kafai@fb.com, songliubraving@fb.com,
yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org,
willemb@google.com, xie.he.0141@gmail.com, edumazet@google.com,
john.ogness@linutronix.de, eyal.birger@gmail.com,
wanghai38@huawei.com, colin.king@canonical.com,
shubhankarvk@gmail.com, tannerlove@google.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org
Subject: [PATCH] net: packet: af_packet.c: Add new line after declaration
Date: Mon, 3 May 2021 22:33:09 +0530 [thread overview]
Message-ID: <20210503170309.63r2mtupzn5ne6zt@kewl-virtual-machine> (raw)
New line added after declaration
Tabs have been used instead of spaces for indentation
Each subsequent line of block commment start with a *
This is done to maintain code uniformity
Signed-off-by: Shubhankar Kuranagatti <shubhankarvk@gmail.com>
---
net/packet/af_packet.c | 43 +++++++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 17 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index e24b2841c643..8b6417afb12a 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -93,20 +93,20 @@
#include "internal.h"
/*
- Assumptions:
- - If the device has no dev->header_ops->create, there is no LL header
- visible above the device. In this case, its hard_header_len should be 0.
- The device may prepend its own header internally. In this case, its
- needed_headroom should be set to the space needed for it to add its
- internal header.
- For example, a WiFi driver pretending to be an Ethernet driver should
- set its hard_header_len to be the Ethernet header length, and set its
- needed_headroom to be (the real WiFi header length - the fake Ethernet
- header length).
- - packet socket receives packets with pulled ll header,
- so that SOCK_RAW should push it back.
-
-On receive:
+ * Assumptions:
+ * - If the device has no dev->header_ops->create, there is no LL header
+ * visible above the device. In this case, its hard_header_len should be 0.
+ * The device may prepend its own header internally. In this case, its
+ * needed_headroom should be set to the space needed for it to add its
+ * internal header.
+ * For example, a WiFi driver pretending to be an Ethernet driver should
+ * set its hard_header_len to be the Ethernet header length, and set its
+ * needed_headroom to be (the real WiFi header length - the fake Ethernet
+ * header length).
+ * - packet socket receives packets with pulled ll header,
+ * so that SOCK_RAW should push it back.
+
+ On receive:
-----------
Incoming, dev_has_header(dev) == true
@@ -781,6 +781,7 @@ static void prb_close_block(struct tpacket_kbdq_core *pkc1,
* blocks. See prb_retire_rx_blk_timer_expired().
*/
struct timespec64 ts;
+
ktime_get_real_ts64(&ts);
h1->ts_last_pkt.ts_sec = ts.tv_sec;
h1->ts_last_pkt.ts_nsec = ts.tv_nsec;
@@ -1075,6 +1076,7 @@ static void *packet_current_rx_frame(struct packet_sock *po,
int status, unsigned int len)
{
char *curr = NULL;
+
switch (po->tp_version) {
case TPACKET_V1:
case TPACKET_V2:
@@ -1106,6 +1108,7 @@ static void *prb_lookup_block(const struct packet_sock *po,
static int prb_previous_blk_num(struct packet_ring_buffer *rb)
{
unsigned int prev;
+
if (rb->prb_bdqc.kactive_blk_num)
prev = rb->prb_bdqc.kactive_blk_num-1;
else
@@ -1119,6 +1122,7 @@ static void *__prb_previous_block(struct packet_sock *po,
int status)
{
unsigned int previous = prb_previous_blk_num(rb);
+
return prb_lookup_block(po, rb, previous, status);
}
@@ -1152,6 +1156,7 @@ static void *packet_previous_frame(struct packet_sock *po,
int status)
{
unsigned int previous = rb->head ? rb->head - 1 : rb->frame_max;
+
return packet_lookup_frame(po, rb, previous, status);
}
@@ -2112,6 +2117,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev,
if (skb_shared(skb)) {
struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
+
if (nskb == NULL)
goto drop_n_acct;
@@ -2248,6 +2254,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
po->tp_reserve;
} else {
unsigned int maclen = skb_network_offset(skb);
+
netoff = TPACKET_ALIGN(po->tp_hdrlen +
(maclen < 16 ? 16 : maclen)) +
po->tp_reserve;
@@ -2841,9 +2848,9 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
}
static struct sk_buff *packet_alloc_skb(struct sock *sk, size_t prepad,
- size_t reserve, size_t len,
- size_t linear, int noblock,
- int *err)
+ size_t reserve, size_t len,
+ size_t linear, int noblock,
+ int *err)
{
struct sk_buff *skb;
@@ -3695,6 +3702,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval,
{
struct packet_mreq_max mreq;
int len = optlen;
+
memset(&mreq, 0, sizeof(mreq));
if (len < sizeof(struct packet_mreq))
return -EINVAL;
@@ -4583,6 +4591,7 @@ static void *packet_seq_start(struct seq_file *seq, loff_t *pos)
static void *packet_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct net *net = seq_file_net(seq);
+
return seq_hlist_next_rcu(v, &net->packet.sklist, pos);
}
--
2.17.1
next reply other threads:[~2021-05-03 17:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-03 17:03 Shubhankar Kuranagatti [this message]
2021-05-03 20:45 ` [PATCH] net: packet: af_packet.c: Add new line after declaration David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210503170309.63r2mtupzn5ne6zt@kewl-virtual-machine \
--to=shubhankarvk@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=colin.king@canonical.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eyal.birger@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=john.ogness@linutronix.de \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=tannerlove@google.com \
--cc=wanghai38@huawei.com \
--cc=willemb@google.com \
--cc=xie.he.0141@gmail.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).