Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next] xdp: xdp_umem: fix umem pages mapping for 32bits systems
From: David Miller @ 2019-06-29 17:53 UTC (permalink / raw)
  To: bjorn.topel
  Cc: ivan.khoronzhuk, bjorn.topel, magnus.karlsson, ast, daniel, hawk,
	john.fastabend, netdev, bpf, xdp-newbies, linux-kernel
In-Reply-To: <CAJ+HfNid3PntipAJHuPR-tQudf+E6UQK6mPDHdc0O=wCUSjEEA@mail.gmail.com>

From: Björn Töpel <bjorn.topel@gmail.com>
Date: Wed, 26 Jun 2019 22:50:23 +0200

> On Wed, 26 Jun 2019 at 17:59, Ivan Khoronzhuk
> <ivan.khoronzhuk@linaro.org> wrote:
>>
>> Use kmap instead of page_address as it's not always in low memory.
>>
> 
> Ah, some 32-bit love. :-) Thanks for working on this!
> 
> For future patches, please base AF_XDP patches on the bpf/bpf-next
> tree instead of net/net-next.
> 
> Acked-by: Björn Töpel <bjorn.topel@intel.com>

Alexei and Daniel, I'll let you guys take this one.

Thanks.

^ permalink raw reply

* Re: [PATCH net] sctp: not bind the socket in sctp_connect
From: David Miller @ 2019-06-29 17:51 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman, syzkaller-bugs
In-Reply-To: <35a0e4f6ca68185117c6e5517d8ac924cc2f9d05.1561537899.git.lucien.xin@gmail.com>

From: Xin Long <lucien.xin@gmail.com>
Date: Wed, 26 Jun 2019 16:31:39 +0800

> Now when sctp_connect() is called with a wrong sa_family, it binds
> to a port but doesn't set bp->port, then sctp_get_af_specific will
> return NULL and sctp_connect() returns -EINVAL.
> 
> Then if sctp_bind() is called to bind to another port, the last
> port it has bound will leak due to bp->port is NULL by then.
> 
> sctp_connect() doesn't need to bind ports, as later __sctp_connect
> will do it if bp->port is NULL. So remove it from sctp_connect().
> While at it, remove the unnecessary sockaddr.sa_family len check
> as it's already done in sctp_inet_connect.
> 
> Fixes: 644fbdeacf1d ("sctp: fix the issue that flags are ignored when using kernel_connect")
> Reported-by: syzbot+079bf326b38072f849d9@syzkaller.appspotmail.com
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply

* Re: [PATCH net-next 0/2] Fix batched event generation for mirred action
From: Jamal Hadi Salim @ 2019-06-29 17:45 UTC (permalink / raw)
  To: Roman Mashak, davem; +Cc: netdev, kernel, xiyou.wangcong, jiri
In-Reply-To: <1561746618-29349-1-git-send-email-mrv@mojatatu.com>

On 2019-06-28 2:30 p.m., Roman Mashak wrote:
> When adding or deleting a batch of entries, the kernel sends upto
> TCA_ACT_MAX_PRIO entries in an event to user space. However it does not
> consider that the action sizes may vary and require different skb sizes.
> 
> For example :
> 
> % cat tc-batch.sh
> TC="sudo /mnt/iproute2.git/tc/tc"
> 
> $TC actions flush action mirred
> for i in `seq 1 $1`;
> do
>     cmd="action mirred egress redirect dev lo index $i "
>     args=$args$cmd
> done
> $TC actions add $args
> %
> % ./tc-batch.sh 32
> Error: Failed to fill netlink attributes while adding TC action.
> We have an error talking to the kernel
> %
> 
> patch 1 adds callback in tc_action_ops of mirred action, which calculates
> the action size, and passes size to tcf_add_notify()/tcf_del_notify().
> 
> patch 2 updates the TDC test suite with relevant test cases.
> 

Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

^ permalink raw reply

* Re: [PATCH net-next] hinic: add vlan offload support
From: David Miller @ 2019-06-29 17:28 UTC (permalink / raw)
  To: xuechaojing
  Cc: linux-kernel, netdev, luoshaokai, cloud.wangxiaoyun, chiqijun,
	wulike1
In-Reply-To: <20190629022627.25396-1-xuechaojing@huawei.com>

From: Xue Chaojing <xuechaojing@huawei.com>
Date: Sat, 29 Jun 2019 02:26:27 +0000

> This patch adds vlan offload support for the HINIC driver.
> 
> Signed-off-by: Xue Chaojing <xuechaojing@huawei.com>

Applied, thank you.

^ permalink raw reply

* Re: [PATCH net-next v3 4/4] gve: Add ethtool support
From: David Miller @ 2019-06-29 17:19 UTC (permalink / raw)
  To: csully; +Cc: netdev, sagis, jonolson, willemb, lrizzo
In-Reply-To: <20190628230733.54169-5-csully@google.com>

From: Catherine Sullivan <csully@google.com>
Date: Fri, 28 Jun 2019 16:07:33 -0700

> +void gve_get_channels(struct net_device *netdev, struct ethtool_channels *cmd)
 ...
> +int gve_set_channels(struct net_device *netdev, struct ethtool_channels *cmd)
 ...
> +void gve_get_ringparam(struct net_device *netdev,
> +		       struct ethtool_ringparam *cmd)
 ...
> +int gve_user_reset(struct net_device *netdev, u32 *flags)
 ...

Please mark these static as per the kbuild robot feedback.

Thank you.

^ permalink raw reply

* Re: [PATCH net-next v2 2/4] gve: Add transmit and receive support
From: kbuild test robot @ 2019-06-29 17:00 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>

[-- Attachment #1: Type: text/plain, Size: 1353 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:134:1: error: static assertion failed: "sizeof(struct gve_adminq_create_rx_queue) == 48"
    static_assert(sizeof(struct gve_adminq_create_rx_queue) == 48);
    ^~~~~~~~~~~~~~
   drivers/net/ethernet/google/gve/gve_adminq.h:171:1: error: static assertion failed: "sizeof(struct gve_adminq_set_driver_parameter) == 16"
    static_assert(sizeof(struct gve_adminq_set_driver_parameter) == 16);
    ^~~~~~~~~~~~~~

vim +134 drivers/net/ethernet/google/gve/gve_adminq.h

   133	
 > 134	static_assert(sizeof(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: 67813 bytes --]

^ permalink raw reply

* Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro
From: Joe Perches @ 2019-06-29 16:45 UTC (permalink / raw)
  To: Alexey Dobriyan, 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: <20190629142510.GA10629@avx2>

On Sat, 2019-06-29 at 17:25 +0300, Alexey Dobriyan wrote:
> 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,

yes please.

Also, a simple script conversion applied
immediately after an rc1 might be easiest
rather than individual patches.



^ permalink raw reply

* Re: [RFC net-next] net: dsa: add support for MC_DISABLED attribute
From: Ido Schimmel @ 2019-06-29 16:29 UTC (permalink / raw)
  To: Russell King - ARM Linux admin, nikolay, linus.luessing
  Cc: Ido Schimmel, Vivien Didelot, Florian Fainelli,
	netdev@vger.kernel.org, Jiri Pirko, andrew@lunn.ch,
	davem@davemloft.net
In-Reply-To: <20190623074427.GA21875@splinter>

On Sun, Jun 23, 2019 at 10:44:27AM +0300, Ido Schimmel wrote:
> On Sun, Jun 23, 2019 at 08:26:05AM +0100, Russell King - ARM Linux admin wrote:
> > On Sun, Jun 23, 2019 at 07:09:52AM +0000, Ido Schimmel wrote:
> > > When multicast snooping is enabled unregistered multicast traffic should
> > > only be flooded to mrouter ports.
> > 
> > Given that IPv6 relies upon multicast working, and multicast snooping
> > is a kernel configuration option, and MLD messages will only be sent
> > when whenever the configuration on the target changes, and there may
> > not be a multicast querier in the system, who does that ensure that
> > IPv6 can work on a bridge where the kernel configured and built with
> > multicast snooping enabled?
> 
> See commit b00589af3b04 ("bridge: disable snooping if there is no
> querier"). I think that's unfortunate behavior that we need because
> multicast snooping is enabled by default. If it weren't enabled by
> default, then anyone enabling it would also make sure there's a querier
> in the network.

Linus, Nik,

I brought this problem in the past, but we didn't reach a solution, so
I'll try again :)

The problem:

Even if multicast snooping is enabled, the bridge driver will flood
multicast packets to all the ports if no querier was detected on the
link. The querier states (IPv4 & IPv6) are not currently reflected to
switchdev drivers which means that the hardware data path will only
flood unregistered multicast packets to mrouter ports (which can be an
empty list).

In default configurations (where multicast snooping is enabled and the
bridge querier is disabled), this can prevent IPv6 ping from passing, as
there are no mrouter ports and there is no MDB entry corresponding to
the solicited-node multicast address.

Is there anything we can do about it? Enable the bridge querier if no
other querier was detected? Commit c5c23260594c ("bridge: Add
multicast_querier toggle and disable queries by default") disabled
queries by default, but I'm only suggesting to turn them on if no other
querier was detected on the link. Do you think it's still a problem?

I would like to avoid having drivers take the querier state into account
as it will only complicate things further.

Thanks

^ permalink raw reply

* BUG: using smp_processor_id() in preemptible [ADDR] code: syz-executor
From: syzbot @ 2019-06-29 15:47 UTC (permalink / raw)
  To: allison, davem, gregkh, jon.maloy, kuznet, linux-kernel, netdev,
	syzkaller-bugs, tglx, tipc-discussion, ying.xue, yoshfuji

Hello,

syzbot found the following crash on:

HEAD commit:    ee7dd773 sis900: remove TxIDLE
git tree:       net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=17ceb9a9a00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=7ac9edef4d37e5fb
dashboard link: https://syzkaller.appspot.com/bug?extid=1a68504d96cd17b33a05
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=119b2a13a00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13127bada00000

The bug was bisected to:

commit 52dfae5c85a4c1078e9f1d5e8947d4a25f73dd81
Author: Jon Maloy <jon.maloy@ericsson.com>
Date:   Thu Mar 22 19:42:52 2018 +0000

     tipc: obtain node identity from interface by default

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=160ad903a00000
final crash:    https://syzkaller.appspot.com/x/report.txt?x=150ad903a00000
console output: https://syzkaller.appspot.com/x/log.txt?x=110ad903a00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+1a68504d96cd17b33a05@syzkaller.appspotmail.com
Fixes: 52dfae5c85a4 ("tipc: obtain node identity from interface by default")

Started in network mode
Own node identity 7f000001, cluster identity 4711
New replicast peer: 172.20.20.22
check_preemption_disabled: 3 callbacks suppressed
BUG: using smp_processor_id() in preemptible [00000000] code:  
syz-executor834/8612
caller is dst_cache_get+0x3d/0xb0 net/core/dst_cache.c:68
CPU: 0 PID: 8612 Comm: syz-executor834 Not tainted 5.2.0-rc6+ #48
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x172/0x1f0 lib/dump_stack.c:113
  check_preemption_disabled lib/smp_processor_id.c:47 [inline]
  debug_smp_processor_id+0x251/0x280 lib/smp_processor_id.c:57
  dst_cache_get+0x3d/0xb0 net/core/dst_cache.c:68
  tipc_udp_xmit.isra.0+0xc4/0xb80 net/tipc/udp_media.c:164
  tipc_udp_send_msg+0x29a/0x4b0 net/tipc/udp_media.c:254
  tipc_bearer_xmit_skb+0x16c/0x360 net/tipc/bearer.c:503
  tipc_enable_bearer+0xabe/0xd20 net/tipc/bearer.c:328
  __tipc_nl_bearer_enable+0x2de/0x3a0 net/tipc/bearer.c:899
  tipc_nl_bearer_enable+0x23/0x40 net/tipc/bearer.c:907
  genl_family_rcv_msg+0x74b/0xf90 net/netlink/genetlink.c:629
  genl_rcv_msg+0xca/0x16c net/netlink/genetlink.c:654
  netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2477
  genl_rcv+0x29/0x40 net/netlink/genetlink.c:665
  netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
  netlink_unicast+0x531/0x710 net/netlink/af_netlink.c:1328
  netlink_sendmsg+0x8ae/0xd70 net/netlink/af_netlink.c:1917
  sock_sendmsg_nosec net/socket.c:646 [inline]
  sock_sendmsg+0xd7/0x130 net/socket.c:665
  ___sys_sendmsg+0x803/0x920 net/socket.c:2286
  __sys_sendmsg+0x105/0x1d0 net/socket.c:2324
  __do_sys_sendmsg net/socket.c:2333 [inline]
  __se_sys_sendmsg net/socket.c:2331 [inline]
  __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2331
  do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x444679
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 1b d8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fff0201a8b8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004002e0 RCX: 0000000000444679
RDX: 0000000000000000 RSI: 0000000020000580 RDI: 0000000000000003
RBP: 00000000006cf018 R08: 0000000000000001 R09: 00000000004002e0
R10: 0000000000000008 R11: 0000000000000246 R12: 0000000000402320
R13: 00000000004023b0 R14: 0000000000000000 R15: 0000000000


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply

* 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

* [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

* [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 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 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 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 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

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

* 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

* 答复: [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: 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

* 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: [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

* [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


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox