* Re: [PATCH net] net/ipv6: Fix updates to prefix route
From: David Miller @ 2018-06-30 11:54 UTC (permalink / raw)
To: dsahern; +Cc: netdev, sowmini.varadhan, dsahern
In-Reply-To: <20180628203655.14293-1-dsahern@kernel.org>
From: dsahern@kernel.org
Date: Thu, 28 Jun 2018 13:36:55 -0700
> From: David Ahern <dsahern@gmail.com>
>
> Sowmini reported that a recent commit broke prefix routes for linklocal
> addresses. The newly added modify_prefix_route is attempting to add a
> new prefix route when the ifp priority does not match the route metric
> however the check needs to account for the default priority. In addition,
> the route add fails because the route already exists, and then the delete
> removes the one that exists. Flip the order to do the delete first.
>
> Fixes: 8308f3ff1753 ("net/ipv6: Add support for specifying metric of connected routes")
> Reported-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
> Tested-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
> Signed-off-by: David Ahern <dsahern@gmail.com>
Applied, thanks David.
^ permalink raw reply
* Re: [PATCH] r8169: remove TBI 1000BaseX support
From: David Miller @ 2018-06-30 11:54 UTC (permalink / raw)
To: hkallweit1; +Cc: nic_swsd, netdev
In-Reply-To: <e68152e2-4187-ad39-39e4-dadad5a1f6cd@gmail.com>
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Fri, 29 Jun 2018 08:07:04 +0200
> The very first version of RTL8169 from 2002 (and only this one) has
> support for a TBI 1000BaseX fiber interface. The TBI support in the
> driver makes switching to phylib tricky, so best would be to get
> rid of it. I found no report from anybody using a device with RTL8169
> and fiber interface, also the vendor driver doesn't support this mode
> (any longer).
> So remove TBI support and bail out with a message if a card with
> activated TBI is detected. If there really should be any user of it
> out there, we could add a stripped-down version of the driver
> supporting chip version 01 and TBI only (and maybe move it to
> staging).
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Ok, I guess this is reasonable.
Applied, but it will be a mini-disaster if someone is actually making
use of this fiber support for whatever reason.
^ permalink raw reply
* Re: [PATCH 1/2] cdc_ncm: Hook into usbnet_change_mtu respecting usbnet,driver_info
From: Bjørn Mork @ 2018-06-30 12:01 UTC (permalink / raw)
To: Miguel Rodríguez Pérez; +Cc: linux-usb, netdev
In-Reply-To: <f7e03920-e32d-e49c-9c9e-d7a4473828ee@det.uvigo.gal>
Miguel Rodríguez Pérez <miguel@det.uvigo.gal> writes:
> Change the way cdc_ncm_change_mtu hooks into the netdev_ops
> structure so that changes into usbnet driver_info operations
> can be respected. Without this, is was not possible to hook
> into usbnet_set_rx_mode.
Please export usbnet_set_rx_mode instead, so that cdc_ncm_netdev_ops
can be kept const.
Bjørn
^ permalink raw reply
* Re: [PATCH net-next 05/10] net: hns3: using modulo for cyclic counters in hclge_cmd_send
From: David Miller @ 2018-06-30 12:03 UTC (permalink / raw)
To: lipeng321; +Cc: netdev, linux-kernel, linuxarm, yisen.zhuang, salil.mehta
In-Reply-To: <1530271385-49668-6-git-send-email-lipeng321@huawei.com>
From: Peng Li <lipeng321@huawei.com>
Date: Fri, 29 Jun 2018 19:23:00 +0800
> @@ -228,8 +228,7 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
> desc_to_use = &hw->cmq.csq.desc[hw->cmq.csq.next_to_use];
> *desc_to_use = desc[handle];
> (hw->cmq.csq.next_to_use)++;
> - if (hw->cmq.csq.next_to_use == hw->cmq.csq.desc_num)
> - hw->cmq.csq.next_to_use = 0;
> + hw->cmq.csq.next_to_use %= hw->cmq.csq.desc_num;
> handle++;
I would advise against this.
The "%" modulus operation takes many cpu cycles, and the current code
is thus much faster.
^ permalink raw reply
* Re: [net-next 1/1] tipc: Auto removal of peer down node instance
From: David Miller @ 2018-06-30 12:05 UTC (permalink / raw)
To: mohan.krishna.ghanta.krishnamurthy
Cc: tipc-discussion, jon.maloy, maloy, ying.xue, netdev
In-Reply-To: <1530271421-17726-1-git-send-email-mohan.krishna.ghanta.krishnamurthy@ericsson.com>
From: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com>
Date: Fri, 29 Jun 2018 13:23:41 +0200
> A peer node is considered down if there are no
> active links (or) lost contact to the node. In current implementation,
> a peer node instance is deleted either if
>
> a) TIPC module is removed (or)
> b) Application can use a netlink/iproute2 interface to delete a
> specific down node.
>
> Thus, a down node instance lives in the system forever, unless the
> application explicitly removes it.
>
> We fix this by deleting the nodes which are down for
> a specified amount of time (5 minutes).
> Existing node supervision timer is used to achieve this.
>
> Acked-by: Ying Xue <ying.xue@windriver.com>
> Acked-by: Jon Maloy <jon.maloy@ericsson.com>
> Signed-off-by: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com>
Applied.
^ permalink raw reply
* Re: [net-next 1/1] tipc: extend sock diag for group communication
From: David Miller @ 2018-06-30 12:06 UTC (permalink / raw)
To: mohan.krishna.ghanta.krishnamurthy
Cc: tipc-discussion, jon.maloy, maloy, ying.xue, netdev
In-Reply-To: <1530271578-17800-1-git-send-email-mohan.krishna.ghanta.krishnamurthy@ericsson.com>
From: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com>
Date: Fri, 29 Jun 2018 13:26:18 +0200
> This commit extends the existing TIPC socket diagnostics framework
> for information related to TIPC group communication.
>
> Acked-by: Ying Xue <ying.xue@windriver.com>
> Acked-by: Jon Maloy <jon.maloy@ericsson.com>
> Signed-off-by: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com>
Applied.
^ permalink raw reply
* Re: pull-request: mac80211-next 2018-06-29
From: David Miller @ 2018-06-30 12:17 UTC (permalink / raw)
To: johannes-cdvu00un1VgdHxzADdlk8Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20180629115906.2045-1-johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
From: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
Date: Fri, 29 Jun 2018 13:59:05 +0200
> Here's the next round of -next updates. This includes the promised
> HE stuff but it's not all that big in the end, most of it is just
> additions to the protocol header file :-)
:-)
> Please pull and let me know if there's any problem.
There was a small merge conflict in net/mac80211/scan.c, I arranged
it such that the kcalloc() conversion was preserved.
Please send me any necessary fixups if I didn't do it properly.
Thanks.
^ permalink raw reply
* Re: [PATCH 2/2] cdc_ncm: Admit multicast traffic
From: Bjørn Mork @ 2018-06-30 12:17 UTC (permalink / raw)
To: Miguel Rodríguez Pérez; +Cc: linux-usb, netdev
In-Reply-To: <ac0097e4-0c3a-1a06-12f4-8cb7fcf07eb1@det.uvigo.gal>
Miguel Rodríguez Pérez <miguel@det.uvigo.gal> writes:
> +static void cdc_ncm_update_filter(struct usbnet *dev)
> +{
> + struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
> + u8 iface_no = ctx->control->cur_altsetting->desc.bInterfaceNumber;
> + struct net_device *net = dev->net;
Why not change usbnet_cdc_update_filter to get the interface number from
dev->intf instead? Then you can export it and reuse it here instead of
creating a copy. And it will also work for any other usbnet minidriver.
I.e. change this:
static void usbnet_cdc_update_filter(struct usbnet *dev)
{
struct cdc_state *info = (void *) &dev->data;
struct usb_interface *intf = info->control;
into:
static void usbnet_cdc_update_filter(struct usbnet *dev)
{
struct usb_interface *intf = dev->intf;
or simply use dev->intf to deref directly into an interface number, like
you do in your version. The local 'intf' variable doesn't do much
good here.
> +
> + u16 cdc_filter = USB_CDC_PACKET_TYPE_DIRECTED
> + | USB_CDC_PACKET_TYPE_BROADCAST;
> +
> + /* filtering on the device is an optional feature and not worth
> + * the hassle so we just roughly care about snooping and if any
> + * multicast is requested, we take every multicast
> + */
> + if (net->flags & IFF_PROMISC)
> + cdc_filter |= USB_CDC_PACKET_TYPE_PROMISCUOUS;
> + if (!netdev_mc_empty(net) || (net->flags & IFF_ALLMULTI))
> + cdc_filter |= USB_CDC_PACKET_TYPE_ALL_MULTICAST;
> +
> + usbnet_write_cmd(dev,
This is a nice change. It should be probably done in
usbnet_cdc_update_filter in any case. Unless there is some reason it
doesn't alreay use usbnet_write_cmd?
> + USB_CDC_SET_ETHERNET_PACKET_FILTER,
> + USB_TYPE_CLASS | USB_DIR_OUT | USB_RECIP_INTERFACE,
> + cdc_filter,
> + iface_no,
> + NULL,
> + 0);
> +}
> +
> static const struct ethtool_ops cdc_ncm_ethtool_ops = {
> .get_link = usbnet_get_link,
> .nway_reset = usbnet_nway_reset,
> @@ -1652,6 +1679,7 @@ static const struct driver_info cdc_ncm_info = {
> .status = cdc_ncm_status,
> .rx_fixup = cdc_ncm_rx_fixup,
> .tx_fixup = cdc_ncm_tx_fixup,
> + .set_rx_mode = cdc_ncm_update_filter,
> };
>
> /* Same as cdc_ncm_info, but with FLAG_WWAN */
As the comment indicates: There are more 'struct driver_info' variants
here. Please add .set_rx_mode to all of them, unless you have a reason
not to?
Bjørn
^ permalink raw reply
* Re: [PATCH net-next v2 1/1] tc-testing: initial version of tunnel_key unit tests
From: David Miller @ 2018-06-30 12:17 UTC (permalink / raw)
To: kleib; +Cc: netdev, jhs, xiyou.wangcong, jiri, lucasb
In-Reply-To: <1530283651-1728-1-git-send-email-kleib@mojatatu.com>
From: Keara Leibovitz <kleib@mojatatu.com>
Date: Fri, 29 Jun 2018 10:47:31 -0400
> Create unittests for the tc tunnel_key action.
>
> v2:
> For the tests expecting failures, added non-zero exit codes in the
> teardowns. This prevents those tests from failing if the act_tunnel_key
> module is unloaded.
>
> Signed-off-by: Keara Leibovitz <kleib@mojatatu.com>
Applied.
^ permalink raw reply
* Re: [PATCH net v3] net: phy: DP83TC811: Fix disabling interrupts
From: David Miller @ 2018-06-30 12:18 UTC (permalink / raw)
To: dmurphy; +Cc: andrew, f.fainelli, netdev, linux-kernel
In-Reply-To: <20180629152831.23259-1-dmurphy@ti.com>
From: Dan Murphy <dmurphy@ti.com>
Date: Fri, 29 Jun 2018 10:28:31 -0500
> Fix a bug where INT_STAT1 was written twice and
> INT_STAT2 was ignored when disabling interrupts.
>
> Fixes: b753a9faaf9a ("net: phy: DP83TC811: Introduce support for the DP83TC811 phy")
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
Applied.
^ permalink raw reply
* Re: [PATCH net] sfc: correctly initialise filter rwsem for farch
From: David Miller @ 2018-06-30 12:18 UTC (permalink / raw)
To: bkenward; +Cc: netdev, linux-net-drivers
In-Reply-To: <59b166e9-ace0-1926-dc53-e9d8c91f5547@solarflare.com>
From: Bert Kenward <bkenward@solarflare.com>
Date: Fri, 29 Jun 2018 16:29:28 +0100
> Fixes: fc7a6c287ff3 ("sfc: use a semaphore to lock farch filters too")
> Suggested-by: Joseph Korty <joe.korty@concurrent-rt.com>
> Signed-off-by: Bert Kenward <bkenward@solarflare.com>
Applied and queued up for -stable.
^ permalink raw reply
* Re: [PATCH net] alx: take rtnl before calling __alx_open from resume
From: David Miller @ 2018-06-30 12:18 UTC (permalink / raw)
To: sd; +Cc: netdev, tobias.regnery
In-Reply-To: <39bd16f9cc1df96df0fcd49e65de4fefc8b0c067.1530285973.git.sd@queasysnail.net>
From: Sabrina Dubroca <sd@queasysnail.net>
Date: Fri, 29 Jun 2018 17:51:26 +0200
> The __alx_open function can be called from ndo_open, which is called
> under RTNL, or from alx_resume, which isn't. Since commit d768319cd427,
> we're calling the netif_set_real_num_{tx,rx}_queues functions, which
> need to be called under RTNL.
>
> This is similar to commit 0c2cc02e571a ("igb: Move the calls to set the
> Tx and Rx queues into igb_open").
>
> Fixes: d768319cd427 ("alx: enable multiple tx queues")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Applied and queued up for -stable.
^ permalink raw reply
* Re: [PATCH net 0/5] s390/qeth: fixes 2018-06-29
From: David Miller @ 2018-06-30 12:20 UTC (permalink / raw)
To: jwi; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, raspl, ubraun
In-Reply-To: <20180629174554.53718-1-jwi@linux.ibm.com>
From: Julian Wiedmann <jwi@linux.ibm.com>
Date: Fri, 29 Jun 2018 19:45:49 +0200
> please apply a few qeth fixes for -net and your 4.17 stable queue.
>
> Patches 1-3 fix several issues wrt to MAC address management that were
> introduced during the 4.17 cycle.
> Patch 4 tackles a long-standing issue with busy multi-connection workloads
> on devices in af_iucv mode.
> Patch 5 makes sure to re-enable all active HW offloads, after a card was
> previously set offline and thus lost its HW context.
Series applied and queued up for -stable.
^ permalink raw reply
* Re: [PATCH 0/2 ] cdc_ncm: Handle multicast Ethernet traffic
From: Bjørn Mork @ 2018-06-30 12:22 UTC (permalink / raw)
To: Miguel Rodríguez Pérez; +Cc: linux-usb, netdev
In-Reply-To: <69bbee1a-9a88-eabe-554f-fbc59e7fde79@det.uvigo.gal>
Miguel Rodríguez Pérez <miguel@det.uvigo.gal> writes:
> Sending again, as the previous try had the wrong subjects. Sorry about that.
No problem really, but please use version numbers so it's easy to see
which set is most current.
And you didn't address Olivers comment. Why not?
Bjørn
^ permalink raw reply
* Re: [PATCH] atm: zatm: Fix potential Spectre v1
From: David Miller @ 2018-06-30 12:25 UTC (permalink / raw)
To: gustavo; +Cc: 3chas3, linux-atm-general, netdev, linux-kernel
In-Reply-To: <20180629182807.GA26287@embeddedor.com>
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date: Fri, 29 Jun 2018 13:28:07 -0500
> pool can be indirectly controlled by user-space, hence leading to
> a potential exploitation of the Spectre variant 1 vulnerability.
>
> This issue was detected with the help of Smatch:
>
> drivers/atm/zatm.c:1491 zatm_ioctl() warn: potential spectre issue
> 'zatm_dev->pool_info' (local cap)
>
> Fix this by sanitizing pool before using it to index
> zatm_dev->pool_info
>
> Notice that given that speculation windows are large, the policy is
> to kill the speculation on the first load and not worry if it can be
> completed with a dependent load/store [1].
>
> [1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] strparser: Call skb_unclone conditionally
From: David Miller @ 2018-06-30 12:25 UTC (permalink / raw)
To: vakul.garg; +Cc: netdev, tom, borisp, ebiggers, davejwatson, doronrk
In-Reply-To: <20180629191555.19874-1-vakul.garg@nxp.com>
From: Vakul Garg <vakul.garg@nxp.com>
Date: Sat, 30 Jun 2018 00:45:55 +0530
> Calling skb_unclone() is expensive as it triggers a memcpy operation.
> Instead of calling skb_unclone() unconditionally, call it only when skb
> has a shared frag_list. This improves tls rx throughout significantly.
>
> Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
> Suggested-by: Boris Pismenny <borisp@mellanox.com>
Applied.
^ permalink raw reply
* Re: [Patch net] net: use dev_change_tx_queue_len() for SIOCSIFTXQLEN
From: David Miller @ 2018-06-30 12:27 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, edumazet
In-Reply-To: <20180629204248.28919-1-xiyou.wangcong@gmail.com>
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Fri, 29 Jun 2018 13:42:48 -0700
> As noticed by Eric, we need to switch to the helper
> dev_change_tx_queue_len() for SIOCSIFTXQLEN call path too,
> otheriwse still miss dev_qdisc_change_tx_queue_len().
>
> Fixes: 6a643ddb5624 ("net: introduce helper dev_change_tx_queue_len()")
> Reported-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net] hv_netvsc: split sub-channel setup into async and sync
From: David Miller @ 2018-06-30 12:29 UTC (permalink / raw)
To: haiyangz, haiyangz; +Cc: olaf, sthemmin, netdev, linux-kernel, devel, vkuznets
In-Reply-To: <20180629210716.6798-1-haiyangz@linuxonhyperv.com>
From: Haiyang Zhang <haiyangz@linuxonhyperv.com>
Date: Fri, 29 Jun 2018 14:07:16 -0700
> From: Stephen Hemminger <sthemmin@microsoft.com>
>
> When doing device hotplug the sub channel must be async to avoid
> deadlock issues because device is discovered in softirq context.
>
> When doing changes to MTU and number of channels, the setup
> must be synchronous to avoid races such as when MTU and device
> settings are done in a single ip command.
>
> Reported-by: Thomas Walker <Thomas.Walker@twosigma.com>
> Fixes: 8195b1396ec8 ("hv_netvsc: fix deadlock on hotplug")
> Fixes: 732e49850c5e ("netvsc: fix race on sub channel creation")
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Applied and queued up for -stable.
^ permalink raw reply
* Re: [PATCH net-next 0/9] nfp: flower updates and netconsole
From: David Miller @ 2018-06-30 12:32 UTC (permalink / raw)
To: jakub.kicinski; +Cc: oss-drivers, netdev
In-Reply-To: <20180630000442.27353-1-jakub.kicinski@netronome.com>
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Fri, 29 Jun 2018 17:04:33 -0700
> This set contains assorted updates to driver base and flower.
> First patch is a follow up to a fix to calculating counters which
> went into net. For ethtool counters we should also make sure
> they are visible even after ring reconfiguration. Next patch
> is a safety measure in case we are running on a machine with a
> broken BIOS we should fail the probe when risk of incorrect
> operation is too high. The next two patches add netpoll support
> and make use of napi_consume_skb(). Last we populate bus info
> on all representors.
>
> Pieter adds support for offload of the checksum action in flower.
>
> John follows up to another fix he's done in net, we set TTL
> values on tunnels to stack's default, now Johns does a full
> route lookup to get a more precise information, he populates
> ToS field as well. Last but not least he follows up on Jiri's
> request to enable LAG offload in case the team driver is used
> and then hash function is unknown.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH net-next 4/5] net/sched: flower: Dump the ethertype encapsulated in vlan
From: kbuild test robot @ 2018-06-30 12:54 UTC (permalink / raw)
To: Jianbo Liu
Cc: kbuild-all, netdev, davem, jiri, Jianbo Liu, Jamal Hadi Salim,
Cong Wang
In-Reply-To: <20180630095317.5691-5-jianbol@mellanox.com>
Hi Jianbo,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Jianbo-Liu/net-flow_dissector-Save-vlan-ethertype-from-headers/20180630-180158
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
net/sched/cls_flower.c:544:15: sparse: cast to restricted __be32
net/sched/cls_flower.c:544:15: sparse: cast to restricted __be32
net/sched/cls_flower.c:544:15: sparse: cast to restricted __be32
net/sched/cls_flower.c:544:15: sparse: cast to restricted __be32
net/sched/cls_flower.c:544:15: sparse: cast to restricted __be32
net/sched/cls_flower.c:544:15: sparse: cast to restricted __be32
net/sched/cls_flower.c:545:16: sparse: cast to restricted __be32
net/sched/cls_flower.c:545:16: sparse: cast to restricted __be32
net/sched/cls_flower.c:545:16: sparse: cast to restricted __be32
net/sched/cls_flower.c:545:16: sparse: cast to restricted __be32
net/sched/cls_flower.c:545:16: sparse: cast to restricted __be32
net/sched/cls_flower.c:545:16: sparse: cast to restricted __be32
include/linux/slab.h:631:13: sparse: undefined identifier '__builtin_mul_overflow'
include/linux/slab.h:631:13: sparse: not a function <noident>
>> net/sched/cls_flower.c:1317:70: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned short [unsigned] [usertype] value @@ got short [unsigned] [usertype] value @@
net/sched/cls_flower.c:1317:70: expected unsigned short [unsigned] [usertype] value
net/sched/cls_flower.c:1317:70: got restricted __be16 [usertype] n_proto
include/linux/slab.h:631:13: sparse: call with no type!
vim +1317 net/sched/cls_flower.c
1264
1265 static int fl_dump(struct net *net, struct tcf_proto *tp, void *fh,
1266 struct sk_buff *skb, struct tcmsg *t)
1267 {
1268 struct cls_fl_filter *f = fh;
1269 struct nlattr *nest;
1270 struct fl_flow_key *key, *mask;
1271
1272 if (!f)
1273 return skb->len;
1274
1275 t->tcm_handle = f->handle;
1276
1277 nest = nla_nest_start(skb, TCA_OPTIONS);
1278 if (!nest)
1279 goto nla_put_failure;
1280
1281 if (f->res.classid &&
1282 nla_put_u32(skb, TCA_FLOWER_CLASSID, f->res.classid))
1283 goto nla_put_failure;
1284
1285 key = &f->key;
1286 mask = &f->mask->key;
1287
1288 if (mask->indev_ifindex) {
1289 struct net_device *dev;
1290
1291 dev = __dev_get_by_index(net, key->indev_ifindex);
1292 if (dev && nla_put_string(skb, TCA_FLOWER_INDEV, dev->name))
1293 goto nla_put_failure;
1294 }
1295
1296 if (!tc_skip_hw(f->flags))
1297 fl_hw_update_stats(tp, f);
1298
1299 if (fl_dump_key_val(skb, key->eth.dst, TCA_FLOWER_KEY_ETH_DST,
1300 mask->eth.dst, TCA_FLOWER_KEY_ETH_DST_MASK,
1301 sizeof(key->eth.dst)) ||
1302 fl_dump_key_val(skb, key->eth.src, TCA_FLOWER_KEY_ETH_SRC,
1303 mask->eth.src, TCA_FLOWER_KEY_ETH_SRC_MASK,
1304 sizeof(key->eth.src)) ||
1305 fl_dump_key_val(skb, &key->basic.n_proto, TCA_FLOWER_KEY_ETH_TYPE,
1306 &mask->basic.n_proto, TCA_FLOWER_UNSPEC,
1307 sizeof(key->basic.n_proto)))
1308 goto nla_put_failure;
1309
1310 if (fl_dump_key_mpls(skb, &key->mpls, &mask->mpls))
1311 goto nla_put_failure;
1312
1313 if (fl_dump_key_vlan(skb, &key->vlan, &mask->vlan))
1314 goto nla_put_failure;
1315
1316 if (mask->vlan.vlan_tpid &&
> 1317 nla_put_u16(skb, TCA_FLOWER_KEY_VLAN_ETH_TYPE, key->basic.n_proto))
1318 goto nla_put_failure;
1319
1320 if ((key->basic.n_proto == htons(ETH_P_IP) ||
1321 key->basic.n_proto == htons(ETH_P_IPV6)) &&
1322 (fl_dump_key_val(skb, &key->basic.ip_proto, TCA_FLOWER_KEY_IP_PROTO,
1323 &mask->basic.ip_proto, TCA_FLOWER_UNSPEC,
1324 sizeof(key->basic.ip_proto)) ||
1325 fl_dump_key_ip(skb, &key->ip, &mask->ip)))
1326 goto nla_put_failure;
1327
1328 if (key->control.addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS &&
1329 (fl_dump_key_val(skb, &key->ipv4.src, TCA_FLOWER_KEY_IPV4_SRC,
1330 &mask->ipv4.src, TCA_FLOWER_KEY_IPV4_SRC_MASK,
1331 sizeof(key->ipv4.src)) ||
1332 fl_dump_key_val(skb, &key->ipv4.dst, TCA_FLOWER_KEY_IPV4_DST,
1333 &mask->ipv4.dst, TCA_FLOWER_KEY_IPV4_DST_MASK,
1334 sizeof(key->ipv4.dst))))
1335 goto nla_put_failure;
1336 else if (key->control.addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS &&
1337 (fl_dump_key_val(skb, &key->ipv6.src, TCA_FLOWER_KEY_IPV6_SRC,
1338 &mask->ipv6.src, TCA_FLOWER_KEY_IPV6_SRC_MASK,
1339 sizeof(key->ipv6.src)) ||
1340 fl_dump_key_val(skb, &key->ipv6.dst, TCA_FLOWER_KEY_IPV6_DST,
1341 &mask->ipv6.dst, TCA_FLOWER_KEY_IPV6_DST_MASK,
1342 sizeof(key->ipv6.dst))))
1343 goto nla_put_failure;
1344
1345 if (key->basic.ip_proto == IPPROTO_TCP &&
1346 (fl_dump_key_val(skb, &key->tp.src, TCA_FLOWER_KEY_TCP_SRC,
1347 &mask->tp.src, TCA_FLOWER_KEY_TCP_SRC_MASK,
1348 sizeof(key->tp.src)) ||
1349 fl_dump_key_val(skb, &key->tp.dst, TCA_FLOWER_KEY_TCP_DST,
1350 &mask->tp.dst, TCA_FLOWER_KEY_TCP_DST_MASK,
1351 sizeof(key->tp.dst)) ||
1352 fl_dump_key_val(skb, &key->tcp.flags, TCA_FLOWER_KEY_TCP_FLAGS,
1353 &mask->tcp.flags, TCA_FLOWER_KEY_TCP_FLAGS_MASK,
1354 sizeof(key->tcp.flags))))
1355 goto nla_put_failure;
1356 else if (key->basic.ip_proto == IPPROTO_UDP &&
1357 (fl_dump_key_val(skb, &key->tp.src, TCA_FLOWER_KEY_UDP_SRC,
1358 &mask->tp.src, TCA_FLOWER_KEY_UDP_SRC_MASK,
1359 sizeof(key->tp.src)) ||
1360 fl_dump_key_val(skb, &key->tp.dst, TCA_FLOWER_KEY_UDP_DST,
1361 &mask->tp.dst, TCA_FLOWER_KEY_UDP_DST_MASK,
1362 sizeof(key->tp.dst))))
1363 goto nla_put_failure;
1364 else if (key->basic.ip_proto == IPPROTO_SCTP &&
1365 (fl_dump_key_val(skb, &key->tp.src, TCA_FLOWER_KEY_SCTP_SRC,
1366 &mask->tp.src, TCA_FLOWER_KEY_SCTP_SRC_MASK,
1367 sizeof(key->tp.src)) ||
1368 fl_dump_key_val(skb, &key->tp.dst, TCA_FLOWER_KEY_SCTP_DST,
1369 &mask->tp.dst, TCA_FLOWER_KEY_SCTP_DST_MASK,
1370 sizeof(key->tp.dst))))
1371 goto nla_put_failure;
1372 else if (key->basic.n_proto == htons(ETH_P_IP) &&
1373 key->basic.ip_proto == IPPROTO_ICMP &&
1374 (fl_dump_key_val(skb, &key->icmp.type,
1375 TCA_FLOWER_KEY_ICMPV4_TYPE, &mask->icmp.type,
1376 TCA_FLOWER_KEY_ICMPV4_TYPE_MASK,
1377 sizeof(key->icmp.type)) ||
1378 fl_dump_key_val(skb, &key->icmp.code,
1379 TCA_FLOWER_KEY_ICMPV4_CODE, &mask->icmp.code,
1380 TCA_FLOWER_KEY_ICMPV4_CODE_MASK,
1381 sizeof(key->icmp.code))))
1382 goto nla_put_failure;
1383 else if (key->basic.n_proto == htons(ETH_P_IPV6) &&
1384 key->basic.ip_proto == IPPROTO_ICMPV6 &&
1385 (fl_dump_key_val(skb, &key->icmp.type,
1386 TCA_FLOWER_KEY_ICMPV6_TYPE, &mask->icmp.type,
1387 TCA_FLOWER_KEY_ICMPV6_TYPE_MASK,
1388 sizeof(key->icmp.type)) ||
1389 fl_dump_key_val(skb, &key->icmp.code,
1390 TCA_FLOWER_KEY_ICMPV6_CODE, &mask->icmp.code,
1391 TCA_FLOWER_KEY_ICMPV6_CODE_MASK,
1392 sizeof(key->icmp.code))))
1393 goto nla_put_failure;
1394 else if ((key->basic.n_proto == htons(ETH_P_ARP) ||
1395 key->basic.n_proto == htons(ETH_P_RARP)) &&
1396 (fl_dump_key_val(skb, &key->arp.sip,
1397 TCA_FLOWER_KEY_ARP_SIP, &mask->arp.sip,
1398 TCA_FLOWER_KEY_ARP_SIP_MASK,
1399 sizeof(key->arp.sip)) ||
1400 fl_dump_key_val(skb, &key->arp.tip,
1401 TCA_FLOWER_KEY_ARP_TIP, &mask->arp.tip,
1402 TCA_FLOWER_KEY_ARP_TIP_MASK,
1403 sizeof(key->arp.tip)) ||
1404 fl_dump_key_val(skb, &key->arp.op,
1405 TCA_FLOWER_KEY_ARP_OP, &mask->arp.op,
1406 TCA_FLOWER_KEY_ARP_OP_MASK,
1407 sizeof(key->arp.op)) ||
1408 fl_dump_key_val(skb, key->arp.sha, TCA_FLOWER_KEY_ARP_SHA,
1409 mask->arp.sha, TCA_FLOWER_KEY_ARP_SHA_MASK,
1410 sizeof(key->arp.sha)) ||
1411 fl_dump_key_val(skb, key->arp.tha, TCA_FLOWER_KEY_ARP_THA,
1412 mask->arp.tha, TCA_FLOWER_KEY_ARP_THA_MASK,
1413 sizeof(key->arp.tha))))
1414 goto nla_put_failure;
1415
1416 if (key->enc_control.addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS &&
1417 (fl_dump_key_val(skb, &key->enc_ipv4.src,
1418 TCA_FLOWER_KEY_ENC_IPV4_SRC, &mask->enc_ipv4.src,
1419 TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK,
1420 sizeof(key->enc_ipv4.src)) ||
1421 fl_dump_key_val(skb, &key->enc_ipv4.dst,
1422 TCA_FLOWER_KEY_ENC_IPV4_DST, &mask->enc_ipv4.dst,
1423 TCA_FLOWER_KEY_ENC_IPV4_DST_MASK,
1424 sizeof(key->enc_ipv4.dst))))
1425 goto nla_put_failure;
1426 else if (key->enc_control.addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS &&
1427 (fl_dump_key_val(skb, &key->enc_ipv6.src,
1428 TCA_FLOWER_KEY_ENC_IPV6_SRC, &mask->enc_ipv6.src,
1429 TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK,
1430 sizeof(key->enc_ipv6.src)) ||
1431 fl_dump_key_val(skb, &key->enc_ipv6.dst,
1432 TCA_FLOWER_KEY_ENC_IPV6_DST,
1433 &mask->enc_ipv6.dst,
1434 TCA_FLOWER_KEY_ENC_IPV6_DST_MASK,
1435 sizeof(key->enc_ipv6.dst))))
1436 goto nla_put_failure;
1437
1438 if (fl_dump_key_val(skb, &key->enc_key_id, TCA_FLOWER_KEY_ENC_KEY_ID,
1439 &mask->enc_key_id, TCA_FLOWER_UNSPEC,
1440 sizeof(key->enc_key_id)) ||
1441 fl_dump_key_val(skb, &key->enc_tp.src,
1442 TCA_FLOWER_KEY_ENC_UDP_SRC_PORT,
1443 &mask->enc_tp.src,
1444 TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK,
1445 sizeof(key->enc_tp.src)) ||
1446 fl_dump_key_val(skb, &key->enc_tp.dst,
1447 TCA_FLOWER_KEY_ENC_UDP_DST_PORT,
1448 &mask->enc_tp.dst,
1449 TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK,
1450 sizeof(key->enc_tp.dst)))
1451 goto nla_put_failure;
1452
1453 if (fl_dump_key_flags(skb, key->control.flags, mask->control.flags))
1454 goto nla_put_failure;
1455
1456 if (f->flags && nla_put_u32(skb, TCA_FLOWER_FLAGS, f->flags))
1457 goto nla_put_failure;
1458
1459 if (tcf_exts_dump(skb, &f->exts))
1460 goto nla_put_failure;
1461
1462 nla_nest_end(skb, nest);
1463
1464 if (tcf_exts_dump_stats(skb, &f->exts) < 0)
1465 goto nla_put_failure;
1466
1467 return skb->len;
1468
1469 nla_put_failure:
1470 nla_nest_cancel(skb, nest);
1471 return -1;
1472 }
1473
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply
* Re: [PATCH net-next 00/13] mlxsw: Add resource scale tests
From: David Miller @ 2018-06-30 13:06 UTC (permalink / raw)
To: petrm; +Cc: netdev, linux-kselftest, jiri, idosch, shuah
In-Reply-To: <cover.1530319109.git.petrm@mellanox.com>
From: Petr Machata <petrm@mellanox.com>
Date: Sat, 30 Jun 2018 02:44:23 +0200
> There are a number of tests that check features of the Linux networking
> stack. By running them on suitable interfaces, one can exercise the
> mlxsw offloading code. However none of these tests attempts to push
> mlxsw to the limits supported by the ASIC.
>
> As an additional wrinkle, the "limits supported by the ASIC" themselves
> may not be a set of fixed numbers, but rather depend on a profile that
> determines how the ASIC resources are allocated for different purposes.
>
> This patchset introduces several tests that verify capability of mlxsw
> to offload amounts of routes, flower rules, and mirroring sessions that
> match predicted ASIC capacity, at different configuration profiles.
> Additionally they verify that amounts exceeding the predicted capacity
> can *not* be offloaded.
...
Good stuff, series applied, thanks!
^ permalink raw reply
* Re: [PATCH net] net: fib_rules: bring back rule_exists to match rule during add
From: David Miller @ 2018-06-30 13:11 UTC (permalink / raw)
To: roopa; +Cc: netdev, dsa
In-Reply-To: <1530307935-6652-1-git-send-email-roopa@cumulusnetworks.com>
From: Roopa Prabhu <roopa@cumulusnetworks.com>
Date: Fri, 29 Jun 2018 14:32:15 -0700
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> After commit f9d4b0c1e969 ("fib_rules: move common handling of newrule
> delrule msgs into fib_nl2rule"), rule_exists got replaced by rule_find
> for existing rule lookup in both the add and del paths. While this
> is good for the delete path, it solves a few problems but opens up
> a few invalid key matches in the add path.
>
> $ip -4 rule add table main tos 10 fwmark 1
> $ip -4 rule add table main tos 10
> RTNETLINK answers: File exists
>
> The problem here is rule_find does not check if the key masks in
> the new and old rule are the same and hence ends up matching a more
> secific rule. Rule key masks cannot be easily compared today without
> an elaborate if-else block. Its best to introduce key masks for easier
> and accurate rule comparison in the future. Until then, due to fear of
> regressions this patch re-introduces older loose rule_exists during add.
> Also fixes both rule_exists and rule_find to cover missing attributes.
>
> Fixes: f9d4b0c1e969 ("fib_rules: move common handling of newrule delrule msgs into fib_nl2rule")
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Applied, thanks for resolving all of these issues.
^ permalink raw reply
* [bpf PATCH v5 0/4] BPF fixes for sockhash
From: John Fastabend @ 2018-06-30 13:17 UTC (permalink / raw)
To: ast, daniel, kafai; +Cc: netdev
This addresses two syzbot issues that lead to identifying (by Eric and
Wei) a class of bugs where we don't correctly check for IPv4/v6
sockets and their associated state. The second issue was a locking
omission in sockhash.
The first patch addresses IPv6 socks and fixing an error where
sockhash would overwrite the prot pointer with IPv4 prot. To fix
this build similar solution to TLS ULP. Although we continue to
allow socks in all states not just ESTABLISH in this patch set
because as Martin points out there should be no issue with this
on the sockmap ULP because we don't use the ctx in this code. Once
multiple ULPs coexist we may need to revisit this. However we
can do this in *next trees.
The other issue syzbot found that the tcp_close() handler missed
locking the hash bucket lock which could result in corrupting the
sockhash bucket list if delete and close ran at the same time.
And also the smap_list_remove() routine was not working correctly
at all. This was not caught in my testing because in general my
tests (to date at least lets add some more robust selftest in
bpf-next) do things in the "expected" order, create map, add socks,
delete socks, then tear down maps. The tests we have that do the
ops out of this order where only working on single maps not multi-
maps so we never saw the issue. Thanks syzbot. The fix is to
restructure the tcp_close() lock handling. And fix the obvious
bug in smap_list_remove().
Finally, during review I noticed the release handler was omitted
from the upstream code (patch 4) due to an incorrect merge conflict
fix when I ported the code to latest bpf-next before submitting.
This would leave references to the map around if the user never
closes the map.
v3: rework patches, dropping ESTABLISH check and adding rcu
annotation along with the smap_list_remove fix
v4: missed one more case where maps was being accessed without
the sk_callback_lock, spoted by Martin as well.
v5: changed to use a specific lock for maps and reduced callback
lock so that it is only used to gaurd sk callbacks. I think
this makes the logic a bit cleaner and avoids confusion
ovoer what each lock is doing.
Also big thanks to Martin for thorough review he caught at least
one case where I missed a rcu_call().
---
John Fastabend (4):
bpf: sockmap, fix crash when ipv6 sock is added
bpf: sockmap, fix smap_list_map_remove when psock is in many maps
bpf: sockhash fix omitted bucket lock in sock_close
bpf: sockhash, add release routine
kernel/bpf/sockmap.c | 236 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 166 insertions(+), 70 deletions(-)
^ permalink raw reply
* [bpf PATCH v5 1/4] bpf: sockmap, fix crash when ipv6 sock is added
From: John Fastabend @ 2018-06-30 13:17 UTC (permalink / raw)
To: ast, daniel, kafai; +Cc: netdev
In-Reply-To: <20180630131506.17344.7833.stgit@john-Precision-Tower-5810>
This fixes a crash where we assign tcp_prot to IPv6 sockets instead
of tcpv6_prot.
Previously we overwrote the sk->prot field with tcp_prot even in the
AF_INET6 case. This patch ensures the correct tcp_prot and tcpv6_prot
are used.
Tested with 'netserver -6' and 'netperf -H [IPv6]' as well as
'netperf -H [IPv4]'. The ESTABLISHED check resolves the previously
crashing case here.
Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Reported-by: syzbot+5c063698bdbfac19f363@syzkaller.appspotmail.com
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Wei Wang <weiwan@google.com>
---
kernel/bpf/sockmap.c | 58 +++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 48 insertions(+), 10 deletions(-)
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c
index 52a91d8..d7fd17a 100644
--- a/kernel/bpf/sockmap.c
+++ b/kernel/bpf/sockmap.c
@@ -140,6 +140,7 @@ static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
static int bpf_tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size);
static int bpf_tcp_sendpage(struct sock *sk, struct page *page,
int offset, size_t size, int flags);
+static void bpf_tcp_close(struct sock *sk, long timeout);
static inline struct smap_psock *smap_psock_sk(const struct sock *sk)
{
@@ -161,7 +162,42 @@ static bool bpf_tcp_stream_read(const struct sock *sk)
return !empty;
}
-static struct proto tcp_bpf_proto;
+enum {
+ SOCKMAP_IPV4,
+ SOCKMAP_IPV6,
+ SOCKMAP_NUM_PROTS,
+};
+
+enum {
+ SOCKMAP_BASE,
+ SOCKMAP_TX,
+ SOCKMAP_NUM_CONFIGS,
+};
+
+static struct proto *saved_tcpv6_prot __read_mostly;
+static DEFINE_SPINLOCK(tcpv6_prot_lock);
+static struct proto bpf_tcp_prots[SOCKMAP_NUM_PROTS][SOCKMAP_NUM_CONFIGS];
+static void build_protos(struct proto prot[SOCKMAP_NUM_CONFIGS],
+ struct proto *base)
+{
+ prot[SOCKMAP_BASE] = *base;
+ prot[SOCKMAP_BASE].close = bpf_tcp_close;
+ prot[SOCKMAP_BASE].recvmsg = bpf_tcp_recvmsg;
+ prot[SOCKMAP_BASE].stream_memory_read = bpf_tcp_stream_read;
+
+ prot[SOCKMAP_TX] = prot[SOCKMAP_BASE];
+ prot[SOCKMAP_TX].sendmsg = bpf_tcp_sendmsg;
+ prot[SOCKMAP_TX].sendpage = bpf_tcp_sendpage;
+}
+
+static void update_sk_prot(struct sock *sk, struct smap_psock *psock)
+{
+ int family = sk->sk_family == AF_INET6 ? SOCKMAP_IPV6 : SOCKMAP_IPV4;
+ int conf = psock->bpf_tx_msg ? SOCKMAP_TX : SOCKMAP_BASE;
+
+ sk->sk_prot = &bpf_tcp_prots[family][conf];
+}
+
static int bpf_tcp_init(struct sock *sk)
{
struct smap_psock *psock;
@@ -181,14 +217,17 @@ static int bpf_tcp_init(struct sock *sk)
psock->save_close = sk->sk_prot->close;
psock->sk_proto = sk->sk_prot;
- if (psock->bpf_tx_msg) {
- tcp_bpf_proto.sendmsg = bpf_tcp_sendmsg;
- tcp_bpf_proto.sendpage = bpf_tcp_sendpage;
- tcp_bpf_proto.recvmsg = bpf_tcp_recvmsg;
- tcp_bpf_proto.stream_memory_read = bpf_tcp_stream_read;
+ /* Build IPv6 sockmap whenever the address of tcpv6_prot changes */
+ if (sk->sk_family == AF_INET6 &&
+ unlikely(sk->sk_prot != smp_load_acquire(&saved_tcpv6_prot))) {
+ spin_lock_bh(&tcpv6_prot_lock);
+ if (likely(sk->sk_prot != saved_tcpv6_prot)) {
+ build_protos(bpf_tcp_prots[SOCKMAP_IPV6], sk->sk_prot);
+ smp_store_release(&saved_tcpv6_prot, sk->sk_prot);
+ }
+ spin_unlock_bh(&tcpv6_prot_lock);
}
-
- sk->sk_prot = &tcp_bpf_proto;
+ update_sk_prot(sk, psock);
rcu_read_unlock();
return 0;
}
@@ -1111,8 +1150,7 @@ static void bpf_tcp_msg_add(struct smap_psock *psock,
static int bpf_tcp_ulp_register(void)
{
- tcp_bpf_proto = tcp_prot;
- tcp_bpf_proto.close = bpf_tcp_close;
+ build_protos(bpf_tcp_prots[SOCKMAP_IPV4], &tcp_prot);
/* Once BPF TX ULP is registered it is never unregistered. It
* will be in the ULP list for the lifetime of the system. Doing
* duplicate registers is not a problem.
^ permalink raw reply related
* [bpf PATCH v5 2/4] bpf: sockmap, fix smap_list_map_remove when psock is in many maps
From: John Fastabend @ 2018-06-30 13:17 UTC (permalink / raw)
To: ast, daniel, kafai; +Cc: netdev
In-Reply-To: <20180630131506.17344.7833.stgit@john-Precision-Tower-5810>
If a hashmap is free'd with open socks it removes the reference to
the hash entry from the psock. If that is the last reference to the
psock then it will also be free'd by the reference counting logic.
However the current logic that removes the hash reference from the
list of references is broken. In smap_list_remove() we first check
if the sockmap entry matches and then check if the hashmap entry
matches. But, the sockmap entry sill always match because its NULL in
this case which causes the first entry to be removed from the list.
If this is always the "right" entry (because the user adds/removes
entries in order) then everything is OK but otherwise a subsequent
bpf_tcp_close() may reference a free'd object.
To fix this create two list handlers one for sockmap and one for
sockhash.
Reported-by: syzbot+0ce137753c78f7b6acc1@syzkaller.appspotmail.com
Fixes: 81110384441a ("bpf: sockmap, add hash map support")
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
kernel/bpf/sockmap.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c
index d7fd17a..5adff4b 100644
--- a/kernel/bpf/sockmap.c
+++ b/kernel/bpf/sockmap.c
@@ -1602,17 +1602,27 @@ static struct bpf_map *sock_map_alloc(union bpf_attr *attr)
return ERR_PTR(err);
}
-static void smap_list_remove(struct smap_psock *psock,
- struct sock **entry,
- struct htab_elem *hash_link)
+static void smap_list_map_remove(struct smap_psock *psock,
+ struct sock **entry)
{
struct smap_psock_map_entry *e, *tmp;
list_for_each_entry_safe(e, tmp, &psock->maps, list) {
- if (e->entry == entry || e->hash_link == hash_link) {
+ if (e->entry == entry)
+ list_del(&e->list);
+ }
+}
+
+static void smap_list_hash_remove(struct smap_psock *psock,
+ struct htab_elem *hash_link)
+{
+ struct smap_psock_map_entry *e, *tmp;
+
+ list_for_each_entry_safe(e, tmp, &psock->maps, list) {
+ struct htab_elem *c = e->hash_link;
+
+ if (c == hash_link)
list_del(&e->list);
- break;
- }
}
}
@@ -1647,7 +1657,7 @@ static void sock_map_free(struct bpf_map *map)
* to be null and queued for garbage collection.
*/
if (likely(psock)) {
- smap_list_remove(psock, &stab->sock_map[i], NULL);
+ smap_list_map_remove(psock, &stab->sock_map[i]);
smap_release_sock(psock, sock);
}
write_unlock_bh(&sock->sk_callback_lock);
@@ -1706,7 +1716,7 @@ static int sock_map_delete_elem(struct bpf_map *map, void *key)
if (psock->bpf_parse)
smap_stop_sock(psock, sock);
- smap_list_remove(psock, &stab->sock_map[k], NULL);
+ smap_list_map_remove(psock, &stab->sock_map[k]);
smap_release_sock(psock, sock);
out:
write_unlock_bh(&sock->sk_callback_lock);
@@ -1908,7 +1918,7 @@ static int sock_map_ctx_update_elem(struct bpf_sock_ops_kern *skops,
struct smap_psock *opsock = smap_psock_sk(osock);
write_lock_bh(&osock->sk_callback_lock);
- smap_list_remove(opsock, &stab->sock_map[i], NULL);
+ smap_list_map_remove(opsock, &stab->sock_map[i]);
smap_release_sock(opsock, osock);
write_unlock_bh(&osock->sk_callback_lock);
}
@@ -2124,7 +2134,7 @@ static void sock_hash_free(struct bpf_map *map)
* (psock) to be null and queued for garbage collection.
*/
if (likely(psock)) {
- smap_list_remove(psock, NULL, l);
+ smap_list_hash_remove(psock, l);
smap_release_sock(psock, sock);
}
write_unlock_bh(&sock->sk_callback_lock);
@@ -2304,7 +2314,7 @@ static int sock_hash_ctx_update_elem(struct bpf_sock_ops_kern *skops,
psock = smap_psock_sk(l_old->sk);
hlist_del_rcu(&l_old->hash_node);
- smap_list_remove(psock, NULL, l_old);
+ smap_list_hash_remove(psock, l_old);
smap_release_sock(psock, l_old->sk);
free_htab_elem(htab, l_old);
}
@@ -2372,7 +2382,7 @@ static int sock_hash_delete_elem(struct bpf_map *map, void *key)
* to be null and queued for garbage collection.
*/
if (likely(psock)) {
- smap_list_remove(psock, NULL, l);
+ smap_list_hash_remove(psock, l);
smap_release_sock(psock, sock);
}
write_unlock_bh(&sock->sk_callback_lock);
^ permalink raw reply related
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