* Re: [PATCH] docs: packing: move it to core-api book and adjust markups
From: Mike Rapoport @ 2019-06-29 10:42 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Doc Mailing List, Mauro Carvalho Chehab, linux-kernel,
Jonathan Corbet, Vladimir Oltean, Mike Rapoport, Andrew Morton,
Randy Dunlap, Matthew Wilcox, Kent Overstreet, Arnd Bergmann,
Jonathan Neuschäfer, David S. Miller, netdev
In-Reply-To: <46cb79dbc4bbff3e5a4e77b548df1e92c105ed0f.1561804613.git.mchehab+samsung@kernel.org>
On Sat, Jun 29, 2019 at 07:37:02AM -0300, Mauro Carvalho Chehab wrote:
> The packing.txt file was misplaced, as docs should be part of
> a documentation book, and not at the root dir.
>
> So, move it to the core-api directory and add to its index.
>
> Also, ensure that the file will be properly parsed and the bitmap
> ascii artwork will use a monotonic font.
>
> Fixes: 554aae35007e ("lib: Add support for generic packing operations")
> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> Documentation/core-api/index.rst | 1 +
> .../{packing.txt => core-api/packing.rst} | 81 +++++++++++--------
> 2 files changed, 50 insertions(+), 32 deletions(-)
> rename Documentation/{packing.txt => core-api/packing.rst} (61%)
>
> diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
> index d1e5b95bf86d..aebb16d7771f 100644
> --- a/Documentation/core-api/index.rst
> +++ b/Documentation/core-api/index.rst
> @@ -25,6 +25,7 @@ Core utilities
> librs
> genalloc
> errseq
> + packing
> printk-formats
> circular-buffers
> generic-radix-tree
> diff --git a/Documentation/packing.txt b/Documentation/core-api/packing.rst
> similarity index 61%
> rename from Documentation/packing.txt
> rename to Documentation/core-api/packing.rst
> index f830c98645f1..d8c341fe383e 100644
> --- a/Documentation/packing.txt
> +++ b/Documentation/core-api/packing.rst
> @@ -30,6 +30,7 @@ The solution
> ------------
>
> This API deals with 2 basic operations:
> +
> - Packing a CPU-usable number into a memory buffer (with hardware
> constraints/quirks)
> - Unpacking a memory buffer (which has hardware constraints/quirks)
> @@ -49,10 +50,12 @@ What the examples show is where the logical bytes and bits sit.
>
> 1. Normally (no quirks), we would do it like this:
>
> -63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
> -7 6 5 4
> -31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
> -3 2 1 0
> +::
> +
> + 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
> + 7 6 5 4
> + 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
> + 3 2 1 0
>
> That is, the MSByte (7) of the CPU-usable u64 sits at memory offset 0, and the
> LSByte (0) of the u64 sits at memory offset 7.
> @@ -63,10 +66,12 @@ comments as "logical" notation.
>
> 2. If QUIRK_MSB_ON_THE_RIGHT is set, we do it like this:
>
> -56 57 58 59 60 61 62 63 48 49 50 51 52 53 54 55 40 41 42 43 44 45 46 47 32 33 34 35 36 37 38 39
> -7 6 5 4
> -24 25 26 27 28 29 30 31 16 17 18 19 20 21 22 23 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7
> -3 2 1 0
> +::
> +
> + 56 57 58 59 60 61 62 63 48 49 50 51 52 53 54 55 40 41 42 43 44 45 46 47 32 33 34 35 36 37 38 39
> + 7 6 5 4
> + 24 25 26 27 28 29 30 31 16 17 18 19 20 21 22 23 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7
> + 3 2 1 0
>
> That is, QUIRK_MSB_ON_THE_RIGHT does not affect byte positioning, but
> inverts bit offsets inside a byte.
> @@ -74,10 +79,12 @@ inverts bit offsets inside a byte.
>
> 3. If QUIRK_LITTLE_ENDIAN is set, we do it like this:
>
> -39 38 37 36 35 34 33 32 47 46 45 44 43 42 41 40 55 54 53 52 51 50 49 48 63 62 61 60 59 58 57 56
> -4 5 6 7
> -7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24
> -0 1 2 3
> +::
> +
> + 39 38 37 36 35 34 33 32 47 46 45 44 43 42 41 40 55 54 53 52 51 50 49 48 63 62 61 60 59 58 57 56
> + 4 5 6 7
> + 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24
> + 0 1 2 3
>
> Therefore, QUIRK_LITTLE_ENDIAN means that inside the memory region, every
> byte from each 4-byte word is placed at its mirrored position compared to
> @@ -86,18 +93,22 @@ the boundary of that word.
> 4. If QUIRK_MSB_ON_THE_RIGHT and QUIRK_LITTLE_ENDIAN are both set, we do it
> like this:
>
> -32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
> -4 5 6 7
> -0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
> -0 1 2 3
> +::
> +
> + 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
> + 4 5 6 7
> + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
> + 0 1 2 3
>
>
> 5. If just QUIRK_LSW32_IS_FIRST is set, we do it like this:
>
> -31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
> -3 2 1 0
> -63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
> -7 6 5 4
> +::
> +
> + 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
> + 3 2 1 0
> + 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
> + 7 6 5 4
>
> In this case the 8 byte memory region is interpreted as follows: first
> 4 bytes correspond to the least significant 4-byte word, next 4 bytes to
> @@ -107,28 +118,34 @@ the more significant 4-byte word.
> 6. If QUIRK_LSW32_IS_FIRST and QUIRK_MSB_ON_THE_RIGHT are set, we do it like
> this:
>
> -24 25 26 27 28 29 30 31 16 17 18 19 20 21 22 23 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7
> -3 2 1 0
> -56 57 58 59 60 61 62 63 48 49 50 51 52 53 54 55 40 41 42 43 44 45 46 47 32 33 34 35 36 37 38 39
> -7 6 5 4
> +::
> +
> + 24 25 26 27 28 29 30 31 16 17 18 19 20 21 22 23 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7
> + 3 2 1 0
> + 56 57 58 59 60 61 62 63 48 49 50 51 52 53 54 55 40 41 42 43 44 45 46 47 32 33 34 35 36 37 38 39
> + 7 6 5 4
>
>
> 7. If QUIRK_LSW32_IS_FIRST and QUIRK_LITTLE_ENDIAN are set, it looks like
> this:
>
> -7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24
> -0 1 2 3
> -39 38 37 36 35 34 33 32 47 46 45 44 43 42 41 40 55 54 53 52 51 50 49 48 63 62 61 60 59 58 57 56
> -4 5 6 7
> +::
> +
> + 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24
> + 0 1 2 3
> + 39 38 37 36 35 34 33 32 47 46 45 44 43 42 41 40 55 54 53 52 51 50 49 48 63 62 61 60 59 58 57 56
> + 4 5 6 7
>
>
> 8. If QUIRK_LSW32_IS_FIRST, QUIRK_LITTLE_ENDIAN and QUIRK_MSB_ON_THE_RIGHT
> are set, it looks like this:
>
> -0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
> -0 1 2 3
> -32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
> -4 5 6 7
> +::
> +
> + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
> + 0 1 2 3
> + 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
> + 4 5 6 7
>
>
> We always think of our offsets as if there were no quirk, and we translate
> --
> 2.21.0
>
--
Sincerely yours,
Mike.
^ permalink raw reply
* Re: [net-next 1/1] tipc: embed jiffies in macro TIPC_BC_RETR_LIM
From: Ying Xue @ 2019-06-29 11:07 UTC (permalink / raw)
To: Jon Maloy, davem, netdev
Cc: gordan.mihaljevic, tung.q.nguyen, hoang.h.le, canh.d.luu,
tipc-discussion
In-Reply-To: <1561734380-26868-1-git-send-email-jon.maloy@ericsson.com>
On 6/28/19 11:06 PM, Jon Maloy wrote:
> The macro TIPC_BC_RETR_LIM is always used in combination with 'jiffies',
> so we can just as well perform the addition in the macro itself. This
> way, we get a few shorter code lines and one less line break.
>
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
> ---
> net/tipc/link.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/net/tipc/link.c b/net/tipc/link.c
> index f8bf63b..66d3a07 100644
> --- a/net/tipc/link.c
> +++ b/net/tipc/link.c
> @@ -207,7 +207,7 @@ enum {
> BC_NACK_SND_SUPPRESS,
> };
>
> -#define TIPC_BC_RETR_LIM msecs_to_jiffies(10) /* [ms] */
> +#define TIPC_BC_RETR_LIM (jiffies + msecs_to_jiffies(10))
> #define TIPC_UC_RETR_TIME (jiffies + msecs_to_jiffies(1))
>
> /*
> @@ -976,8 +976,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list,
> __skb_queue_tail(transmq, skb);
> /* next retransmit attempt */
> if (link_is_bc_sndlink(l))
> - TIPC_SKB_CB(skb)->nxt_retr =
> - jiffies + TIPC_BC_RETR_LIM;
> + TIPC_SKB_CB(skb)->nxt_retr = TIPC_BC_RETR_LIM;
> __skb_queue_tail(xmitq, _skb);
> TIPC_SKB_CB(skb)->ackers = l->ackers;
> l->rcv_unacked = 0;
> @@ -1027,7 +1026,7 @@ static void tipc_link_advance_backlog(struct tipc_link *l,
> __skb_queue_tail(&l->transmq, skb);
> /* next retransmit attempt */
> if (link_is_bc_sndlink(l))
> - TIPC_SKB_CB(skb)->nxt_retr = jiffies + TIPC_BC_RETR_LIM;
> + TIPC_SKB_CB(skb)->nxt_retr = TIPC_BC_RETR_LIM;
>
> __skb_queue_tail(xmitq, _skb);
> TIPC_SKB_CB(skb)->ackers = l->ackers;
> @@ -1123,7 +1122,7 @@ static int tipc_link_bc_retrans(struct tipc_link *l, struct tipc_link *r,
> if (link_is_bc_sndlink(l)) {
> if (time_before(jiffies, TIPC_SKB_CB(skb)->nxt_retr))
> continue;
> - TIPC_SKB_CB(skb)->nxt_retr = jiffies + TIPC_BC_RETR_LIM;
> + TIPC_SKB_CB(skb)->nxt_retr = TIPC_BC_RETR_LIM;
> }
> _skb = __pskb_copy(skb, LL_MAX_HEADER + MIN_H_SIZE, GFP_ATOMIC);
> if (!_skb)
>
^ permalink raw reply
* Re: [net-next 2/4] gve: Add transmit and receive support
From: kbuild test robot @ 2019-06-29 11:30 UTC (permalink / raw)
To: Catherine Sullivan
Cc: kbuild-all, netdev, Catherine Sullivan, Sagi Shahar, Jon Olson,
Willem de Bruijn, Luigi Rizzo
In-Reply-To: <20190626185251.205687-3-csully@google.com>
[-- Attachment #1: Type: text/plain, Size: 2760 bytes --]
Hi Catherine,
I love your patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Catherine-Sullivan/Add-gve-driver/20190629-070444
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/net/ethernet/google/gve/gve_main.c:16:0:
drivers/net/ethernet/google/gve/gve_adminq.h: In function 'gve_assert_size_gve_adminq_create_rx_queue':
>> drivers/net/ethernet/google/gve/gve_adminq.h:134:469: error: call to '__compiletime_assert_134' declared with attribute error: BUILD_BUG_ON failed: sizeof(struct gve_adminq_create_rx_queue) != (48)
GVE_ASSERT_SIZE(struct, gve_adminq_create_rx_queue, 48);
^
In file included from drivers/net/ethernet/google/gve/gve_main.c:16:0:
drivers/net/ethernet/google/gve/gve_adminq.h: In function 'gve_assert_size_gve_adminq_set_driver_parameter':
drivers/net/ethernet/google/gve/gve_adminq.h:171:489: error: call to '__compiletime_assert_171' declared with attribute error: BUILD_BUG_ON failed: sizeof(struct gve_adminq_set_driver_parameter) != (16)
GVE_ASSERT_SIZE(struct, gve_adminq_set_driver_parameter, 16);
^
vim +/__compiletime_assert_134 +134 drivers/net/ethernet/google/gve/gve_adminq.h
133
> 134 GVE_ASSERT_SIZE(struct, gve_adminq_create_rx_queue, 48);
135
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 67789 bytes --]
^ permalink raw reply
* Re: [PATCH v4] net: netfilter: Fix rpfilter dropping vrf packets by mistake
From: David Ahern @ 2019-06-29 12:19 UTC (permalink / raw)
To: linmiaohe, pablo@netfilter.org
Cc: kadlec@blackhole.kfki.hu, fw@strlen.de, davem@davemloft.net,
kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Mingfangsen
In-Reply-To: <2213b3e722a14ee48768ecc7118efc46@huawei.com>
On 6/28/19 8:13 PM, linmiaohe wrote:
> You're right. Fib rules code would set FLOWI_FLAG_SKIP_NH_OIF flag. But I set
> it here for distinguish with the flags & XT_RPFILTER_LOOSE branch. Without
> this, they do the same work and maybe should be combined. I don't want to
> do that as that makes code confusing.
> Is this code snipet below ok ? If so, I would delete this flag setting.
>
> } else if (netif_is_l3_master(dev) || netif_is_l3_slave(dev)) {
> fl6.flowi6_oif = dev->ifindex;
> } else if ((flags & XT_RPFILTER_LOOSE) == 0)
> fl6.flowi6_oif = dev->ifindex;
that looks fine to me, but it is up to Pablo.
^ permalink raw reply
* [PATCH] net: ethernet: mediatek: Fix overlapping capability bits.
From: René van Dorst @ 2019-06-29 12:24 UTC (permalink / raw)
To: sean.wang, f.fainelli, linux, davem, matthias.bgg, andrew,
vivien.didelot
Cc: frank-w, netdev, linux-mediatek, linux-mips, René van Dorst
Both MTK_TRGMII_MT7621_CLK and MTK_PATH_BIT are defined as bit 10.
This causes issues on non-MT7621 devices which has the
MTK_PATH_BIT(MTK_ETH_PATH_GMAC1_RGMII) capability set.
The wrong TRGMII setup code is executed.
Moving the MTK_PATH_BIT to bit 11 fixes the issue.
Fixes: 8efaa653a8a5 ("net: ethernet: mediatek: Add MT7621 TRGMII mode
support")
Signed-off-by: René van Dorst <opensource@vdorst.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 876ce6798709..2cb8a915731c 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -626,7 +626,7 @@ enum mtk_eth_path {
#define MTK_TRGMII_MT7621_CLK BIT(10)
/* Supported path present on SoCs */
-#define MTK_PATH_BIT(x) BIT((x) + 10)
+#define MTK_PATH_BIT(x) BIT((x) + 11)
#define MTK_GMAC1_RGMII \
(MTK_PATH_BIT(MTK_ETH_PATH_GMAC1_RGMII) | MTK_RGMII)
--
2.20.1
^ permalink raw reply related
* [PATCH] net: ethernet: mediatek: Allow non TRGMII mode with MT7621 DDR2 devices
From: René van Dorst @ 2019-06-29 12:24 UTC (permalink / raw)
To: sean.wang, f.fainelli, linux, davem, matthias.bgg, andrew,
vivien.didelot
Cc: frank-w, netdev, linux-mediatek, linux-mips, René van Dorst
No reason to error out on a MT7621 device with DDR2 memory when non
TRGMII mode is selected.
Only MT7621 DDR2 clock setup is not supported for TRGMII mode.
But non TRGMII mode doesn't need any special clock setup.
Signed-off-by: René van Dorst <opensource@vdorst.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 066712f2e985..b20b3a5a1ebb 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -139,9 +139,12 @@ static int mt7621_gmac0_rgmii_adjust(struct mtk_eth *eth,
{
u32 val;
- /* Check DDR memory type. Currently DDR2 is not supported. */
+ /* Check DDR memory type.
+ * Currently TRGMII mode with DDR2 memory is not supported.
+ */
regmap_read(eth->ethsys, ETHSYS_SYSCFG, &val);
- if (val & SYSCFG_DRAM_TYPE_DDR2) {
+ if (interface == PHY_INTERFACE_MODE_TRGMII &&
+ val & SYSCFG_DRAM_TYPE_DDR2) {
dev_err(eth->dev,
"TRGMII mode with DDR2 memory is not supported!\n");
return -EOPNOTSUPP;
--
2.20.1
^ permalink raw reply related
* Re: Use-after-free in br_multicast_rcv
From: Martin Weinelt @ 2019-06-29 13:23 UTC (permalink / raw)
To: nikolay, Roopa Prabhu, bridge; +Cc: netdev
In-Reply-To: <E0170D52-C181-4F0F-B5F8-F1801C2A8F5A@cumulusnetworks.com>
On 6/29/19 3:11 PM, nikolay@cumulusnetworks.com wrote:
> On 29 June 2019 14:54:44 EEST, Martin Weinelt <martin@linuxlounge.net> wrote:
>> Hello,
>>
>> we've recently been experiencing memory leaks on our Linux-based
>> routers,
>> at least as far back as v4.19.16.
>>
>> After rebuilding with KASAN it found a use-after-free in
>> br_multicast_rcv which I could reproduce on v5.2.0-rc6.
>>
>> Please find the KASAN report below, I'm anot sure what else to provide
>> so
>> feel free to ask.
>>
>> Best,
>> Martin
>>
>>
>
> Hi Martin,
> I'll look into this, are there any specific steps to reproduce it?
>
> Thanks,
> Nik
Hi Nik,
thanks for taking an interest. The setup is a public L2 mesh network
based on the batman-adv kmod. The bridges see 100 Mbps+ of traffic most
of the day and I unfortunately do not yet know what triggers this.
Best,
Martin
>
>> ==================================================================
>> BUG: KASAN: use-after-free in br_multicast_rcv+0x480c/0x4ad0 [bridge]
>> Read of size 2 at addr ffff8880421302b4 by task ksoftirqd/1/16
>>
>> CPU: 1 PID: 16 Comm: ksoftirqd/1 Tainted: G OE 5.2.0-rc6+
>> #1
>> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1
>> 04/01/2014
>> Call Trace:
>> dump_stack+0x71/0xab
>> print_address_description+0x6a/0x280
>> ? br_multicast_rcv+0x480c/0x4ad0 [bridge]
>> __kasan_report+0x152/0x1aa
>> ? br_multicast_rcv+0x480c/0x4ad0 [bridge]
>> ? br_multicast_rcv+0x480c/0x4ad0 [bridge]
>> kasan_report+0xe/0x20
>> br_multicast_rcv+0x480c/0x4ad0 [bridge]
>> ? br_multicast_disable_port+0x150/0x150 [bridge]
>> ? ktime_get_with_offset+0xb4/0x150
>> ? __kasan_kmalloc.constprop.6+0xa6/0xf0
>> ? __netif_receive_skb+0x1b0/0x1b0
>> ? br_fdb_update+0x10e/0x6e0 [bridge]
>> ? br_handle_frame_finish+0x3c6/0x11d0 [bridge]
>> br_handle_frame_finish+0x3c6/0x11d0 [bridge]
>> ? br_pass_frame_up+0x3a0/0x3a0 [bridge]
>> ? virtnet_probe+0x1c80/0x1c80 [virtio_net]
>> br_handle_frame+0x731/0xd90 [bridge]
>> ? select_idle_sibling+0x25/0x7d0
>> ? br_handle_frame_finish+0x11d0/0x11d0 [bridge]
>> __netif_receive_skb_core+0xced/0x2d70
>> ? virtqueue_get_buf_ctx+0x230/0x1130 [virtio_ring]
>> ? do_xdp_generic+0x20/0x20
>> ? virtqueue_napi_complete+0x39/0x70 [virtio_net]
>> ? virtnet_poll+0x94d/0xc78 [virtio_net]
>> ? receive_buf+0x5120/0x5120 [virtio_net]
>> ? __netif_receive_skb_one_core+0x97/0x1d0
>> __netif_receive_skb_one_core+0x97/0x1d0
>> ? __netif_receive_skb_core+0x2d70/0x2d70
>> ? _raw_write_trylock+0x100/0x100
>> ? __queue_work+0x41e/0xbe0
>> process_backlog+0x19c/0x650
>> ? _raw_read_lock_irq+0x40/0x40
>> net_rx_action+0x71e/0xbc0
>> ? __switch_to_asm+0x40/0x70
>> ? napi_complete_done+0x360/0x360
>> ? __switch_to_asm+0x34/0x70
>> ? __switch_to_asm+0x40/0x70
>> ? __schedule+0x85e/0x14d0
>> __do_softirq+0x1db/0x5f9
>> ? takeover_tasklets+0x5f0/0x5f0
>> run_ksoftirqd+0x26/0x40
>> smpboot_thread_fn+0x443/0x680
>> ? sort_range+0x20/0x20
>> ? schedule+0x94/0x210
>> ? __kthread_parkme+0x78/0xf0
>> ? sort_range+0x20/0x20
>> kthread+0x2ae/0x3a0
>> ? kthread_create_worker_on_cpu+0xc0/0xc0
>> ret_from_fork+0x35/0x40
>>
>> The buggy address belongs to the page:
>> page:ffffea0001084c00 refcount:0 mapcount:-128 mapping:0000000000000000
>> index:0x0
>> flags: 0xffffc000000000()
>> raw: 00ffffc000000000 ffffea0000cfca08 ffffea0001098608
>> 0000000000000000
>> raw: 0000000000000000 0000000000000003 00000000ffffff7f
>> 0000000000000000
>> page dumped because: kasan: bad access detected
>>
>> Memory state around the buggy address:
>> ffff888042130180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>> ffff888042130200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>>> ffff888042130280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>> ^
>> ffff888042130300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>> ffff888042130380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>> ==================================================================
>> Disabling lock debugging due to kernel taint
>
>
^ permalink raw reply
* Re: [PATCH] let proc net directory inodes reflect to active net namespace
From: Alexey Dobriyan @ 2019-06-29 13:29 UTC (permalink / raw)
To: Hallsmark, Per
Cc: David S. Miller, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
In-Reply-To: <B7B4BB465792624BAF51F33077E99065DC5D7225@ALA-MBD.corp.ad.wrs.com>
On Tue, Jun 25, 2019 at 10:36:06AM +0000, Hallsmark, Per wrote:
> +struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
> + struct proc_dir_entry *parent)
> +{
> + struct proc_dir_entry *pde;
> +
> + pde = proc_mkdir_data(name, 0, parent, net);
> + pde->proc_dops = &proc_net_dentry_ops;
> +
> + return pde;
> +}
This requires NULL check at least.
^ permalink raw reply
* [PATCH 1/2] samples: pktgen: add some helper functions for port parsing
From: Daniel T. Lee @ 2019-06-29 13:33 UTC (permalink / raw)
To: Jesper Dangaard Brouer, David S . Miller; +Cc: netdev
This commit adds port parsing and port validate helper function to parse
single or range of port(s) from a given string. (e.g. 1234, 443-444)
Helpers will be used in prior to set target port(s) in samples/pktgen.
Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
samples/pktgen/functions.sh | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/samples/pktgen/functions.sh b/samples/pktgen/functions.sh
index f8bb3cd0f4ce..4af4046d71be 100644
--- a/samples/pktgen/functions.sh
+++ b/samples/pktgen/functions.sh
@@ -162,3 +162,37 @@ function get_node_cpus()
echo $node_cpu_list
}
+
+# Given a single or range of port(s), return minimum and maximum port number.
+function parse_ports()
+{
+ local port_str=$1
+ local port_list
+ local min_port
+ local max_port
+
+ IFS="-" read -ra port_list <<< $port_str
+
+ min_port=${port_list[0]}
+ max_port=${port_list[1]:-$min_port}
+
+ echo $min_port $max_port
+}
+
+# Given a minimum and maximum port, verify port number.
+function validate_ports()
+{
+ local min_port=$1
+ local max_port=$2
+
+ # 0 < port < 65536
+ if [[ $min_port -gt 0 && $min_port -lt 65536 ]]; then
+ if [[ $max_port -gt 0 && $max_port -lt 65536 ]]; then
+ if [[ $min_port -le $max_port ]]; then
+ return 0
+ fi
+ fi
+ fi
+
+ err 5 "Invalid port(s): $min_port-$max_port"
+}
--
2.17.1
^ permalink raw reply related
* [PATCH 2/2] samples: pktgen: allow to specify destination port
From: Daniel T. Lee @ 2019-06-29 13:33 UTC (permalink / raw)
To: Jesper Dangaard Brouer, David S . Miller; +Cc: netdev
In-Reply-To: <20190629133358.8251-1-danieltimlee@gmail.com>
Currently, kernel pktgen has the feature to specify udp destination port
for sending packet. (e.g. pgset "udp_dst_min 9")
But on samples, each of the scripts doesn't have any option to achieve this.
This commit adds the DST_PORT option to specify the target port(s) in the script.
-p : ($DST_PORT) destination PORT range (e.g. 433-444) is also allowed
Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
samples/pktgen/README.rst | 1 +
samples/pktgen/parameters.sh | 7 ++++++-
.../pktgen/pktgen_bench_xmit_mode_netif_receive.sh | 11 +++++++++++
samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh | 11 +++++++++++
samples/pktgen/pktgen_sample01_simple.sh | 11 +++++++++++
samples/pktgen/pktgen_sample02_multiqueue.sh | 11 +++++++++++
samples/pktgen/pktgen_sample03_burst_single_flow.sh | 11 +++++++++++
samples/pktgen/pktgen_sample04_many_flows.sh | 11 +++++++++++
samples/pktgen/pktgen_sample05_flow_per_thread.sh | 12 +++++++++++-
...pktgen_sample06_numa_awared_queue_irq_affinity.sh | 11 +++++++++++
10 files changed, 95 insertions(+), 2 deletions(-)
diff --git a/samples/pktgen/README.rst b/samples/pktgen/README.rst
index ff8929da61c5..fd39215db508 100644
--- a/samples/pktgen/README.rst
+++ b/samples/pktgen/README.rst
@@ -20,6 +20,7 @@ across the sample scripts. Usage example is printed on errors::
-s : ($PKT_SIZE) packet size
-d : ($DEST_IP) destination IP
-m : ($DST_MAC) destination MAC-addr
+ -p : ($DST_PORT) destination PORT range (e.g. 433-444) is also allowed
-t : ($THREADS) threads to start
-f : ($F_THREAD) index of first thread (zero indexed CPU number)
-c : ($SKB_CLONE) SKB clones send before alloc new SKB
diff --git a/samples/pktgen/parameters.sh b/samples/pktgen/parameters.sh
index 72fc562876e2..a06b00a0c7b6 100644
--- a/samples/pktgen/parameters.sh
+++ b/samples/pktgen/parameters.sh
@@ -10,6 +10,7 @@ function usage() {
echo " -s : (\$PKT_SIZE) packet size"
echo " -d : (\$DEST_IP) destination IP"
echo " -m : (\$DST_MAC) destination MAC-addr"
+ echo " -p : (\$DST_PORT) destination PORT range (e.g. 433-444) is also allowed"
echo " -t : (\$THREADS) threads to start"
echo " -f : (\$F_THREAD) index of first thread (zero indexed CPU number)"
echo " -c : (\$SKB_CLONE) SKB clones send before alloc new SKB"
@@ -23,7 +24,7 @@ function usage() {
## --- Parse command line arguments / parameters ---
## echo "Commandline options:"
-while getopts "s:i:d:m:f:t:c:n:b:vxh6" option; do
+while getopts "s:i:d:m:p:f:t:c:n:b:vxh6" option; do
case $option in
i) # interface
export DEV=$OPTARG
@@ -41,6 +42,10 @@ while getopts "s:i:d:m:f:t:c:n:b:vxh6" option; do
export DST_MAC=$OPTARG
info "Destination MAC set to: DST_MAC=$DST_MAC"
;;
+ p) # PORT
+ export DST_PORT=$OPTARG
+ info "Destination PORT set to: DST_PORT=$DST_PORT"
+ ;;
f)
export F_THREAD=$OPTARG
info "Index of first thread (zero indexed CPU number): $F_THREAD"
diff --git a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
index 2839f7d315cf..e14b1a9144d9 100755
--- a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
+++ b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
@@ -41,6 +41,10 @@ fi
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$BURST" ] && BURST=1024
[ -z "$COUNT" ] && COUNT="10000000" # Zero means indefinitely
+if [ -n "$DST_PORT" ]; then
+ read -r DST_MIN DST_MAX <<< $(parse_ports $DST_PORT)
+ validate_ports $DST_MIN $DST_MAX
+fi
# Base Config
DELAY="0" # Zero means max speed
@@ -69,6 +73,13 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
pg_set $dev "dst_mac $DST_MAC"
pg_set $dev "dst$IP6 $DEST_IP"
+ if [ -n "$DST_PORT" ]; then
+ # Single destination port or random port range
+ pg_set $dev "flag UDPDST_RND"
+ pg_set $dev "udp_dst_min $DST_MIN"
+ pg_set $dev "udp_dst_max $DST_MAX"
+ fi
+
# Inject packet into RX path of stack
pg_set $dev "xmit_mode netif_receive"
diff --git a/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh b/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
index e1ee54465def..82c3e504e056 100755
--- a/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
+++ b/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
@@ -24,6 +24,10 @@ if [[ -n "$BURST" ]]; then
err 1 "Bursting not supported for this mode"
fi
[ -z "$COUNT" ] && COUNT="10000000" # Zero means indefinitely
+if [ -n "$DST_PORT" ]; then
+ read -r DST_MIN DST_MAX <<< $(parse_ports $DST_PORT)
+ validate_ports $DST_MIN $DST_MAX
+fi
# Base Config
DELAY="0" # Zero means max speed
@@ -52,6 +56,13 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
pg_set $dev "dst_mac $DST_MAC"
pg_set $dev "dst$IP6 $DEST_IP"
+ if [ -n "$DST_PORT" ]; then
+ # Single destination port or random port range
+ pg_set $dev "flag UDPDST_RND"
+ pg_set $dev "udp_dst_min $DST_MIN"
+ pg_set $dev "udp_dst_max $DST_MAX"
+ fi
+
# Inject packet into TX qdisc egress path of stack
pg_set $dev "xmit_mode queue_xmit"
done
diff --git a/samples/pktgen/pktgen_sample01_simple.sh b/samples/pktgen/pktgen_sample01_simple.sh
index e9ab4edba2d7..d1702fdde8f3 100755
--- a/samples/pktgen/pktgen_sample01_simple.sh
+++ b/samples/pktgen/pktgen_sample01_simple.sh
@@ -22,6 +22,10 @@ fi
# Example enforce param "-m" for dst_mac
[ -z "$DST_MAC" ] && usage && err 2 "Must specify -m dst_mac"
[ -z "$COUNT" ] && COUNT="100000" # Zero means indefinitely
+if [ -n "$DST_PORT" ]; then
+ read -r DST_MIN DST_MAX <<< $(parse_ports $DST_PORT)
+ validate_ports $DST_MIN $DST_MAX
+fi
# Base Config
DELAY="0" # Zero means max speed
@@ -59,6 +63,13 @@ pg_set $DEV "flag NO_TIMESTAMP"
pg_set $DEV "dst_mac $DST_MAC"
pg_set $DEV "dst$IP6 $DEST_IP"
+if [ -n "$DST_PORT" ]; then
+ # Single destination port or random port range
+ pg_set $DEV "flag UDPDST_RND"
+ pg_set $DEV "udp_dst_min $DST_MIN"
+ pg_set $DEV "udp_dst_max $DST_MAX"
+fi
+
# Setup random UDP port src range
pg_set $DEV "flag UDPSRC_RND"
pg_set $DEV "udp_src_min $UDP_MIN"
diff --git a/samples/pktgen/pktgen_sample02_multiqueue.sh b/samples/pktgen/pktgen_sample02_multiqueue.sh
index 99f740ae9857..7f7a9a27548f 100755
--- a/samples/pktgen/pktgen_sample02_multiqueue.sh
+++ b/samples/pktgen/pktgen_sample02_multiqueue.sh
@@ -29,6 +29,10 @@ if [ -z "$DEST_IP" ]; then
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
fi
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
+if [ -n "$DST_PORT" ]; then
+ read -r DST_MIN DST_MAX <<< $(parse_ports $DST_PORT)
+ validate_ports $DST_MIN $DST_MAX
+fi
# General cleanup everything since last run
pg_ctrl "reset"
@@ -60,6 +64,13 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
pg_set $dev "dst_mac $DST_MAC"
pg_set $dev "dst$IP6 $DEST_IP"
+ if [ -n "$DST_PORT" ]; then
+ # Single destination port or random port range
+ pg_set $dev "flag UDPDST_RND"
+ pg_set $dev "udp_dst_min $DST_MIN"
+ pg_set $dev "udp_dst_max $DST_MAX"
+ fi
+
# Setup random UDP port src range
pg_set $dev "flag UDPSRC_RND"
pg_set $dev "udp_src_min $UDP_MIN"
diff --git a/samples/pktgen/pktgen_sample03_burst_single_flow.sh b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
index 8fdd36722d9e..b520637817ce 100755
--- a/samples/pktgen/pktgen_sample03_burst_single_flow.sh
+++ b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
@@ -33,6 +33,10 @@ fi
[ -z "$BURST" ] && BURST=32
[ -z "$CLONE_SKB" ] && CLONE_SKB="0" # No need for clones when bursting
[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
+if [ -n "$DST_PORT" ]; then
+ read -r DST_MIN DST_MAX <<< $(parse_ports $DST_PORT)
+ validate_ports $DST_MIN $DST_MAX
+fi
# Base Config
DELAY="0" # Zero means max speed
@@ -60,6 +64,13 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
pg_set $dev "dst_mac $DST_MAC"
pg_set $dev "dst$IP6 $DEST_IP"
+ if [ -n "$DST_PORT" ]; then
+ # Single destination port or random port range
+ pg_set $dev "flag UDPDST_RND"
+ pg_set $dev "udp_dst_min $DST_MIN"
+ pg_set $dev "udp_dst_max $DST_MAX"
+ fi
+
# Setup burst, for easy testing -b 0 disable bursting
# (internally in pktgen default and minimum burst=1)
if [[ ${BURST} -ne 0 ]]; then
diff --git a/samples/pktgen/pktgen_sample04_many_flows.sh b/samples/pktgen/pktgen_sample04_many_flows.sh
index 4df92b7176da..5b6e9d9cb5b5 100755
--- a/samples/pktgen/pktgen_sample04_many_flows.sh
+++ b/samples/pktgen/pktgen_sample04_many_flows.sh
@@ -17,6 +17,10 @@ source ${basedir}/parameters.sh
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$CLONE_SKB" ] && CLONE_SKB="0"
[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
+if [ -n "$DST_PORT" ]; then
+ read -r DST_MIN DST_MAX <<< $(parse_ports $DST_PORT)
+ validate_ports $DST_MIN $DST_MAX
+fi
# NOTICE: Script specific settings
# =======
@@ -56,6 +60,13 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
pg_set $dev "dst_mac $DST_MAC"
pg_set $dev "dst $DEST_IP"
+ if [ -n "$DST_PORT" ]; then
+ # Single destination port or random port range
+ pg_set $dev "flag UDPDST_RND"
+ pg_set $dev "udp_dst_min $DST_MIN"
+ pg_set $dev "udp_dst_max $DST_MAX"
+ fi
+
# Randomize source IP-addresses
pg_set $dev "flag IPSRC_RND"
pg_set $dev "src_min 198.18.0.0"
diff --git a/samples/pktgen/pktgen_sample05_flow_per_thread.sh b/samples/pktgen/pktgen_sample05_flow_per_thread.sh
index 7f8b5e59f01e..0c06e63fbe97 100755
--- a/samples/pktgen/pktgen_sample05_flow_per_thread.sh
+++ b/samples/pktgen/pktgen_sample05_flow_per_thread.sh
@@ -22,7 +22,10 @@ source ${basedir}/parameters.sh
[ -z "$CLONE_SKB" ] && CLONE_SKB="0"
[ -z "$BURST" ] && BURST=32
[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
-
+if [ -n "$DST_PORT" ]; then
+ read -r DST_MIN DST_MAX <<< $(parse_ports $DST_PORT)
+ validate_ports $DST_MIN $DST_MAX
+fi
# Base Config
DELAY="0" # Zero means max speed
@@ -50,6 +53,13 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
pg_set $dev "dst_mac $DST_MAC"
pg_set $dev "dst $DEST_IP"
+ if [ -n "$DST_PORT" ]; then
+ # Single destination port or random port range
+ pg_set $dev "flag UDPDST_RND"
+ pg_set $dev "udp_dst_min $DST_MIN"
+ pg_set $dev "udp_dst_max $DST_MAX"
+ fi
+
# Setup source IP-addresses based on thread number
pg_set $dev "src_min 198.18.$((thread+1)).1"
pg_set $dev "src_max 198.18.$((thread+1)).1"
diff --git a/samples/pktgen/pktgen_sample06_numa_awared_queue_irq_affinity.sh b/samples/pktgen/pktgen_sample06_numa_awared_queue_irq_affinity.sh
index 353adc17205e..97f0266c0356 100755
--- a/samples/pktgen/pktgen_sample06_numa_awared_queue_irq_affinity.sh
+++ b/samples/pktgen/pktgen_sample06_numa_awared_queue_irq_affinity.sh
@@ -35,6 +35,10 @@ if [ -z "$DEST_IP" ]; then
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
fi
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
+if [ -n "$DST_PORT" ]; then
+ read -r DST_MIN DST_MAX <<< $(parse_ports $DST_PORT)
+ validate_ports $DST_MIN $DST_MAX
+fi
# General cleanup everything since last run
pg_ctrl "reset"
@@ -77,6 +81,13 @@ for ((i = 0; i < $THREADS; i++)); do
pg_set $dev "dst_mac $DST_MAC"
pg_set $dev "dst$IP6 $DEST_IP"
+ if [ -n "$DST_PORT" ]; then
+ # Single destination port or random port range
+ pg_set $dev "flag UDPDST_RND"
+ pg_set $dev "udp_dst_min $DST_MIN"
+ pg_set $dev "udp_dst_max $DST_MAX"
+ fi
+
# Setup random UDP port src range
pg_set $dev "flag UDPSRC_RND"
pg_set $dev "udp_src_min $UDP_MIN"
--
2.17.1
^ permalink raw reply related
* Re: [PATCH net-next v2 2/4] gve: Add transmit and receive support
From: kbuild test robot @ 2019-06-29 13:54 UTC (permalink / raw)
To: Catherine Sullivan
Cc: kbuild-all, netdev, Catherine Sullivan, Sagi Shahar, Jon Olson,
Willem de Bruijn, Luigi Rizzo
In-Reply-To: <20190628175633.143501-3-csully@google.com>
Hi Catherine,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Catherine-Sullivan/Add-gve-driver/20190629-143743
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-rc1-7-g2b96cd8-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
drivers/net/ethernet/google/gve/gve_rx.c:11:6: sparse: sparse: symbol 'gve_rx_remove_from_block' was not declared. Should it be static?
drivers/net/ethernet/google/gve/gve_rx.c:217:16: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restricted __be3unsigned int val @@
drivers/net/ethernet/google/gve/gve_rx.c:217:16: sparse: expected unsigned int val
drivers/net/ethernet/google/gve/gve_rx.c:217:16: sparse: got restricted __be32 [usertype]
drivers/net/ethernet/google/gve/gve_rx.c:349:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __wsum [usertype] csum @@ got restricted __wsum [usertype] csum @@
drivers/net/ethernet/google/gve/gve_rx.c:349:27: sparse: expected restricted __wsum [usertype] csum
drivers/net/ethernet/google/gve/gve_rx.c:349:27: sparse: got restricted __be16 [usertype] csum
drivers/net/ethernet/google/gve/gve_rx.c:374:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] flags_seq @@ got resunsigned short [usertype] flags_seq @@
drivers/net/ethernet/google/gve/gve_rx.c:374:19: sparse: expected unsigned short [usertype] flags_seq
drivers/net/ethernet/google/gve/gve_rx.c:374:19: sparse: got restricted __be16 [usertype] flags_seq
>> drivers/net/ethernet/google/gve/gve_rx.c:378:17: sparse: sparse: cast to restricted __be16
>> drivers/net/ethernet/google/gve/gve_rx.c:378:17: sparse: sparse: cast to restricted __be16
>> drivers/net/ethernet/google/gve/gve_rx.c:378:17: sparse: sparse: cast to restricted __be16
>> drivers/net/ethernet/google/gve/gve_rx.c:378:17: sparse: sparse: cast to restricted __be16
vim +378 drivers/net/ethernet/google/gve/gve_rx.c
212
213 void gve_rx_write_doorbell(struct gve_priv *priv, struct gve_rx_ring *rx)
214 {
215 u32 db_idx = be32_to_cpu(rx->q_resources->db_index);
216
> 217 writel(cpu_to_be32(rx->desc.fill_cnt), &priv->db_bar2[db_idx]);
218 }
219
220 static enum pkt_hash_types gve_rss_type(__be16 pkt_flags)
221 {
222 if (likely(pkt_flags & (GVE_RXF_TCP | GVE_RXF_UDP)))
223 return PKT_HASH_TYPE_L4;
224 if (pkt_flags & (GVE_RXF_IPV4 | GVE_RXF_IPV6))
225 return PKT_HASH_TYPE_L3;
226 return PKT_HASH_TYPE_L2;
227 }
228
229 static struct sk_buff *gve_rx_copy(struct net_device *dev,
230 struct napi_struct *napi,
231 struct gve_rx_slot_page_info *page_info,
232 u16 len)
233 {
234 struct sk_buff *skb = napi_alloc_skb(napi, len);
235 void *va = page_info->page_address + GVE_RX_PAD +
236 page_info->page_offset;
237
238 if (unlikely(!skb))
239 return NULL;
240
241 __skb_put(skb, len);
242
243 skb_copy_to_linear_data(skb, va, len);
244
245 skb->protocol = eth_type_trans(skb, dev);
246 return skb;
247 }
248
249 static struct sk_buff *gve_rx_add_frags(struct net_device *dev,
250 struct napi_struct *napi,
251 struct gve_rx_slot_page_info *page_info,
252 u16 len)
253 {
254 struct sk_buff *skb = napi_get_frags(napi);
255
256 if (unlikely(!skb))
257 return NULL;
258
259 skb_add_rx_frag(skb, 0, page_info->page,
260 page_info->page_offset +
261 GVE_RX_PAD, len, PAGE_SIZE / 2);
262
263 return skb;
264 }
265
266 static void gve_rx_flip_buff(struct gve_rx_slot_page_info *page_info,
267 struct gve_rx_data_slot *data_ring)
268 {
269 u64 addr = be64_to_cpu(data_ring->qpl_offset);
270
271 page_info->page_offset ^= PAGE_SIZE / 2;
272 addr ^= PAGE_SIZE / 2;
273 data_ring->qpl_offset = cpu_to_be64(addr);
274 }
275
276 static bool gve_rx(struct gve_rx_ring *rx, struct gve_rx_desc *rx_desc,
277 netdev_features_t feat)
278 {
279 struct gve_rx_slot_page_info *page_info;
280 struct gve_priv *priv = rx->gve;
281 struct napi_struct *napi = &priv->ntfy_blocks[rx->ntfy_id].napi;
282 struct net_device *dev = priv->dev;
283 struct sk_buff *skb;
284 int pagecount;
285 u16 len;
286 u32 idx;
287
288 /* drop this packet */
289 if (unlikely(rx_desc->flags_seq & GVE_RXF_ERR))
290 return true;
291
292 len = be16_to_cpu(rx_desc->len) - GVE_RX_PAD;
293 idx = rx->data.cnt & rx->data.mask;
294 page_info = &rx->data.page_info[idx];
295
296 /* gvnic can only receive into registered segments. If the buffer
297 * can't be recycled, our only choice is to copy the data out of
298 * it so that we can return it to the device.
299 */
300
301 #if PAGE_SIZE == 4096
302 if (len <= priv->rx_copybreak) {
303 /* Just copy small packets */
304 skb = gve_rx_copy(dev, napi, page_info, len);
305 goto have_skb;
306 }
307 if (unlikely(!gve_can_recycle_pages(dev))) {
308 skb = gve_rx_copy(dev, napi, page_info, len);
309 goto have_skb;
310 }
311 pagecount = page_count(page_info->page);
312 if (pagecount == 1) {
313 /* No part of this page is used by any SKBs; we attach
314 * the page fragment to a new SKB and pass it up the
315 * stack.
316 */
317 skb = gve_rx_add_frags(dev, napi, page_info, len);
318 if (!skb)
319 return true;
320 /* Make sure the kernel stack can't release the page */
321 get_page(page_info->page);
322 /* "flip" to other packet buffer on this page */
323 gve_rx_flip_buff(page_info, &rx->data.data_ring[idx]);
324 } else if (pagecount >= 2) {
325 /* We have previously passed the other half of this
326 * page up the stack, but it has not yet been freed.
327 */
328 skb = gve_rx_copy(dev, napi, page_info, len);
329 } else {
330 WARN(pagecount < 1, "Pagecount should never be < 1");
331 return false;
332 }
333 #else
334 skb = gve_rx_copy(dev, napi, page_info, len);
335 #endif
336
337 have_skb:
338 if (!skb)
339 return true;
340
341 rx->data.cnt++;
342
343 if (likely(feat & NETIF_F_RXCSUM)) {
344 /* NIC passes up the partial sum */
345 if (rx_desc->csum)
346 skb->ip_summed = CHECKSUM_COMPLETE;
347 else
348 skb->ip_summed = CHECKSUM_NONE;
349 skb->csum = rx_desc->csum;
350 }
351
352 /* parse flags & pass relevant info up */
353 if (likely(feat & NETIF_F_RXHASH) &&
354 gve_needs_rss(rx_desc->flags_seq))
355 skb_set_hash(skb, be32_to_cpu(rx_desc->rss_hash),
356 gve_rss_type(rx_desc->flags_seq));
357
358 if (skb_is_nonlinear(skb))
359 napi_gro_frags(napi);
360 else
361 napi_gro_receive(napi, skb);
362 return true;
363 }
364
365 static bool gve_rx_work_pending(struct gve_rx_ring *rx)
366 {
367 struct gve_rx_desc *desc;
368 u16 flags_seq;
369 u32 next_idx;
370
371 next_idx = rx->desc.cnt & rx->desc.mask;
372 desc = rx->desc.desc_ring + next_idx;
373
374 flags_seq = desc->flags_seq;
375 /* Make sure we have synchronized the seq no with the device */
376 smp_rmb();
377
> 378 return (GVE_SEQNO(flags_seq) == rx->desc.seqno);
379 }
380
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply
* Proxy arp for non-overlapping subnets on an interface without assigning IP aliases
From: Aks Kak @ 2019-06-29 14:04 UTC (permalink / raw)
To: netdev
I have a linux box with 2 interfaces with following IPs
eno1 : 10.1.1.0/24
eno2 : 192.168.2.0/27
I want to use network 10.3.3.0/25 as virtual IPs for 192.168.2.0/25
i.e. I will be doing DNAT using NETMAP target of IPTABLES.
DNAT and NETMAP, etc. is not the issue.
For my requirement to work, main thing is who (or how) will give arp
replies for 10.3.3.0/27 !!!
I have 2 ways of achieving this:
1. Create all 126 IPs 10.3.3.1 - 10.3.3.126 as alias IPs on eno1. I
want to avoid it.
2. Use proxy arp for entire subnet 10.3.3.0/25 on eno1 but this
require having atleast one IP from this subnet to be created as IP
alias on eno1, say 10.3.3.1/25. However, my concern is that this
10.3.3.1, as it has been assigned to eno1,may be used by mistake to
listen for any service, etc. or ping, etc. which otherwise I would
have to control using iptables rule set. I totally want to avoid it.
So, my query is how to do proxy arp for 10.3.3.0/25 on eno1 without
assigning 10.3.3.1/25 to eno1???
^ permalink raw reply
* Re: Proxy arp for non-overlapping subnets on an interface without assigning IP aliases
From: Aks Kak @ 2019-06-29 14:09 UTC (permalink / raw)
To: netdev
In-Reply-To: <CAAg6XZOVbPexui=MZC6QaL1-4e8SL6Z_z8S0+B6YAzSpgf8t8Q@mail.gmail.com>
Ignore previous one or consider /27 as /25 at two places in previous mail:
***************************************************************************************
I have a linux box with 2 interfaces with following IPs
eno1 : 10.1.1.0/24
eno2 : 192.168.2.0/25
I want to use network 10.3.3.0/25 as virtual IPs for 192.168.2.0/25
i.e. I will be doing DNAT using NETMAP target of IPTABLES.
DNAT and NETMAP, etc. is not the issue.
For my requirement to work, main thing is who (or how) will give arp
replies for 10.3.3.0/25 !!!
I have 2 ways of achieving this:
1. Create all 126 IPs 10.3.3.1 - 10.3.3.126 as alias IPs on eno1. I
want to avoid it.
2. Use proxy arp for entire subnet 10.3.3.0/25 on eno1 but this
require having atleast one IP from this subnet to be created as IP
alias on eno1, say 10.3.3.1/25. However, my concern is that this
10.3.3.1, as it has been assigned to eno1,may be used by mistake to
listen for any service, etc. or ping, etc. which otherwise I would
have to control using iptables rule set. I totally want to avoid it.
So, my query is how to do proxy arp for 10.3.3.0/25 on eno1 without
assigning 10.3.3.1/25 to eno1???
On Sat, Jun 29, 2019 at 7:34 PM Aks Kak <akskak2012@gmail.com> wrote:
>
> I have a linux box with 2 interfaces with following IPs
> eno1 : 10.1.1.0/24
> eno2 : 192.168.2.0/27
>
> I want to use network 10.3.3.0/25 as virtual IPs for 192.168.2.0/25
> i.e. I will be doing DNAT using NETMAP target of IPTABLES.
>
> DNAT and NETMAP, etc. is not the issue.
>
> For my requirement to work, main thing is who (or how) will give arp
> replies for 10.3.3.0/27 !!!
> I have 2 ways of achieving this:
> 1. Create all 126 IPs 10.3.3.1 - 10.3.3.126 as alias IPs on eno1. I
> want to avoid it.
> 2. Use proxy arp for entire subnet 10.3.3.0/25 on eno1 but this
> require having atleast one IP from this subnet to be created as IP
> alias on eno1, say 10.3.3.1/25. However, my concern is that this
> 10.3.3.1, as it has been assigned to eno1,may be used by mistake to
> listen for any service, etc. or ping, etc. which otherwise I would
> have to control using iptables rule set. I totally want to avoid it.
>
> So, my query is how to do proxy arp for 10.3.3.0/25 on eno1 without
> assigning 10.3.3.1/25 to eno1???
^ permalink raw reply
* 答复: [PATCH v4] net: netfilter: Fix rpfilter dropping vrf packets by mistake
From: linmiaohe @ 2019-06-29 14:13 UTC (permalink / raw)
To: David Ahern, pablo@netfilter.org
Cc: kadlec@blackhole.kfki.hu, fw@strlen.de, davem@davemloft.net,
kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Mingfangsen
In-Reply-To: <08740476-acfb-d35a-50b7-3aee42f23bfa@gmail.com>
On 6/29/19 20:20 PM, David Ahern wrote:
> On 6/28/19 8:13 PM, linmiaohe wrote:
> > You're right. Fib rules code would set FLOWI_FLAG_SKIP_NH_OIF flag.
> > But I set it here for distinguish with the flags & XT_RPFILTER_LOOSE
> > branch. Without this, they do the same work and maybe should be
> > combined. I don't want to do that as that makes code confusing.
> > Is this code snipet below ok ? If so, I would delete this flag setting.
> >
> > } else if (netif_is_l3_master(dev) || netif_is_l3_slave(dev)) {
> > fl6.flowi6_oif = dev->ifindex;
> > } else if ((flags & XT_RPFILTER_LOOSE) == 0)
> > fl6.flowi6_oif = dev->ifindex;
> that looks fine to me, but it is up to Pablo.
@David Ahern Many thanks for your valuable advice.
@ Pablo Hi, could you please tell me if this code snipet is ok?
If not, which code would you prefer? It's very nice of you to
figure it out for me. Thanks a lot.
Have a nice day.
Best wishes.
^ permalink raw reply
* Re: [PATCH net-next v3 2/4] gve: Add transmit and receive support (fwd)
From: Julia Lawall @ 2019-06-29 14:14 UTC (permalink / raw)
To: csully
Cc: netdev, Sagi Shahar, Jon Olson, Willem de Bruijn, Luigi Rizzo,
kbuild-all
Please check on line 124.
julia
---------- Forwarded message ----------
Date: Sat, 29 Jun 2019 22:06:06 +0800
From: kbuild test robot <lkp@intel.com>
To: kbuild@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH net-next v3 2/4] gve: Add transmit and receive support
CC: kbuild-all@01.org
In-Reply-To: <20190628230733.54169-3-csully@google.com>
References: <20190628230733.54169-3-csully@google.com>
TO: Catherine Sullivan <csully@google.com>
CC: netdev@vger.kernel.org
CC: Catherine Sullivan <csully@google.com>, Sagi Shahar <sagis@google.com>, Jon Olson <jonolson@google.com>, Willem de Bruijn <willemb@google.com>, Luigi Rizzo <lrizzo@google.com>
Hi Catherine,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Catherine-Sullivan/gve-Add-basic-driver-framework-for-Compute-Engine-Virtual-NIC/20190629-161725
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
>> drivers/net/ethernet/google/gve/gve_rx.c:124:5-22: WARNING: Unsigned expression compared with zero: rx -> desc . fill_cnt < 0
# https://github.com/0day-ci/linux/commit/85611360970280ba46a1abe708f9d63734f0870c
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 85611360970280ba46a1abe708f9d63734f0870c
vim +124 drivers/net/ethernet/google/gve/gve_rx.c
85611360 Catherine Sullivan 2019-06-28 97
85611360 Catherine Sullivan 2019-06-28 98 static int gve_rx_alloc_ring(struct gve_priv *priv, int idx)
85611360 Catherine Sullivan 2019-06-28 99 {
85611360 Catherine Sullivan 2019-06-28 100 struct gve_rx_ring *rx = &priv->rx[idx];
85611360 Catherine Sullivan 2019-06-28 101 struct device *hdev = &priv->pdev->dev;
85611360 Catherine Sullivan 2019-06-28 102 u32 slots, npages, gve_desc_per_page;
85611360 Catherine Sullivan 2019-06-28 103 size_t bytes;
85611360 Catherine Sullivan 2019-06-28 104 int err;
85611360 Catherine Sullivan 2019-06-28 105
85611360 Catherine Sullivan 2019-06-28 106 netif_dbg(priv, drv, priv->dev, "allocating rx ring\n");
85611360 Catherine Sullivan 2019-06-28 107 /* Make sure everything is zeroed to start with */
85611360 Catherine Sullivan 2019-06-28 108 memset(rx, 0, sizeof(*rx));
85611360 Catherine Sullivan 2019-06-28 109
85611360 Catherine Sullivan 2019-06-28 110 rx->gve = priv;
85611360 Catherine Sullivan 2019-06-28 111 rx->q_num = idx;
85611360 Catherine Sullivan 2019-06-28 112
85611360 Catherine Sullivan 2019-06-28 113 slots = priv->rx_pages_per_qpl;
85611360 Catherine Sullivan 2019-06-28 114 rx->data.mask = slots - 1;
85611360 Catherine Sullivan 2019-06-28 115
85611360 Catherine Sullivan 2019-06-28 116 /* alloc rx data ring */
85611360 Catherine Sullivan 2019-06-28 117 bytes = sizeof(*rx->data.data_ring) * slots;
85611360 Catherine Sullivan 2019-06-28 118 rx->data.data_ring = dma_alloc_coherent(hdev, bytes,
85611360 Catherine Sullivan 2019-06-28 119 &rx->data.data_bus,
85611360 Catherine Sullivan 2019-06-28 120 GFP_KERNEL);
85611360 Catherine Sullivan 2019-06-28 121 if (!rx->data.data_ring)
85611360 Catherine Sullivan 2019-06-28 122 return -ENOMEM;
85611360 Catherine Sullivan 2019-06-28 123 rx->desc.fill_cnt = gve_prefill_rx_pages(rx);
85611360 Catherine Sullivan 2019-06-28 @124 if (rx->desc.fill_cnt < 0) {
85611360 Catherine Sullivan 2019-06-28 125 rx->desc.fill_cnt = 0;
85611360 Catherine Sullivan 2019-06-28 126 err = -ENOMEM;
85611360 Catherine Sullivan 2019-06-28 127 goto abort_with_slots;
85611360 Catherine Sullivan 2019-06-28 128 }
85611360 Catherine Sullivan 2019-06-28 129 /* Ensure data ring slots (packet buffers) are visible. */
85611360 Catherine Sullivan 2019-06-28 130 dma_wmb();
85611360 Catherine Sullivan 2019-06-28 131
85611360 Catherine Sullivan 2019-06-28 132 /* Alloc gve_queue_resources */
85611360 Catherine Sullivan 2019-06-28 133 rx->q_resources =
85611360 Catherine Sullivan 2019-06-28 134 dma_alloc_coherent(hdev,
85611360 Catherine Sullivan 2019-06-28 135 sizeof(*rx->q_resources),
85611360 Catherine Sullivan 2019-06-28 136 &rx->q_resources_bus,
85611360 Catherine Sullivan 2019-06-28 137 GFP_KERNEL);
85611360 Catherine Sullivan 2019-06-28 138 if (!rx->q_resources) {
85611360 Catherine Sullivan 2019-06-28 139 err = -ENOMEM;
85611360 Catherine Sullivan 2019-06-28 140 goto abort_filled;
85611360 Catherine Sullivan 2019-06-28 141 }
85611360 Catherine Sullivan 2019-06-28 142 netif_dbg(priv, drv, priv->dev, "rx[%d]->data.data_bus=%lx\n", idx,
85611360 Catherine Sullivan 2019-06-28 143 (unsigned long)rx->data.data_bus);
85611360 Catherine Sullivan 2019-06-28 144
85611360 Catherine Sullivan 2019-06-28 145 /* alloc rx desc ring */
85611360 Catherine Sullivan 2019-06-28 146 gve_desc_per_page = PAGE_SIZE / sizeof(struct gve_rx_desc);
85611360 Catherine Sullivan 2019-06-28 147 bytes = sizeof(struct gve_rx_desc) * priv->rx_desc_cnt;
85611360 Catherine Sullivan 2019-06-28 148 npages = bytes / PAGE_SIZE;
85611360 Catherine Sullivan 2019-06-28 149 if (npages * PAGE_SIZE != bytes) {
85611360 Catherine Sullivan 2019-06-28 150 err = -EIO;
85611360 Catherine Sullivan 2019-06-28 151 goto abort_with_q_resources;
85611360 Catherine Sullivan 2019-06-28 152 }
85611360 Catherine Sullivan 2019-06-28 153
85611360 Catherine Sullivan 2019-06-28 154 rx->desc.desc_ring = dma_alloc_coherent(hdev, bytes, &rx->desc.bus,
85611360 Catherine Sullivan 2019-06-28 155 GFP_KERNEL);
85611360 Catherine Sullivan 2019-06-28 156 if (!rx->desc.desc_ring) {
85611360 Catherine Sullivan 2019-06-28 157 err = -ENOMEM;
85611360 Catherine Sullivan 2019-06-28 158 goto abort_with_q_resources;
85611360 Catherine Sullivan 2019-06-28 159 }
85611360 Catherine Sullivan 2019-06-28 160 rx->desc.mask = slots - 1;
85611360 Catherine Sullivan 2019-06-28 161 rx->desc.cnt = 0;
85611360 Catherine Sullivan 2019-06-28 162 rx->desc.seqno = 1;
85611360 Catherine Sullivan 2019-06-28 163 gve_rx_add_to_block(priv, idx);
85611360 Catherine Sullivan 2019-06-28 164
85611360 Catherine Sullivan 2019-06-28 165 return 0;
85611360 Catherine Sullivan 2019-06-28 166
85611360 Catherine Sullivan 2019-06-28 167 abort_with_q_resources:
85611360 Catherine Sullivan 2019-06-28 168 dma_free_coherent(hdev, sizeof(*rx->q_resources),
85611360 Catherine Sullivan 2019-06-28 169 rx->q_resources, rx->q_resources_bus);
85611360 Catherine Sullivan 2019-06-28 170 rx->q_resources = NULL;
85611360 Catherine Sullivan 2019-06-28 171 abort_filled:
85611360 Catherine Sullivan 2019-06-28 172 kfree(rx->data.page_info);
85611360 Catherine Sullivan 2019-06-28 173 abort_with_slots:
85611360 Catherine Sullivan 2019-06-28 174 bytes = sizeof(*rx->data.data_ring) * slots;
85611360 Catherine Sullivan 2019-06-28 175 dma_free_coherent(hdev, bytes, rx->data.data_ring, rx->data.data_bus);
85611360 Catherine Sullivan 2019-06-28 176 rx->data.data_ring = NULL;
85611360 Catherine Sullivan 2019-06-28 177
85611360 Catherine Sullivan 2019-06-28 178 return err;
85611360 Catherine Sullivan 2019-06-28 179 }
85611360 Catherine Sullivan 2019-06-28 180
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply
* Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro
From: Alexey Dobriyan @ 2019-06-29 14:25 UTC (permalink / raw)
To: Andreas Dilger
Cc: Andrew Morton, Shyam Saini, kernel-hardening, linux-kernel,
keescook, linux-arm-kernel, linux-mips, intel-gvt-dev, intel-gfx,
dri-devel, netdev, linux-ext4, devel, linux-mm, linux-sctp, bpf,
kvm, mayhs11saini
In-Reply-To: <6DCAE4F8-3BEC-45F2-A733-F4D15850B7F3@dilger.ca>
On Tue, Jun 11, 2019 at 03:00:10PM -0600, Andreas Dilger wrote:
> On Jun 11, 2019, at 2:48 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > On Wed, 12 Jun 2019 01:08:36 +0530 Shyam Saini <shyam.saini@amarulasolutions.com> wrote:
> I did a check, and FIELD_SIZEOF() is used about 350x, while sizeof_field()
> is about 30x, and SIZEOF_FIELD() is only about 5x.
>
> That said, I'm much more in favour of "sizeof_field()" or "sizeof_member()"
> than FIELD_SIZEOF(). Not only does that better match "offsetof()", with
> which it is closely related, but is also closer to the original "sizeof()".
>
> Since this is a rather trivial change, it can be split into a number of
> patches to get approval/landing via subsystem maintainers, and there is no
> huge urgency to remove the original macros until the users are gone. It
> would make sense to remove SIZEOF_FIELD() and sizeof_field() quickly so
> they don't gain more users, and the remaining FIELD_SIZEOF() users can be
> whittled away as the patches come through the maintainer trees.
The signature should be
sizeof_member(T, m)
it is proper English,
it is lowercase, so is easier to type,
it uses standard term (member, not field),
it blends in with standard "sizeof" operator,
^ permalink raw reply
* [PATCH bpf] selftests: bpf: fix inlines in test_lwt_seg6local
From: Jiri Benc @ 2019-06-29 14:43 UTC (permalink / raw)
To: netdev, bpf; +Cc: Alexei Starovoitov, Daniel Borkmann, Mathieu Xhonneux
Selftests are reporting this failure in test_lwt_seg6local.sh:
+ ip netns exec ns2 ip -6 route add fb00::6 encap bpf in obj test_lwt_seg6local.o sec encap_srh dev veth2
Error fetching program/map!
Failed to parse eBPF program: Operation not permitted
The problem is __attribute__((always_inline)) alone is not enough to prevent
clang from inserting those functions in .text. In that case, .text is not
marked as relocateable.
See the output of objdump -h test_lwt_seg6local.o:
Idx Name Size VMA LMA File off Algn
0 .text 00003530 0000000000000000 0000000000000000 00000040 2**3
CONTENTS, ALLOC, LOAD, READONLY, CODE
This causes the iproute bpf loader to fail in bpf_fetch_prog_sec:
bpf_has_call_data returns true but bpf_fetch_prog_relo fails as there's no
relocateable .text section in the file.
Add 'static inline' to fix this.
Fixes: c99a84eac026 ("selftests/bpf: test for seg6local End.BPF action")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
.../selftests/bpf/progs/test_lwt_seg6local.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/test_lwt_seg6local.c b/tools/testing/selftests/bpf/progs/test_lwt_seg6local.c
index 0575751bc1bc..5848c1b52554 100644
--- a/tools/testing/selftests/bpf/progs/test_lwt_seg6local.c
+++ b/tools/testing/selftests/bpf/progs/test_lwt_seg6local.c
@@ -61,7 +61,8 @@ struct sr6_tlv_t {
unsigned char value[0];
} BPF_PACKET_HEADER;
-__attribute__((always_inline)) struct ip6_srh_t *get_srh(struct __sk_buff *skb)
+static inline __attribute__((always_inline))
+struct ip6_srh_t *get_srh(struct __sk_buff *skb)
{
void *cursor, *data_end;
struct ip6_srh_t *srh;
@@ -95,7 +96,7 @@ __attribute__((always_inline)) struct ip6_srh_t *get_srh(struct __sk_buff *skb)
return srh;
}
-__attribute__((always_inline))
+static inline __attribute__((always_inline))
int update_tlv_pad(struct __sk_buff *skb, uint32_t new_pad,
uint32_t old_pad, uint32_t pad_off)
{
@@ -125,7 +126,7 @@ int update_tlv_pad(struct __sk_buff *skb, uint32_t new_pad,
return 0;
}
-__attribute__((always_inline))
+static inline __attribute__((always_inline))
int is_valid_tlv_boundary(struct __sk_buff *skb, struct ip6_srh_t *srh,
uint32_t *tlv_off, uint32_t *pad_size,
uint32_t *pad_off)
@@ -184,7 +185,7 @@ int is_valid_tlv_boundary(struct __sk_buff *skb, struct ip6_srh_t *srh,
return 0;
}
-__attribute__((always_inline))
+static inline __attribute__((always_inline))
int add_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh, uint32_t tlv_off,
struct sr6_tlv_t *itlv, uint8_t tlv_size)
{
@@ -228,7 +229,7 @@ int add_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh, uint32_t tlv_off,
return update_tlv_pad(skb, new_pad, pad_size, pad_off);
}
-__attribute__((always_inline))
+static inline __attribute__((always_inline))
int delete_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh,
uint32_t tlv_off)
{
@@ -266,7 +267,7 @@ int delete_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh,
return update_tlv_pad(skb, new_pad, pad_size, pad_off);
}
-__attribute__((always_inline))
+static inline __attribute__((always_inline))
int has_egr_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh)
{
int tlv_offset = sizeof(struct ip6_t) + sizeof(struct ip6_srh_t) +
--
2.18.1
^ permalink raw reply related
* Re: [PATCH net-next v2 1/4] gve: Add basic driver framework for Compute Engine Virtual NIC
From: kbuild test robot @ 2019-06-29 15:07 UTC (permalink / raw)
To: Catherine Sullivan
Cc: kbuild-all, netdev, Catherine Sullivan, Sagi Shahar, Jon Olson,
Willem de Bruijn, Luigi Rizzo
In-Reply-To: <20190628175633.143501-2-csully@google.com>
[-- Attachment #1: Type: text/plain, Size: 1134 bytes --]
Hi Catherine,
I love your patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Catherine-Sullivan/Add-gve-driver/20190629-143743
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-9) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/net/ethernet/google/gve/gve_main.c:16:0:
>> drivers/net/ethernet/google/gve/gve_adminq.h:102:1: error: static assertion failed: "sizeof(struct gve_adminq_set_driver_parameter) == 16"
static_assert(sizeof(struct gve_adminq_set_driver_parameter) == 16);
^~~~~~~~~~~~~~
vim +102 drivers/net/ethernet/google/gve/gve_adminq.h
101
> 102 static_assert(sizeof(struct gve_adminq_set_driver_parameter) == 16);
103
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 67813 bytes --]
^ permalink raw reply
* [PATCH net 0/5] bnxt_en: Bug fixes.
From: Michael Chan @ 2019-06-29 15:16 UTC (permalink / raw)
To: davem; +Cc: netdev
Miscellaneous bug fix patches, including two resource handling fixes for
the RDMA driver, a PCI shutdown patch to add pci_disable_device(), a patch
to fix ethtool selftest crash, and the last one suppresses an unnecessry
error message.
Please also queue patches 1, 2, and 3 for -stable. Thanks.
Michael Chan (5):
bnxt_en: Disable bus master during PCI shutdown and driver unload.
bnxt_en: Fix ethtool selftest crash under error conditions.
bnxt_en: Fix statistics context reservation logic for RDMA driver.
bnxt_en: Cap the returned MSIX vectors to the RDMA driver.
bnxt_en: Suppress error messages when querying DSCP DCB capabilities.
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 20 +++++++++++++-------
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | 2 +-
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 6 +++---
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 4 +++-
4 files changed, 20 insertions(+), 12 deletions(-)
--
2.5.1
^ permalink raw reply
* [PATCH net 1/5] bnxt_en: Disable bus master during PCI shutdown and driver unload.
From: Michael Chan @ 2019-06-29 15:16 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1561821408-17418-1-git-send-email-michael.chan@broadcom.com>
Some chips with older firmware can continue to perform DMA read from
context memory even after the memory has been freed. In the PCI shutdown
method, we need to call pci_disable_device() to shutdown DMA to prevent
this DMA before we put the device into D3hot. DMA memory request in
D3hot state will generate PCI fatal error. Similarly, in the driver
remove method, the context memory should only be freed after DMA has
been shutdown for correctness.
Fixes: 98f04cf0f1fc ("bnxt_en: Check context memory requirements from firmware.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index f758b2e..b9bc829 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -10262,10 +10262,10 @@ static void bnxt_remove_one(struct pci_dev *pdev)
bnxt_dcb_free(bp);
kfree(bp->edev);
bp->edev = NULL;
+ bnxt_cleanup_pci(bp);
bnxt_free_ctx_mem(bp);
kfree(bp->ctx);
bp->ctx = NULL;
- bnxt_cleanup_pci(bp);
bnxt_free_port_stats(bp);
free_netdev(dev);
}
@@ -10859,6 +10859,7 @@ static void bnxt_shutdown(struct pci_dev *pdev)
if (system_state == SYSTEM_POWER_OFF) {
bnxt_clear_int_mode(bp);
+ pci_disable_device(pdev);
pci_wake_from_d3(pdev, bp->wol);
pci_set_power_state(pdev, PCI_D3hot);
}
--
2.5.1
^ permalink raw reply related
* [PATCH net 2/5] bnxt_en: Fix ethtool selftest crash under error conditions.
From: Michael Chan @ 2019-06-29 15:16 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1561821408-17418-1-git-send-email-michael.chan@broadcom.com>
After ethtool loopback packet tests, we re-open the nic for the next
IRQ test. If the open fails, we must not proceed with the IRQ test
or we will crash with NULL pointer dereference. Fix it by checking
the bnxt_open_nic() return code before proceeding.
Reported-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Fixes: 67fea463fd87 ("bnxt_en: Add interrupt test to ethtool -t selftest.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index a6c7baf..ec68707 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -2842,7 +2842,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
bool offline = false;
u8 test_results = 0;
u8 test_mask = 0;
- int rc, i;
+ int rc = 0, i;
if (!bp->num_tests || !BNXT_SINGLE_PF(bp))
return;
@@ -2913,9 +2913,9 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
}
bnxt_hwrm_phy_loopback(bp, false, false);
bnxt_half_close_nic(bp);
- bnxt_open_nic(bp, false, true);
+ rc = bnxt_open_nic(bp, false, true);
}
- if (bnxt_test_irq(bp)) {
+ if (rc || bnxt_test_irq(bp)) {
buf[BNXT_IRQ_TEST_IDX] = 1;
etest->flags |= ETH_TEST_FL_FAILED;
}
--
2.5.1
^ permalink raw reply related
* [PATCH net 4/5] bnxt_en: Cap the returned MSIX vectors to the RDMA driver.
From: Michael Chan @ 2019-06-29 15:16 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1561821408-17418-1-git-send-email-michael.chan@broadcom.com>
In an earlier commit to improve NQ reservations on 57500 chips, we
set the resv_irqs on the 57500 VFs to the fixed value assigned by
the PF regardless of how many are actually used. The current
code assumes that resv_irqs minus the ones used by the network driver
must be the ones for the RDMA driver. This is no longer true and
we may return more MSIX vectors than requested, causing inconsistency.
Fix it by capping the value.
Fixes: 01989c6b69d9 ("bnxt_en: Improve NQ reservations.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
index bfa342a..fc77caf 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
@@ -157,8 +157,10 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id,
if (BNXT_NEW_RM(bp)) {
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
+ int resv_msix;
- avail_msix = hw_resc->resv_irqs - bp->cp_nr_rings;
+ resv_msix = hw_resc->resv_irqs - bp->cp_nr_rings;
+ avail_msix = min_t(int, resv_msix, avail_msix);
edev->ulp_tbl[ulp_id].msix_requested = avail_msix;
}
bnxt_fill_msix_vecs(bp, ent);
--
2.5.1
^ permalink raw reply related
* [PATCH net 5/5] bnxt_en: Suppress error messages when querying DSCP DCB capabilities.
From: Michael Chan @ 2019-06-29 15:16 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1561821408-17418-1-git-send-email-michael.chan@broadcom.com>
Some firmware versions do not support this so use the silent variant
to send the message to firmware to suppress the harmless error. This
error message is unnecessarily alarming the user.
Fixes: afdc8a84844a ("bnxt_en: Add DCBNL DSCP application protocol support.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
index 7077515..07301cb 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
@@ -396,7 +396,7 @@ static int bnxt_hwrm_queue_dscp_qcaps(struct bnxt *bp)
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_QUEUE_DSCP_QCAPS, -1, -1);
mutex_lock(&bp->hwrm_cmd_lock);
- rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
+ rc = _hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
if (!rc) {
bp->max_dscp_value = (1 << resp->num_dscp_bits) - 1;
if (bp->max_dscp_value < 0x3f)
--
2.5.1
^ permalink raw reply related
* [PATCH net 3/5] bnxt_en: Fix statistics context reservation logic for RDMA driver.
From: Michael Chan @ 2019-06-29 15:16 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1561821408-17418-1-git-send-email-michael.chan@broadcom.com>
The current logic assumes that the RDMA driver uses one statistics
context adjacent to the ones used by the network driver. This
assumption is not true and the statistics context used by the
RDMA driver is tied to its MSIX base vector. This wrong assumption
can cause RDMA driver failure after changing ethtool rings on the
network side. Fix the statistics reservation logic accordingly.
Fixes: 780baad44f0f ("bnxt_en: Reserve 1 stat_ctx for RDMA driver.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index b9bc829..9090c79 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -5508,7 +5508,16 @@ static int bnxt_cp_rings_in_use(struct bnxt *bp)
static int bnxt_get_func_stat_ctxs(struct bnxt *bp)
{
- return bp->cp_nr_rings + bnxt_get_ulp_stat_ctxs(bp);
+ int ulp_stat = bnxt_get_ulp_stat_ctxs(bp);
+ int cp = bp->cp_nr_rings;
+
+ if (!ulp_stat)
+ return cp;
+
+ if (bnxt_nq_rings_in_use(bp) > cp + bnxt_get_ulp_msix_num(bp))
+ return bnxt_get_ulp_msix_base(bp) + ulp_stat;
+
+ return cp + ulp_stat;
}
static bool bnxt_need_reserve_rings(struct bnxt *bp)
@@ -7477,11 +7486,7 @@ unsigned int bnxt_get_avail_cp_rings_for_en(struct bnxt *bp)
unsigned int bnxt_get_avail_stat_ctxs_for_en(struct bnxt *bp)
{
- unsigned int stat;
-
- stat = bnxt_get_max_func_stat_ctxs(bp) - bnxt_get_ulp_stat_ctxs(bp);
- stat -= bp->cp_nr_rings;
- return stat;
+ return bnxt_get_max_func_stat_ctxs(bp) - bnxt_get_func_stat_ctxs(bp);
}
int bnxt_get_avail_msix(struct bnxt *bp, int num)
--
2.5.1
^ permalink raw reply related
* Re: [RFC net-next] net: dsa: add support for MC_DISABLED attribute
From: Ido Schimmel @ 2019-06-29 15:31 UTC (permalink / raw)
To: f.fainelli, vivien.didelot
Cc: netdev@vger.kernel.org, Jiri Pirko, linux@armlinux.org.uk,
andrew@lunn.ch, davem@davemloft.net
In-Reply-To: <20190623064838.GA13466@splinter>
On Sun, Jun 23, 2019 at 06:48:41AM +0000, Ido Schimmel wrote:
> On Thu, Jun 20, 2019 at 07:24:47PM -0700, Florian Fainelli wrote:
> > On 6/20/2019 4:56 PM, Vivien Didelot wrote:
> > > This patch adds support for enabling or disabling the flooding of
> > > unknown multicast traffic on the CPU ports, depending on the value
> > > of the switchdev SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED attribute.
> > >
> > > This allows the user to prevent the CPU to be flooded with a lot of
> > > undesirable traffic that the network stack needs to filter in software.
> > >
> > > The bridge has multicast snooping enabled by default, hence CPU ports
> > > aren't bottlenecked with arbitrary network applications anymore.
> > > But this can be an issue in some scenarios such as pinging the bridge's
> > > IPv6 address. Setting /sys/class/net/br0/bridge/multicast_snooping to
> > > 0 would restore unknown multicast flooding and thus fix ICMPv6. As
> > > an alternative, enabling multicast_querier would program the bridge
> > > address into the switch.
> > From what I can read from mlxsw, we should probably also implement the
> > SWITCHDEV_ATTR_ID_PORT_MROUTER attribute in order to be consistent.
> >
> > Since the attribute MC_DISABLED is on the bridge master, we should also
> > iterate over the list of switch ports being a member of that bridge and
> > change their flooding attribute, taking into account whether
> > BR_MCAST_FLOOD is set on that particular port or not. Just paraphrasing
> > what mlxsw does here again...
>
> When multicast snooping is enabled, unregistered multicast traffic
> should be flooded to mrouter ports only. Otherwise, it should be flooded
> to all ports.
>
> > Once you act on the user-facing ports, you might be able to leave the
> > CPU port flooding unconditionally, since it would only "flood" the CPU
> > port either because an user-facing port has BR_MCAST_FLOOD set, or
> > because this is known MC traffic that got programmed via the bridge's
> > MDB. Would that work?
> >
> > On a higher level, I really wish we did not have to re-implement a lot
> > of identical or similar logic in each switch drivers and had a more
> > central model of what is behaviorally expected.
>
> Well, that model is the bridge driver... But I agree that we can
> probably simplify the interface towards drivers and move more code up
> the stack.
>
> For example, two things mlxsw is doing when multicast snooping is
> enabled:
>
> 1. Writing MDB entries to the device. When multicast snooping is
> disabled, MDB entries are ignored by the bridge driver. Can we agree to
> have the bridge driver generate SWITCHDEV_OBJ_ID_PORT_MDB add / delete
> for all MDB entries when multicast snooping is toggled?
>
> 2. Flooding unregistered multicast traffic only to mrouter ports. The
> bridge driver can iterate over the bridge members and toggle
> BR_MCAST_FLOOD accordingly. It will not actually change this value. Only
> emulate this change towards drivers.
>
> I will try to come up with a more detailed list later this week.
I reviewed the MC logic in mlxsw again and while I found some things
that can be improved, I don't think major simplification can happen
there.
Regarding "central model of what is behaviorally expected". IMO, the
best thing is to make sure that all the implementations pass tests that
codify what is to be expected. Given that the model is the Linux bridge,
the tests should of course pass with veth pairs.
We have some tests under tools/testing/selftests/net/forwarding/, but
not so much for MC. However, even if such tests were to be contributed,
would you be able to run them on your hardware? I remember that in the
past you complained about the number of required ports. Is there
something you can do about it? How many ports are available on your
platforms?
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox