* Re: [PATCH] net: ethernet: mediatek: Fix overlapping capability bits.
From: Willem de Bruijn @ 2019-06-29 19:33 UTC (permalink / raw)
To: René van Dorst
Cc: sean.wang, f.fainelli, linux, David Miller, matthias.bgg, andrew,
vivien.didelot, frank-w, Network Development, linux-mediatek,
linux-mips
In-Reply-To: <20190629122419.19026-1-opensource@vdorst.com>
On Sat, Jun 29, 2019 at 8:24 AM René van Dorst <opensource@vdorst.com> wrote:
>
> Both MTK_TRGMII_MT7621_CLK and MTK_PATH_BIT are defined as bit 10.
>
> This causes issues on non-MT7621 devices which has the
> MTK_PATH_BIT(MTK_ETH_PATH_GMAC1_RGMII) capability set.
> The wrong TRGMII setup code is executed.
>
> Moving the MTK_PATH_BIT to bit 11 fixes the issue.
>
> Fixes: 8efaa653a8a5 ("net: ethernet: mediatek: Add MT7621 TRGMII mode
> support")
> Signed-off-by: René van Dorst <opensource@vdorst.com>
This targets net? Please mark networking patches [PATCH net] or [PATCH
net-next].
> ---
> drivers/net/ethernet/mediatek/mtk_eth_soc.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
> index 876ce6798709..2cb8a915731c 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
> @@ -626,7 +626,7 @@ enum mtk_eth_path {
> #define MTK_TRGMII_MT7621_CLK BIT(10)
>
> /* Supported path present on SoCs */
> -#define MTK_PATH_BIT(x) BIT((x) + 10)
>
> +#define MTK_PATH_BIT(x) BIT((x) + 11)
>
To avoid this happening again, perhaps make the reserved range more explicit?
For instance
#define MTK_FIXED_BIT_LAST 10
#define MTK_TRGMII_MT7621_CLK BIT(MTK_FIXED_BIT_LAST)
#define MTK_PATH_BIT_FIRST (MTK_FIXED_BIT_LAST + 1)
#define MTK_PATH_BIT_LAST (MTK_FIXED_BIT_LAST + 7)
#define MTK_MUX_BIT_FIRST (MTK_PATH_BIT_LAST + 1)
Though I imagine there are cleaner approaches. Perhaps define all
fields as enum instead of just mtk_eth_mux and mtk_eth_path. Then
there can be no accidental collision.
^ permalink raw reply
* Re: [PATCH net-next] r8169: remove not needed call to dma_sync_single_for_device
From: David Miller @ 2019-06-29 19:30 UTC (permalink / raw)
To: hkallweit1; +Cc: nic_swsd, netdev
In-Reply-To: <8377f1a6-787a-7eea-17be-0d70cb9911d3@gmail.com>
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Thu, 27 Jun 2019 23:19:09 +0200
> DMA_API_HOWTO.txt includes an example explaining when
> dma_sync_single_for_device() is not needed, and that example matches
> our use case. The buffer isn't changed by the CPU and direction is
> DMA_FROM_DEVICE, so we can remove the call to
> dma_sync_single_for_device().
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] r8169: consider that 32 Bit DMA is the default
From: David Miller @ 2019-06-29 19:30 UTC (permalink / raw)
To: hkallweit1; +Cc: nic_swsd, netdev
In-Reply-To: <eabad258-68de-49b9-91d7-7c853ea4f150@gmail.com>
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Thu, 27 Jun 2019 23:12:39 +0200
> Documentation/DMA-API-HOWTO.txt states:
> By default, the kernel assumes that your device can address 32-bits of
> DMA addressing. For a 64-bit capable device, this needs to be increased,
> and for a device with limitations, it needs to be decreased.
>
> Therefore we don't need the 32 Bit DMA fallback configuration and can
> remove it.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] r8169: improve handling VLAN tag
From: David Miller @ 2019-06-29 19:29 UTC (permalink / raw)
To: hkallweit1; +Cc: nic_swsd, netdev
In-Reply-To: <29fd564b-3279-a36d-a082-1c650168567e@gmail.com>
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Thu, 27 Jun 2019 23:06:33 +0200
> The VLAN tag is stored in the descriptor in network byte order.
> Using swab16 works on little endian host systems only. Better play safe
> and use ntohs or htons respectively.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCHv2 next 3/3] blackhole_dev: add a selftest
From: David Miller @ 2019-06-29 19:28 UTC (permalink / raw)
To: maheshb; +Cc: netdev, edumazet, michael.chan, dja, mahesh
In-Reply-To: <20190627194309.94291-1-maheshb@google.com>
From: Mahesh Bandewar <maheshb@google.com>
Date: Thu, 27 Jun 2019 12:43:09 -0700
> +config TEST_BLACKHOLE_DEV
> + tristate "Test BPF filter functionality"
I think the tristate string needs to be changed :-)
^ permalink raw reply
* Re: [PATCH v2] net: dsa: mv88e6xxx: wait after reset deactivation
From: David Miller @ 2019-06-29 19:21 UTC (permalink / raw)
To: baruch; +Cc: andrew, vivien.didelot, netdev
In-Reply-To: <2e272a4e588ae44137864237d0cd73e2208f2c60.1561659459.git.baruch@tkos.co.il>
From: Baruch Siach <baruch@tkos.co.il>
Date: Thu, 27 Jun 2019 21:17:39 +0300
> Add a 1ms delay after reset deactivation. Otherwise the chip returns
> bogus ID value. This is observed with 88E6390 (Peridot) chip.
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> v2: Address Andrew Lunn's comments:
> Use usleep_range.
> Delay only when reset line is valid.
Applied and queuedu up for -stable, thanks.
^ permalink raw reply
* Re: [PATCH V4] bnx2x: Prevent ptp_task to be rescheduled indefinitely
From: David Miller @ 2019-06-29 19:20 UTC (permalink / raw)
To: gpiccoli; +Cc: GR-everest-linux-l2, netdev, skalluru, aelior, jay.vosburgh
In-Reply-To: <20190627163133.5990-1-gpiccoli@canonical.com>
From: "Guilherme G. Piccoli" <gpiccoli@canonical.com>
Date: Thu, 27 Jun 2019 13:31:33 -0300
> Currently bnx2x ptp worker tries to read a register with timestamp
> information in case of TX packet timestamping and in case it fails,
> the routine reschedules itself indefinitely. This was reported as a
> kworker always at 100% of CPU usage, which was narrowed down to be
> bnx2x ptp_task.
>
> By following the ioctl handler, we could narrow down the problem to
> an NTP tool (chrony) requesting HW timestamping from bnx2x NIC with
> RX filter zeroed; this isn't reproducible for example with ptp4l
> (from linuxptp) since this tool requests a supported RX filter.
> It seems NIC FW timestamp mechanism cannot work well with
> RX_FILTER_NONE - driver's PTP filter init routine skips a register
> write to the adapter if there's not a supported filter request.
>
> This patch addresses the problem of bnx2x ptp thread's everlasting
> reschedule by retrying the register read 10 times; between the read
> attempts the thread sleeps for an increasing amount of time starting
> in 1ms to give FW some time to perform the timestamping. If it still
> fails after all retries, we bail out in order to prevent an unbound
> resource consumption from bnx2x.
>
> The patch also adds an ethtool statistic for accounting the skipped
> TX timestamp packets and it reduces the priority of timestamping
> error messages to prevent log flooding. The code was tested using
> both linuxptp and chrony.
>
> Reported-and-tested-by: Przemyslaw Hausman <przemyslaw.hausman@canonical.com>
> Suggested-by: Sudarsana Reddy Kalluru <skalluru@marvell.com>
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
Applied and queued up for -stable.
^ permalink raw reply
* Re: [PATCH net] selftests: rtnetlink: skip ipsec offload tests if netdevsim isn't present
From: David Miller @ 2019-06-29 19:19 UTC (permalink / raw)
To: fw; +Cc: netdev
In-Reply-To: <20190627151242.5150-1-fw@strlen.de>
From: Florian Westphal <fw@strlen.de>
Date: Thu, 27 Jun 2019 17:12:42 +0200
> running the script on systems without netdevsim now prints:
>
> SKIP: ipsec_offload can't load netdevsim
>
> instead of error message & failed status.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> Feel free to apply to -next, its not a bug fix per se.
Applied to net-next, thank you.
^ permalink raw reply
* [Patch net] xfrm: remove a duplicated assignment
From: Cong Wang @ 2019-06-29 19:17 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang, Florian Westphal, Steffen Klassert
Fixes: 30846090a746 ("xfrm: policy: add sequence count to sync with hash resize")
Cc: Florian Westphal <fw@strlen.de>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/xfrm/xfrm_policy.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b1694d5d15d3..3235562f6588 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -582,9 +582,6 @@ static void xfrm_bydst_resize(struct net *net, int dir)
spin_lock_bh(&net->xfrm.xfrm_policy_lock);
write_seqcount_begin(&xfrm_policy_hash_generation);
- odst = rcu_dereference_protected(net->xfrm.policy_bydst[dir].table,
- lockdep_is_held(&net->xfrm.xfrm_policy_lock));
-
odst = rcu_dereference_protected(net->xfrm.policy_bydst[dir].table,
lockdep_is_held(&net->xfrm.xfrm_policy_lock));
--
2.21.0
^ permalink raw reply related
* Re: [PATCH v2 net-next 14/19] ionic: Add Tx and Rx handling
From: Jakub Kicinski @ 2019-06-29 18:57 UTC (permalink / raw)
To: Shannon Nelson; +Cc: netdev
In-Reply-To: <20190628213934.8810-15-snelson@pensando.io>
On Fri, 28 Jun 2019 14:39:29 -0700, Shannon Nelson wrote:
> +static int ionic_tx(struct queue *q, struct sk_buff *skb)
> +{
> + struct tx_stats *stats = q_to_tx_stats(q);
> + int err;
> +
> + if (skb->ip_summed == CHECKSUM_PARTIAL)
> + err = ionic_tx_calc_csum(q, skb);
> + else
> + err = ionic_tx_calc_no_csum(q, skb);
> + if (err)
> + return err;
> +
> + err = ionic_tx_skb_frags(q, skb);
> + if (err)
> + return err;
> +
> + skb_tx_timestamp(skb);
> + stats->pkts++;
> + stats->bytes += skb->len;
Presumably this is 64bit so you should use
u64_stats_update_begin()
u64_stats_update_end()
around it (and all other stats).
> +
> + ionic_txq_post(q, !netdev_xmit_more(), ionic_tx_clean, skb);
> +
> + return 0;
> +}
> +
> +static int ionic_tx_descs_needed(struct queue *q, struct sk_buff *skb)
> +{
> + struct tx_stats *stats = q_to_tx_stats(q);
> + int err;
> +
> + /* If TSO, need roundup(skb->len/mss) descs */
> + if (skb_is_gso(skb))
> + return (skb->len / skb_shinfo(skb)->gso_size) + 1;
> +
> + /* If non-TSO, just need 1 desc and nr_frags sg elems */
> + if (skb_shinfo(skb)->nr_frags <= IONIC_TX_MAX_SG_ELEMS)
> + return 1;
> +
> + /* Too many frags, so linearize */
> + err = skb_linearize(skb);
> + if (err)
> + return err;
> +
> + stats->linearize++;
> +
> + /* Need 1 desc and zero sg elems */
> + return 1;
> +}
> +
> +netdev_tx_t ionic_start_xmit(struct sk_buff *skb, struct net_device *netdev)
> +{
> + u16 queue_index = skb_get_queue_mapping(skb);
> + struct lif *lif = netdev_priv(netdev);
> + struct queue *q;
> + int ndescs;
> + int err;
> +
> + if (unlikely(!test_bit(LIF_UP, lif->state))) {
> + dev_kfree_skb(skb);
> + return NETDEV_TX_OK;
> + }
> +
> + if (likely(lif_to_txqcq(lif, queue_index)))
> + q = lif_to_txq(lif, queue_index);
> + else
> + q = lif_to_txq(lif, 0);
> +
> + ndescs = ionic_tx_descs_needed(q, skb);
> + if (ndescs < 0)
> + goto err_out_drop;
> +
> + if (!ionic_q_has_space(q, ndescs)) {
> + netif_stop_subqueue(netdev, queue_index);
> + q->stop++;
> +
> + /* Might race with ionic_tx_clean, check again */
> + smp_rmb();
> + if (ionic_q_has_space(q, ndescs)) {
> + netif_wake_subqueue(netdev, queue_index);
> + q->wake++;
> + } else {
> + return NETDEV_TX_BUSY;
This should never really happen..
> + }
> + }
> +
> + if (skb_is_gso(skb))
> + err = ionic_tx_tso(q, skb);
> + else
> + err = ionic_tx(q, skb);
> +
> + if (err)
> + goto err_out_drop;
.. at this point if you can't guarantee fitting biggest possible frame
in, you have to stop the ring.
> + return NETDEV_TX_OK;
> +
> +err_out_drop:
> + q->drop++;
> + dev_kfree_skb(skb);
> + return NETDEV_TX_OK;
> +}
^ permalink raw reply
* Re: [PATCH v2 net-next 16/19] ionic: Add driver stats
From: Jakub Kicinski @ 2019-06-29 18:53 UTC (permalink / raw)
To: Shannon Nelson; +Cc: netdev
In-Reply-To: <20190628213934.8810-17-snelson@pensando.io>
On Fri, 28 Jun 2019 14:39:31 -0700, Shannon Nelson wrote:
> Add in the detailed statistics for ethtool -S that the driver
> keeps as it processes packets. Display of the additional
> debug statistics can be enabled through the ethtool priv-flags
> feature.
>
> Signed-off-by: Shannon Nelson <snelson@pensando.io>
> diff --git a/drivers/net/ethernet/pensando/ionic/Makefile b/drivers/net/ethernet/pensando/ionic/Makefile
> index 0e2dc53f08d4..4f3cfbf36c23 100644
> --- a/drivers/net/ethernet/pensando/ionic/Makefile
> +++ b/drivers/net/ethernet/pensando/ionic/Makefile
> @@ -4,4 +4,5 @@
> obj-$(CONFIG_IONIC) := ionic.o
>
> ionic-y := ionic_main.o ionic_bus_pci.o ionic_dev.o ionic_ethtool.o \
> - ionic_lif.o ionic_rx_filter.o ionic_txrx.o ionic_debugfs.o
> + ionic_lif.o ionic_rx_filter.o ionic_txrx.o ionic_debugfs.o \
> + ionic_stats.o
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> index 2bbe5819387b..518e79c90fca 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> @@ -8,6 +8,84 @@
> #include "ionic_bus.h"
> #include "ionic_lif.h"
> #include "ionic_ethtool.h"
> +#include "ionic_stats.h"
> +
> +static const char ionic_priv_flags_strings[][ETH_GSTRING_LEN] = {
> +#define PRIV_F_SW_DBG_STATS BIT(0)
> + "sw-dbg-stats",
> +};
> +#define PRIV_FLAGS_COUNT ARRAY_SIZE(ionic_priv_flags_strings)
> +
> +static void ionic_get_stats_strings(struct lif *lif, u8 *buf)
> +{
> + u32 i;
> +
> + for (i = 0; i < ionic_num_stats_grps; i++)
> + ionic_stats_groups[i].get_strings(lif, &buf);
> +}
> +
> +static void ionic_get_stats(struct net_device *netdev,
> + struct ethtool_stats *stats, u64 *buf)
> +{
> + struct lif *lif;
> + u32 i;
> +
> + lif = netdev_priv(netdev);
> +
> + memset(buf, 0, stats->n_stats * sizeof(*buf));
> + for (i = 0; i < ionic_num_stats_grps; i++)
> + ionic_stats_groups[i].get_values(lif, &buf);
> +}
> +
> +static int ionic_get_stats_count(struct lif *lif)
> +{
> + int i, num_stats = 0;
> +
> + for (i = 0; i < ionic_num_stats_grps; i++)
> + num_stats += ionic_stats_groups[i].get_count(lif);
> +
> + return num_stats;
> +}
> +
> +static int ionic_get_sset_count(struct net_device *netdev, int sset)
> +{
> + struct lif *lif = netdev_priv(netdev);
> + int count = 0;
> +
> + switch (sset) {
> + case ETH_SS_STATS:
> + count = ionic_get_stats_count(lif);
> + break;
> + case ETH_SS_TEST:
> + break;
> + case ETH_SS_PRIV_FLAGS:
> + count = PRIV_FLAGS_COUNT;
> + break;
> + default:
> + return -EOPNOTSUPP;
> + }
> + return count;
> +}
> +
> +static void ionic_get_strings(struct net_device *netdev,
> + u32 sset, u8 *buf)
> +{
> + struct lif *lif = netdev_priv(netdev);
> +
> + switch (sset) {
> + case ETH_SS_STATS:
> + ionic_get_stats_strings(lif, buf);
> + break;
> + case ETH_SS_PRIV_FLAGS:
> + memcpy(buf, ionic_priv_flags_strings,
> + PRIV_FLAGS_COUNT * ETH_GSTRING_LEN);
> + break;
> + case ETH_SS_TEST:
> + // IONIC_TODO
> + default:
> + netdev_err(netdev, "Invalid sset %d\n", sset);
Not really an error, as long as sset_count() returns a 0 nothing will
happen. Also you can drop the SS_TEST if you don't report it.
> + }
> +}
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_stats.h b/drivers/net/ethernet/pensando/ionic/ionic_stats.h
> new file mode 100644
> index 000000000000..b5487e7fd4fb
> --- /dev/null
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_stats.h
> @@ -0,0 +1,53 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
> +
> +#ifndef _IONIC_STATS_H_
> +#define _IONIC_STATS_H_
> +
> +#define IONIC_STAT_TO_OFFSET(type, stat_name) (offsetof(type, stat_name))
> +
> +#define IONIC_STAT_DESC(type, stat_name) { \
> + .name = #stat_name, \
> + .offset = IONIC_STAT_TO_OFFSET(type, stat_name) \
> +}
> +
> +#define IONIC_LIF_STAT_DESC(stat_name) \
> + IONIC_STAT_DESC(struct lif_sw_stats, stat_name)
> +
> +#define IONIC_TX_STAT_DESC(stat_name) \
> + IONIC_STAT_DESC(struct tx_stats, stat_name)
> +
> +#define IONIC_RX_STAT_DESC(stat_name) \
> + IONIC_STAT_DESC(struct rx_stats, stat_name)
> +
> +#define IONIC_TX_Q_STAT_DESC(stat_name) \
> + IONIC_STAT_DESC(struct queue, stat_name)
> +
> +#define IONIC_CQ_STAT_DESC(stat_name) \
> + IONIC_STAT_DESC(struct cq, stat_name)
> +
> +#define IONIC_INTR_STAT_DESC(stat_name) \
> + IONIC_STAT_DESC(struct intr, stat_name)
> +
> +#define IONIC_NAPI_STAT_DESC(stat_name) \
> + IONIC_STAT_DESC(struct napi_stats, stat_name)
> +
> +/* Interface structure for a particalar stats group */
> +struct ionic_stats_group_intf {
> + void (*get_strings)(struct lif *lif, u8 **buf);
> + void (*get_values)(struct lif *lif, u64 **buf);
> + u64 (*get_count)(struct lif *lif);
> +};
> +
> +extern const struct ionic_stats_group_intf ionic_stats_groups[];
> +extern const int ionic_num_stats_grps;
> +
> +#define IONIC_READ_STAT64(base_ptr, desc_ptr) \
> + (*((u64 *)(((u8 *)(base_ptr)) + (desc_ptr)->offset)))
> +
> +struct ionic_stat_desc {
> + char name[ETH_GSTRING_LEN];
> + u64 offset;
> +};
> +
> +#endif // _IONIC_STATS_H_
Perhaps worth grepping the driver for C++ style comments?
^ permalink raw reply
* Re: [PATCH v2 net-next 17/19] ionic: Add RSS support
From: Jakub Kicinski @ 2019-06-29 18:48 UTC (permalink / raw)
To: Shannon Nelson; +Cc: netdev
In-Reply-To: <20190628213934.8810-18-snelson@pensando.io>
On Fri, 28 Jun 2019 14:39:32 -0700, Shannon Nelson wrote:
> @@ -1260,10 +1266,24 @@ static struct lif *ionic_lif_alloc(struct ionic *ionic, unsigned int index)
> if (err)
> goto err_out_free_lif_info;
>
> + /* allocate rss indirection table */
> + tbl_sz = le16_to_cpu(lif->ionic->ident.lif.eth.rss_ind_tbl_sz);
> + lif->rss_ind_tbl_sz = sizeof(*lif->rss_ind_tbl) * tbl_sz;
> + lif->rss_ind_tbl = dma_alloc_coherent(dev, lif->rss_ind_tbl_sz,
> + &lif->rss_ind_tbl_pa,
> + GFP_KERNEL);
> +
> + if (!lif->rss_ind_tbl) {
> + dev_err(dev, "Failed to allocate rss indirection table, aborting\n");
> + goto err_out_free_qcqs;
> + }
> +
> list_add_tail(&lif->list, &ionic->lifs);
>
> return lif;
>
> +err_out_free_qcqs:
> + ionic_qcqs_free(lif);
> err_out_free_lif_info:
> dma_free_coherent(dev, lif->info_sz, lif->info, lif->info_pa);
> lif->info = NULL;
> @@ -1302,6 +1322,14 @@ static void ionic_lif_free(struct lif *lif)
> {
> struct device *dev = lif->ionic->dev;
>
> + /* free rss indirection table */
> + if (lif->rss_ind_tbl) {
> + dma_free_coherent(dev, lif->rss_ind_tbl_sz, lif->rss_ind_tbl,
> + lif->rss_ind_tbl_pa);
dma_free_coherent() should be able to deal with NULLs just fine.
Besides you fail hard if the allocation failed, no?
> + lif->rss_ind_tbl = NULL;
> + lif->rss_ind_tbl_pa = 0;
> + }
^ permalink raw reply
* Re: [PATCH v2 net-next 04/19] ionic: Add basic lif support
From: Jakub Kicinski @ 2019-06-29 18:45 UTC (permalink / raw)
To: Shannon Nelson; +Cc: netdev
In-Reply-To: <20190628213934.8810-5-snelson@pensando.io>
On Fri, 28 Jun 2019 14:39:19 -0700, Shannon Nelson wrote:
> @@ -64,4 +66,49 @@ int ionic_debugfs_add_ident(struct ionic *ionic)
> ionic, &identity_fops) ? 0 : -ENOTSUPP;
> }
>
> +int ionic_debugfs_add_sizes(struct ionic *ionic)
> +{
> + debugfs_create_u32("nlifs", 0400, ionic->dentry,
> + (u32 *)&ionic->ident.dev.nlifs);
> + debugfs_create_u32("nintrs", 0400, ionic->dentry, &ionic->nintrs);
> +
> + debugfs_create_u32("ntxqs_per_lif", 0400, ionic->dentry,
> + (u32 *)&ionic->ident.lif.eth.config.queue_count[IONIC_QTYPE_TXQ]);
> + debugfs_create_u32("nrxqs_per_lif", 0400, ionic->dentry,
> + (u32 *)&ionic->ident.lif.eth.config.queue_count[IONIC_QTYPE_RXQ]);
Are these __le32s? Does the driver build cleanly with W=1 C=1?
> + return 0;
> +}
^ permalink raw reply
* Re: [PATCH net-next v3 0/4] Add gve driver
From: Jakub Kicinski @ 2019-06-29 18:28 UTC (permalink / raw)
To: Catherine Sullivan; +Cc: netdev
In-Reply-To: <20190628230733.54169-1-csully@google.com>
On Fri, 28 Jun 2019 16:07:29 -0700, Catherine Sullivan wrote:
> This patch series adds the gve driver which will support the
> Compute Engine Virtual NIC that will be available in the future.
Looks like buildbot also found a bunch of bad endian casts.
Please make sure the driver builds with no warnings with W=1 C=1.
^ permalink raw reply
* Re: [PATCH v3 bpf-next 4/4] tools/bpftool: switch map event_pipe to libbpf's perf_buffer
From: Jakub Kicinski @ 2019-06-29 18:24 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: andrii.nakryiko, ast, daniel, bpf, netdev, kernel-team,
songliubraving
In-Reply-To: <20190629055309.1594755-5-andriin@fb.com>
On Fri, 28 Jun 2019 22:53:09 -0700, Andrii Nakryiko wrote:
> map_info_len = sizeof(map_info);
> map_fd = map_parse_fd_and_info(&argc, &argv, &map_info, &map_info_len);
> - if (map_fd < 0)
> + if (map_fd < 0) {
> + p_err("failed to get map info");
Can't do, map_parse_fd_and_info() prints an error already, we can't
have multiple errors in JSON.
> return -1;
> + }
>
> if (map_info.type != BPF_MAP_TYPE_PERF_EVENT_ARRAY) {
> p_err("map is not a perf event array");
> @@ -205,7 +157,7 @@ int do_event_pipe(int argc, char **argv)
> char *endptr;
>
> NEXT_ARG();
> - cpu = strtoul(*argv, &endptr, 0);
> + ctx.cpu = strtoul(*argv, &endptr, 0);
> if (*endptr) {
> p_err("can't parse %s as CPU ID", **argv);
> goto err_close_map;
> @@ -216,7 +168,7 @@ int do_event_pipe(int argc, char **argv)
> char *endptr;
>
> NEXT_ARG();
> - index = strtoul(*argv, &endptr, 0);
> + ctx.idx = strtoul(*argv, &endptr, 0);
> if (*endptr) {
> p_err("can't parse %s as index", **argv);
> goto err_close_map;
> @@ -228,45 +180,32 @@ int do_event_pipe(int argc, char **argv)
> goto err_close_map;
> }
>
> - do_all = false;
> + ctx.all_cpus = false;
> }
>
> - if (!do_all) {
> - if (index == -1 || cpu == -1) {
> + if (!ctx.all_cpus) {
> + if (ctx.idx == -1 || ctx.cpu == -1) {
> p_err("cpu and index must be specified together");
> goto err_close_map;
Now that you look at err looks like we're missing an err = -1 assignment
here? but...
> }
> -
> - nfds = 1;
> } else {
> - nfds = min(get_possible_cpus(), map_info.max_entries);
> - cpu = 0;
> - index = 0;
> + ctx.cpu = 0;
> + ctx.idx = 0;
> }
>
> - rings = calloc(nfds, sizeof(rings[0]));
> - if (!rings)
> + opts.attr = &perf_attr;
> + opts.event_cb = print_bpf_output;
> + opts.ctx = &ctx;
> + opts.cpu_cnt = ctx.all_cpus ? 0 : 1;
> + opts.cpus = &ctx.cpu;
> + opts.map_keys = &ctx.idx;
> +
> + pb = perf_buffer__new_raw(map_fd, MMAP_PAGE_CNT, &opts);
> + err = libbpf_get_error(pb);
> + if (err) {
> + p_err("failed to create perf buffer: %s (%d)",
> + strerror(err), err);
> goto err_close_map;
> -
> - pfds = calloc(nfds, sizeof(pfds[0]));
> - if (!pfds)
> - goto err_free_rings;
> -
> - for (i = 0; i < nfds; i++) {
> - rings[i].cpu = cpu + i;
> - rings[i].key = index + i;
> -
> - rings[i].fd = bpf_perf_event_open(map_fd, rings[i].key,
> - rings[i].cpu);
> - if (rings[i].fd < 0)
> - goto err_close_fds_prev;
> -
> - rings[i].mem = perf_event_mmap(rings[i].fd);
> - if (!rings[i].mem)
> - goto err_close_fds_current;
> -
> - pfds[i].fd = rings[i].fd;
> - pfds[i].events = POLLIN;
> }
>
> signal(SIGINT, int_exit);
> @@ -277,35 +216,25 @@ int do_event_pipe(int argc, char **argv)
> jsonw_start_array(json_wtr);
>
> while (!stop) {
> - poll(pfds, nfds, 200);
> - for (i = 0; i < nfds; i++)
> - perf_event_read(&rings[i], &tmp_buf, &tmp_buf_sz);
> + err = perf_buffer__poll(pb, 200);
> + if (err < 0 && err != -EINTR) {
> + p_err("perf buffer polling failed: %s (%d)",
> + strerror(err), err);
> + goto err_close_pb;
> + }
> }
> - free(tmp_buf);
>
> if (json_output)
> jsonw_end_array(json_wtr);
>
> - for (i = 0; i < nfds; i++) {
> - perf_event_unmap(rings[i].mem);
> - close(rings[i].fd);
> - }
> - free(pfds);
> - free(rings);
> + perf_buffer__free(pb);
> close(map_fd);
>
> return 0;
>
> -err_close_fds_prev:
> - while (i--) {
> - perf_event_unmap(rings[i].mem);
> -err_close_fds_current:
> - close(rings[i].fd);
> - }
> - free(pfds);
> -err_free_rings:
> - free(rings);
> +err_close_pb:
> + perf_buffer__free(pb);
> err_close_map:
> close(map_fd);
> - return -1;
> + return err ? -1 : 0;
... how can we return 0 on the error path? 😕
> }
^ permalink raw reply
* Re: [PATCH] ipv4: Fix off-by-one in route dump counter without netlink strict checking
From: Stefano Brivio @ 2019-06-29 18:21 UTC (permalink / raw)
To: David Miller; +Cc: David Ahern, netdev
In-Reply-To: <74faa085e6af026f8b9f0d3cce8a94147781f257.1561830851.git.sbrivio@redhat.com>
On Sat, 29 Jun 2019 19:55:08 +0200
Stefano Brivio <sbrivio@redhat.com> wrote:
> Always increment the per-node counter by one if we previously dumped
> a regular route, so that it matches the current skip counter.
>
> Fixes: ee28906fd7a1 ("ipv4: Dump route exceptions if requested")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Sorry David, this was meant for net-next.
--
Stefano
^ permalink raw reply
* Re: [PATCH net] igmp: fix memory leak in igmpv3_del_delrec()
From: David Miller @ 2019-06-29 18:17 UTC (permalink / raw)
To: edumazet; +Cc: netdev, eric.dumazet, liuhangbin, syzbot+6ca1abd0db68b5173a4f
In-Reply-To: <20190627082701.226711-1-edumazet@google.com>
From: Eric Dumazet <edumazet@google.com>
Date: Thu, 27 Jun 2019 01:27:01 -0700
> im->tomb and/or im->sources might not be NULL, but we
> currently overwrite their values blindly.
>
> Using swap() will make sure the following call to kfree_pmc(pmc)
> will properly free the psf structures.
>
> Tested with the C repro provided by syzbot, which basically does :
>
> socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
> setsockopt(3, SOL_IP, IP_ADD_MEMBERSHIP, "\340\0\0\2\177\0\0\1\0\0\0\0", 12) = 0
> ioctl(3, SIOCSIFFLAGS, {ifr_name="lo", ifr_flags=0}) = 0
> setsockopt(3, SOL_IP, IP_MSFILTER, "\340\0\0\2\177\0\0\1\1\0\0\0\1\0\0\0\377\377\377\377", 20) = 0
> ioctl(3, SIOCSIFFLAGS, {ifr_name="lo", ifr_flags=IFF_UP}) = 0
> exit_group(0) = ?
>
> BUG: memory leak
> unreferenced object 0xffff88811450f140 (size 64):
...
> Fixes: 24803f38a5c0 ("igmp: do not remove igmp souce list info when set link down")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Hangbin Liu <liuhangbin@gmail.com>
> Reported-by: syzbot+6ca1abd0db68b5173a4f@syzkaller.appspotmail.com
Applied and queued up for -stable, thanks.
^ permalink raw reply
* Re: [PATCH net-next v3 0/4] em_ipt: add support for addrtype
From: David Miller @ 2019-06-29 18:15 UTC (permalink / raw)
To: nikolay; +Cc: netdev, roopa, pablo, xiyou.wangcong, jiri, jhs, eyal.birger
In-Reply-To: <20190627081047.24537-1-nikolay@cumulusnetworks.com>
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date: Thu, 27 Jun 2019 11:10:43 +0300
> We would like to be able to use the addrtype from tc for ACL rules and
> em_ipt seems the best place to add support for the already existing xt
> match. The biggest issue is that addrtype revision 1 (with ipv6 support)
> is NFPROTO_UNSPEC and currently em_ipt can't differentiate between v4/v6
> if such xt match is used because it passes the match's family instead of
> the packet one. The first 3 patches make em_ipt match only on IP
> traffic (currently both policy and addrtype recognize such traffic
> only) and make it pass the actual packet's protocol instead of the xt
> match family when it's unspecified. They also add support for NFPROTO_UNSPEC
> xt matches. The last patch allows to add addrtype rules via em_ipt.
> We need to keep the user-specified nfproto for dumping in order to be
> compatible with libxtables, we cannot dump NFPROTO_UNSPEC as the nfproto
> or we'll get an error from libxtables, thus the nfproto is limited to
> ipv4/ipv6 in patch 03 and is recorded.
>
> v3: don't use the user nfproto for matching, only for dumping, more
> information is available in the commit message in patch 03
> v2: change patch 02 to set the nfproto only when unspecified and drop
> patch 04 from v1 (Eyal Birger)
Series applied, thanks Nikolay.
^ permalink raw reply
* Re: [PATCH 0/2] Sub ns increment fixes in Macb PTP
From: David Miller @ 2019-06-29 18:09 UTC (permalink / raw)
To: harini.katakam
Cc: nicolas.ferre, richardcochran, claudiu.beznea, rafalo,
andrei.pistirica, netdev, linux-kernel, michal.simek,
harinikatakamlinux
In-Reply-To: <1561616460-32439-1-git-send-email-harini.katakam@xilinx.com>
From: Harini Katakam <harini.katakam@xilinx.com>
Date: Thu, 27 Jun 2019 11:50:58 +0530
> The subns increment register fields are not captured correctly in the
> driver. Fix the same and also increase the subns incr resolution.
>
> Sub ns resolution was increased to 24 bits in r1p06f2 version. To my
> knowledge, this PTP driver, with its current BD time stamp
> implementation, is only useful to that version or above. So, I have
> increased the resolution unconditionally. Please let me know if there
> is any IP versions incompatible with this - there is no register to
> obtain this information from.
>
> Changes from RFC:
> None
Series applied, thanks.
^ permalink raw reply
* Re: [Linux-kernel-mentees][PATCH v2] packet: Fix undefined behavior in bit shift
From: David Miller @ 2019-06-29 18:06 UTC (permalink / raw)
To: c0d1n61at3; +Cc: skhan, linux-kernel-mentees, netdev, linux-kernel
In-Reply-To: <20190627032532.18374-2-c0d1n61at3@gmail.com>
From: Jiunn Chang <c0d1n61at3@gmail.com>
Date: Wed, 26 Jun 2019 22:25:30 -0500
> Shifting signed 32-bit value by 31 bits is undefined. Changing most
> significant bit to unsigned.
>
> Changes included in v2:
> - use subsystem specific subject lines
> - CC required mailing lists
>
> Signed-off-by: Jiunn Chang <c0d1n61at3@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH bpf] selftests: bpf: fix inlines in test_lwt_seg6local
From: Song Liu @ 2019-06-29 18:04 UTC (permalink / raw)
To: Jiri Benc
Cc: Networking, bpf, Alexei Starovoitov, Daniel Borkmann,
Mathieu Xhonneux
In-Reply-To: <CAPhsuW4ncpfNCvbYHF36pb6ZEBJMX-iJP5sD0x3PbmAds+WGOQ@mail.gmail.com>
On Sat, Jun 29, 2019 at 11:04 AM Song Liu <liu.song.a23@gmail.com> wrote:
>
> On Sat, Jun 29, 2019 at 7:43 AM Jiri Benc <jbenc@redhat.com> wrote:
> >
> > 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>
>
> Maybe use "__always_inline" as most other tests do?
I meant "static __always_inline".
Song
^ permalink raw reply
* Re: [PATCH bpf] selftests: bpf: fix inlines in test_lwt_seg6local
From: Song Liu @ 2019-06-29 18:04 UTC (permalink / raw)
To: Jiri Benc
Cc: Networking, bpf, Alexei Starovoitov, Daniel Borkmann,
Mathieu Xhonneux
In-Reply-To: <4fdda0547f90e96bd2ef5d5533ee286b02dd4ce2.1561819374.git.jbenc@redhat.com>
On Sat, Jun 29, 2019 at 7:43 AM Jiri Benc <jbenc@redhat.com> wrote:
>
> 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>
Maybe use "__always_inline" as most other tests do?
Thanks,
Song
^ permalink raw reply
* Re: [PATCH net v2] net: make skb_dst_force return true when dst is refcounted
From: David Miller @ 2019-06-29 18:02 UTC (permalink / raw)
To: fw; +Cc: netdev, eric.dumazet, netfilter-devel
In-Reply-To: <20190626184045.2922-1-fw@strlen.de>
From: Florian Westphal <fw@strlen.de>
Date: Wed, 26 Jun 2019 20:40:45 +0200
> netfilter did not expect that skb_dst_force() can cause skb to lose its
> dst entry.
>
> I got a bug report with a skb->dst NULL dereference in netfilter
> output path. The backtrace contains nf_reinject(), so the dst might have
> been cleared when skb got queued to userspace.
>
> Other users were fixed via
> if (skb_dst(skb)) {
> skb_dst_force(skb);
> if (!skb_dst(skb))
> goto handle_err;
> }
>
> But I think its preferable to make the 'dst might be cleared' part
> of the function explicit.
>
> In netfilter case, skb with a null dst is expected when queueing in
> prerouting hook, so drop skb for the other hooks.
>
> v2:
> v1 of this patch returned true in case skb had no dst entry.
> Eric said:
> Say if we have two skb_dst_force() calls for some reason
> on the same skb, only the first one will return false.
>
> This now returns false even when skb had no dst, as per Erics
> suggestion, so callers might need to check skb_dst() first before
> skb_dst_force().
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
...
> Alternatively this could be routed via netfilter tree, let me
> know your preference.
Applied and I'll queue this up for -stable, thanks Florian.
^ permalink raw reply
* [PATCH] ipv4: Fix off-by-one in route dump counter without netlink strict checking
From: Stefano Brivio @ 2019-06-29 17:55 UTC (permalink / raw)
To: David Miller; +Cc: David Ahern, netdev
In commit ee28906fd7a1 ("ipv4: Dump route exceptions if requested") I
added a counter of per-node dumped routes (including actual routes and
exceptions), analogous to the existing counter for dumped nodes. Dumping
exceptions means we need to also keep track of how many routes are dumped
for each node: this would be just one route per node, without exceptions.
When netlink strict checking is not enabled, we dump both routes and
exceptions at the same time: the RTM_F_CLONED flag is not used as a
filter. In this case, the per-node counter 'i_fa' is incremented by one
to track the single dumped route, then also incremented by one for each
exception dumped, and then stored as netlink callback argument as skip
counter, 's_fa', to be used when a partial dump operation restarts.
The per-node counter needs to be increased by one also when we skip a
route (exception) due to a previous non-zero skip counter, because it
needs to match the existing skip counter, if we are dumping both routes
and exceptions. I missed this, and only incremented the counter, for
regular routes, if the previous skip counter was zero. This means that,
in case of a mixed dump, partial dump operations after the first one
will start with a mismatching skip counter value, one less than expected.
This means in turn that the first exception for a given node is skipped
every time a partial dump operation restarts, if netlink strict checking
is not enabled (iproute < 5.0).
It turns out I didn't repeat the test in its final version, commit
de755a85130e ("selftests: pmtu: Introduce list_flush_ipv4_exception test
case"), which also counts the number of route exceptions returned, with
iproute2 versions < 5.0 -- I was instead using the equivalent of the IPv6
test as it was before commit b964641e9925 ("selftests: pmtu: Make
list_flush_ipv6_exception test more demanding").
Always increment the per-node counter by one if we previously dumped
a regular route, so that it matches the current skip counter.
Fixes: ee28906fd7a1 ("ipv4: Dump route exceptions if requested")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
net/ipv4/fib_trie.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 4400f5051977..2b2b3d291ab0 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2126,14 +2126,20 @@ static int fn_trie_dump_leaf(struct key_vector *l, struct fib_table *tb,
goto next;
}
- if (filter->dump_routes && !s_fa) {
- err = fib_dump_info(skb, NETLINK_CB(cb->skb).portid,
- cb->nlh->nlmsg_seq, RTM_NEWROUTE,
- tb->tb_id, fa->fa_type,
- xkey, KEYLENGTH - fa->fa_slen,
- fa->fa_tos, fi, flags);
- if (err < 0)
- goto stop;
+ if (filter->dump_routes) {
+ if (!s_fa) {
+ err = fib_dump_info(skb,
+ NETLINK_CB(cb->skb).portid,
+ cb->nlh->nlmsg_seq,
+ RTM_NEWROUTE,
+ tb->tb_id, fa->fa_type,
+ xkey,
+ KEYLENGTH - fa->fa_slen,
+ fa->fa_tos, fi, flags);
+ if (err < 0)
+ goto stop;
+ }
+
i_fa++;
}
--
2.20.1
^ permalink raw reply related
* 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
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