Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH v3 net-next 00/15] ioc3-eth improvements
From: David Miller @ 2019-08-30 20:55 UTC (permalink / raw)
  To: tbogendoerfer; +Cc: ralf, paul.burton, jhogan, linux-mips, linux-kernel, netdev
In-Reply-To: <20190830092539.24550-1-tbogendoerfer@suse.de>

From: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Date: Fri, 30 Aug 2019 11:25:23 +0200

> In my patch series for splitting out the serial code from ioc3-eth
> by using a MFD device there was one big patch for ioc3-eth.c,
> which wasn't really usefull for reviews. This series contains the
> ioc3-eth changes splitted in smaller steps and few more cleanups.
> Only the conversion to MFD will be done later in a different series.
> 
> Changes in v3:
> - no need to check skb == NULL before passing it to dev_kfree_skb_any
> - free memory allocated with get_page(s) with free_page(s)
> - allocate rx ring with just GFP_KERNEL
> - add required alignment for rings in comments
> 
> Changes in v2:
> - use net_err_ratelimited for printing various ioc3 errors
> - added missing clearing of rx buf valid flags into ioc3_alloc_rings
> - use __func__ for printing out of memory messages

Series applied, thanks.

I might be nice to use get_order() instead of hardcoding the page size
when "2" is passed into the page alloc/free calls.  Just FYI...

^ permalink raw reply

* [PATCH v2 net-next] net/ncsi: add response handlers for PLDM over NC-SI
From: Ben Wei @ 2019-08-30 20:50 UTC (permalink / raw)
  To: David Miller, sam@mendozajonas.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org
  Cc: Ben Wei

This patch adds handlers for PLDM over NC-SI command response.

This enables NC-SI driver recognizes the packet type so the responses
don't get dropped as unknown packet type.

PLDM over NC-SI are not handled in kernel driver for now, but can be
passed back to user space via Netlink for further handling.

Signed-off-by: Ben Wei <benwei@fb.com>
---
Changes in v2 
  - fix function definition spacing

 net/ncsi/ncsi-pkt.h |  5 +++++
 net/ncsi/ncsi-rsp.c | 11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/net/ncsi/ncsi-pkt.h b/net/ncsi/ncsi-pkt.h
index a8e9def593f2..80938b338fee 100644
--- a/net/ncsi/ncsi-pkt.h
+++ b/net/ncsi/ncsi-pkt.h
@@ -387,6 +387,9 @@ struct ncsi_aen_hncdsc_pkt {
 #define NCSI_PKT_CMD_OEM	0x50 /* OEM                              */
 #define NCSI_PKT_CMD_PLDM	0x51 /* PLDM request over NCSI over RBT  */
 #define NCSI_PKT_CMD_GPUUID	0x52 /* Get package UUID                 */
+#define NCSI_PKT_CMD_QPNPR	0x56 /* Query Pending NC PLDM request */
+#define NCSI_PKT_CMD_SNPR	0x57 /* Send NC PLDM Reply  */
+
 
 /* NCSI packet responses */
 #define NCSI_PKT_RSP_CIS	(NCSI_PKT_CMD_CIS    + 0x80)
@@ -419,6 +422,8 @@ struct ncsi_aen_hncdsc_pkt {
 #define NCSI_PKT_RSP_OEM	(NCSI_PKT_CMD_OEM    + 0x80)
 #define NCSI_PKT_RSP_PLDM	(NCSI_PKT_CMD_PLDM   + 0x80)
 #define NCSI_PKT_RSP_GPUUID	(NCSI_PKT_CMD_GPUUID + 0x80)
+#define NCSI_PKT_RSP_QPNPR	(NCSI_PKT_CMD_QPNPR   + 0x80)
+#define NCSI_PKT_RSP_SNPR	(NCSI_PKT_CMD_SNPR   + 0x80)
 
 /* NCSI response code/reason */
 #define NCSI_PKT_RSP_C_COMPLETED	0x0000 /* Command Completed        */
diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c
index 5254004f2b42..524974af0db6 100644
--- a/net/ncsi/ncsi-rsp.c
+++ b/net/ncsi/ncsi-rsp.c
@@ -1035,6 +1035,11 @@ static int ncsi_rsp_handler_gpuuid(struct ncsi_request *nr)
 	return 0;
 }
 
+static int ncsi_rsp_handler_pldm(struct ncsi_request *nr)
+{
+	return 0;
+}
+
 static int ncsi_rsp_handler_netlink(struct ncsi_request *nr)
 {
 	struct ncsi_dev_priv *ndp = nr->ndp;
@@ -1088,8 +1093,10 @@ static struct ncsi_rsp_handler {
 	{ NCSI_PKT_RSP_GNPTS,  48, ncsi_rsp_handler_gnpts   },
 	{ NCSI_PKT_RSP_GPS,     8, ncsi_rsp_handler_gps     },
 	{ NCSI_PKT_RSP_OEM,    -1, ncsi_rsp_handler_oem     },
-	{ NCSI_PKT_RSP_PLDM,    0, NULL                     },
-	{ NCSI_PKT_RSP_GPUUID, 20, ncsi_rsp_handler_gpuuid  }
+	{ NCSI_PKT_RSP_PLDM,   -1, ncsi_rsp_handler_pldm    },
+	{ NCSI_PKT_RSP_GPUUID, 20, ncsi_rsp_handler_gpuuid  },
+	{ NCSI_PKT_RSP_QPNPR,  -1, ncsi_rsp_handler_pldm    },
+	{ NCSI_PKT_RSP_SNPR,   -1, ncsi_rsp_handler_pldm    }
 };
 
 int ncsi_rcv_rsp(struct sk_buff *skb, struct net_device *dev,
-- 
2.17.1


^ permalink raw reply related

* Re: [v2] net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate
From: David Miller @ 2019-08-30 20:33 UTC (permalink / raw)
  To: zdai; +Cc: xiyou.wangcong, jhs, jiri, netdev, linux-kernel, zdai
In-Reply-To: <1567195432.20025.18.camel@oc5348122405>

From: "David Z. Dai" <zdai@linux.vnet.ibm.com>
Date: Fri, 30 Aug 2019 15:03:52 -0500

> I have the impression that last parameter num value should be larger
> than the attribute num value in 2nd parameter (TC_POLICE_RATE64 in this
> case).

The argument in question is explicitly the "padding" value.

Please explain in detail where you got the impression that the
argument has to be larger?

^ permalink raw reply

* Re: Is bug 200755 in anyone's queue??
From: Willem de Bruijn @ 2019-08-30 20:30 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Steve Zabele, Network Development, shum, vladimir116, saifi.khan,
	Daniel Borkmann, on2k16nm, Stephen Hemminger
In-Reply-To: <8f4bda24-5bd4-3f12-4c98-5e1097dde84a@gmail.com>

On Fri, Aug 30, 2019 at 4:54 AM Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
>
> On 8/29/19 9:26 PM, Willem de Bruijn wrote:
>
> > SO_REUSEPORT was not intended to be used in this way. Opening
> > multiple connected sockets with the same local port.
> >
> > But since the interface allowed connect after joining a group, and
> > that is being used, I guess that point is moot. Still, I'm a bit
> > surprised that it ever worked as described.
> >
> > Also note that the default distribution algorithm is not round robin
> > assignment, but hash based. So multiple consecutive datagrams arriving
> > at the same socket is not unexpected.
> >
> > I suspect that this quick hack might "work". It seemed to on the
> > supplied .c file:
> >
> >                   score = compute_score(sk, net, saddr, sport,
> >                                         daddr, hnum, dif, sdif);
> >                   if (score > badness) {
> >   -                       if (sk->sk_reuseport) {
> >   +                       if (sk->sk_reuseport && !sk->sk_state !=
> > TCP_ESTABLISHED) {

This won't work for a mix of connected and connectionless sockets, of
course (even ignoring the typo), as it only skips reuseport on the
connected sockets.

> >
> > But a more robust approach, that also works on existing kernels, is to
> > swap the default distribution algorithm with a custom BPF based one (
> > SO_ATTACH_REUSEPORT_EBPF).
> >
>
> Yes, I suspect that reuseport could still be used by to load-balance incoming packets
> targetting the same 4-tuple.
>
> So all sockets would have the same score, and we would select the first socket in
> the list (if not applying reuseport hashing)

Can you elaborate a bit?

One option I see is to record in struct sock_reuseport if any port in
the group is connected and, if so, don't return immediately on the
first reuseport_select_sock hit, but continue the search for a higher
scoring connected socket.

Or do return immediately, but do this refined search in
reuseport_select_sock itself, as it has a reference to all sockets in the
group in sock_reuseport->socks[]. Instead of the straightforward hash.

Steve, Re: your point on a scalable QUIC server. That is an
interesting case certainly. Opening a connected socket per flow adds
both memory and port table pressure. I once looked into an SO_TXONLY
udp socket option that does not hash connected sockets into the port
table. In effect receiving on a small set of listening sockets (e.g.,
one per cpu) and sending over separate tx-only sockets. That still
introduces unnecessary memory allocation. OTOH it amortizes some
operations, such as route lookup.

Anyway, that does not fix the immediate issue you reported when using
SO_REUSEPORT as described.

^ permalink raw reply

* [PATCH] enetc: Add missing call to 'pci_free_irq_vectors()' in probe and remove functions
From: Christophe JAILLET @ 2019-08-30 20:23 UTC (permalink / raw)
  To: yangbo.lu, claudiu.manoil, davem
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

Call to 'pci_free_irq_vectors()' are missing both in the error handling
path of the probe function, and in the remove function.
Add them.

Fixes: 19971f5ea0ab ("enetc: add PTP clock driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/freescale/enetc/enetc_ptp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
index 2fd2586e42bf..bc594892507a 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
@@ -82,7 +82,7 @@ static int enetc_ptp_probe(struct pci_dev *pdev,
 	n = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX);
 	if (n != 1) {
 		err = -EPERM;
-		goto err_irq;
+		goto err_irq_vectors;
 	}
 
 	ptp_qoriq->irq = pci_irq_vector(pdev, 0);
@@ -107,6 +107,8 @@ static int enetc_ptp_probe(struct pci_dev *pdev,
 err_no_clock:
 	free_irq(ptp_qoriq->irq, ptp_qoriq);
 err_irq:
+	pci_free_irq_vectors(pdev);
+err_irq_vectors:
 	iounmap(base);
 err_ioremap:
 	kfree(ptp_qoriq);
@@ -125,6 +127,7 @@ static void enetc_ptp_remove(struct pci_dev *pdev)
 
 	enetc_phc_index = -1;
 	ptp_qoriq_free(ptp_qoriq);
+	pci_free_irq_vectors(pdev);
 	kfree(ptp_qoriq);
 
 	pci_release_mem_regions(pdev);
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH bpf-next 00/13] bpf: adding map batch processing support
From: Stanislav Fomichev @ 2019-08-30 20:15 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Brian Vazquez, Yonghong Song, Alexei Starovoitov, bpf, netdev,
	Daniel Borkmann, kernel-team
In-Reply-To: <20190829171513.7699dbf3@cakuba.netronome.com>

On 08/29, Jakub Kicinski wrote:
> On Thu, 29 Aug 2019 16:13:59 -0700, Brian Vazquez wrote:
> > > We need a per-map implementation of the exec side, but roughly maps
> > > would do:
> > >
> > >         LIST_HEAD(deleted);
> > >
> > >         for entry in map {
> > >                 struct map_op_ctx {
> > >                         .key    = entry->key,
> > >                         .value  = entry->value,
> > >                 };
> > >
> > >                 act = BPF_PROG_RUN(filter, &map_op_ctx);
> > >                 if (act & ~ACT_BITS)
> > >                         return -EINVAL;
> > >
> > >                 if (act & DELETE) {
> > >                         map_unlink(entry);
> > >                         list_add(entry, &deleted);
> > >                 }
> > >                 if (act & STOP)
> > >                         break;
> > >         }
> > >
> > >         synchronize_rcu();
> > >
> > >         for entry in deleted {
> > >                 struct map_op_ctx {
> > >                         .key    = entry->key,
> > >                         .value  = entry->value,
> > >                 };
> > >
> > >                 BPF_PROG_RUN(dumper, &map_op_ctx);
> > >                 map_free(entry);
> > >         }
> > >  
> > Hi Jakub,
> > 
> > how would that approach support percpu maps?
> > 
> > I'm thinking of a scenario where you want to do some calculations on
> > percpu maps and you are interested on the info on all the cpus not
> > just the one that is running the bpf program. Currently on a pcpu map
> > the bpf_map_lookup_elem helper only returns the pointer to the data of
> > the executing cpu.
> 
> Right, we need to have the iteration outside of the bpf program itself,
> and pass the element in through the context. That way we can feed each
> per cpu entry into the program separately.
My 2 cents:

I personally like Jakub's/Quentin's proposal more. So if I get to choose
between this series and Jakub's filter+dump in BPF, I'd pick filter+dump
(pending per-cpu issue which we actually care about).

But if we can have both, I don't have any objections; this patch
series looks to me a lot like what Brian did, just extended to more
commands. If we are fine with the shortcomings raised about the
original series, then let's go with this version. Maybe we can also
look into addressing these independently.

But if I pretend that we live in an ideal world, I'd just go with
whatever Jakub and Quentin are doing so we don't have to support
two APIs that essentially do the same (minus batching update, but
it looks like there is no clear use case for that yet; maybe).

I guess you can hold off this series a bit and discuss it at LPC,
you have a talk dedicated to that :-) (and afaiu, you are all going)

^ permalink raw reply

* Re: [v2] net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate
From: Cong Wang @ 2019-08-30 20:09 UTC (permalink / raw)
  To: David Z. Dai
  Cc: Jamal Hadi Salim, Jiri Pirko, David Miller,
	Linux Kernel Network Developers, LKML, zdai
In-Reply-To: <1567195432.20025.18.camel@oc5348122405>

On Fri, Aug 30, 2019 at 1:03 PM David Z. Dai <zdai@linux.vnet.ibm.com> wrote:
>
> On Fri, 2019-08-30 at 12:11 -0700, Cong Wang wrote:
> > On Fri, Aug 30, 2019 at 12:06 PM David Dai <zdai@linux.vnet.ibm.com> wrote:
> > > -       if (p->peak_present)
> > > +               if ((police->params->rate.rate_bytes_ps >= (1ULL << 32)) &&
> > > +                   nla_put_u64_64bit(skb, TCA_POLICE_RATE64,
> > > +                                     police->params->rate.rate_bytes_ps,
> > > +                                     __TCA_POLICE_MAX))
> >
> > I think the last parameter should be TCA_POLICE_PAD.
> Thanks for reviewing it!
> I have the impression that last parameter num value should be larger
> than the attribute num value in 2nd parameter (TC_POLICE_RATE64 in this

Why do you have this impression?

> case). This is the reason I changed the last parameter value to
> __TCA_POLICE_MAX after I moved the new attributes after TC_POLICE_PAD in
> pkt_cls.h header.

The prototype clearly shows it must be a padding attribute:

static inline int nla_put_u64_64bit(struct sk_buff *skb, int attrtype,
                                    u64 value, int padattr)

^ permalink raw reply

* Re: [v2] net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate
From: David Z. Dai @ 2019-08-30 20:03 UTC (permalink / raw)
  To: Cong Wang
  Cc: Jamal Hadi Salim, Jiri Pirko, David Miller,
	Linux Kernel Network Developers, LKML, zdai
In-Reply-To: <CAM_iQpVMYQUdQN5L+ntXZTffZkW4q659bvXoZ8+Ar+zeud7Y4Q@mail.gmail.com>

On Fri, 2019-08-30 at 12:11 -0700, Cong Wang wrote:
> On Fri, Aug 30, 2019 at 12:06 PM David Dai <zdai@linux.vnet.ibm.com> wrote:
> > -       if (p->peak_present)
> > +               if ((police->params->rate.rate_bytes_ps >= (1ULL << 32)) &&
> > +                   nla_put_u64_64bit(skb, TCA_POLICE_RATE64,
> > +                                     police->params->rate.rate_bytes_ps,
> > +                                     __TCA_POLICE_MAX))
> 
> I think the last parameter should be TCA_POLICE_PAD.
Thanks for reviewing it!
I have the impression that last parameter num value should be larger
than the attribute num value in 2nd parameter (TC_POLICE_RATE64 in this
case). This is the reason I changed the last parameter value to
__TCA_POLICE_MAX after I moved the new attributes after TC_POLICE_PAD in
pkt_cls.h header.

I rebuilt the kernel module act_police.ko by using TC_POLICE_PAD in the
4 parameter as before, I am able to set > 32bit rate and peakrate value
in tc command. It also works properly.

If the rest of community thinks I should keep using TC_POLICE_PAD in the
4th parameter too, I can change it to TC_POLICE_PAD in the next version.

Thanks!




^ permalink raw reply

* Re: [v2] iproute2-next: police: support 64bit rate and peakrate in tc utility
From: Stephen Hemminger @ 2019-08-30 19:37 UTC (permalink / raw)
  To: David Dai; +Cc: jhs, xiyou.wangcong, jiri, netdev, linux-kernel, zdai
In-Reply-To: <1567192037-11684-1-git-send-email-zdai@linux.vnet.ibm.com>

On Fri, 30 Aug 2019 14:07:17 -0500
David Dai <zdai@linux.vnet.ibm.com> wrote:

> +			if (rate64) {
>  				fprintf(stderr, "Double \"rate\" spec\n");
>  				return -1;
>  			}

The m_police filter should start using the common functions
for duparg and invarg that are in lib/utils.c

^ permalink raw reply

* Re: [PATCH v6 net-next 12/19] ionic: Add Rx filter and rx_mode ndo support
From: Shannon Nelson @ 2019-08-30 19:35 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, davem
In-Reply-To: <20190829160610.60563ca0@cakuba.netronome.com>

On 8/29/19 4:06 PM, Jakub Kicinski wrote:
> On Thu, 29 Aug 2019 11:27:13 -0700, Shannon Nelson wrote:
>> @@ -588,8 +866,26 @@ static int ionic_set_features(struct net_device *netdev,
>>   
>>   static int ionic_set_mac_address(struct net_device *netdev, void *sa)
>>   {
>> -	netdev_info(netdev, "%s: stubbed\n", __func__);
>> -	return 0;
>> +	struct sockaddr *addr = sa;
>> +	u8 *mac;
>> +
>> +	mac = (u8 *)addr->sa_data;
>> +	if (ether_addr_equal(netdev->dev_addr, mac))
>> +		return 0;
>> +
>> +	if (!is_valid_ether_addr(mac))
>> +		return -EADDRNOTAVAIL;
>> +
>> +	if (!is_zero_ether_addr(netdev->dev_addr)) {
>> +		netdev_info(netdev, "deleting mac addr %pM\n",
>> +			    netdev->dev_addr);
>> +		ionic_addr_del(netdev, netdev->dev_addr);
>> +	}
>> +
>> +	memcpy(netdev->dev_addr, mac, netdev->addr_len);
>> +	netdev_info(netdev, "updating mac addr %pM\n", mac);
>> +
>> +	return ionic_addr_add(netdev, mac);
>>   }
> Please use the eth_prepare_mac_addr_change() and
> eth_commit_mac_addr_change() helpers.

Oh, hadn't seen those before... sure.
sln


^ permalink raw reply

* Re: [PATCH][V2] wimax/i2400m: remove debug containing bogus calculation of index
From: David Miller @ 2019-08-30 19:32 UTC (permalink / raw)
  To: colin.king
  Cc: inaky.perez-gonzalez, linux-wimax, netdev, kernel-janitors,
	linux-kernel
In-Reply-To: <20190830090711.15300-1-colin.king@canonical.com>

From: Colin King <colin.king@canonical.com>
Date: Fri, 30 Aug 2019 10:07:11 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> The subtraction of the two pointers is automatically scaled by the
> size of the size of the object the pointers point to, so the division
> by sizeof(*i2400m->barker) is incorrect.  This has been broken since
> day one of the driver and is only debug, so remove the debug completely.
> 
> Also move && in condition to clean up a checkpatch warning.
> 
> Addresses-Coverity: ("Extra sizeof expression")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> 
> V2: completely remove debug, clean up checkpatch warning, change subject line

Applied to net-next, thanks Colin.

^ permalink raw reply

* Re: [PATCH v6 net-next 07/19] ionic: Add basic adminq support
From: Shannon Nelson @ 2019-08-30 19:31 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, davem
In-Reply-To: <20190829155251.3b2d86c7@cakuba.netronome.com>

On 8/29/19 3:52 PM, Jakub Kicinski wrote:
> On Thu, 29 Aug 2019 11:27:08 -0700, Shannon Nelson wrote:
>> +static void ionic_lif_qcq_deinit(struct ionic_lif *lif, struct ionic_qcq *qcq)
>> +{
>> +	struct ionic_dev *idev = &lif->ionic->idev;
>> +	struct device *dev = lif->ionic->dev;
>> +
>> +	if (!qcq)
>> +		return;
>> +
>> +	ionic_debugfs_del_qcq(qcq);
>> +
>> +	if (!(qcq->flags & IONIC_QCQ_F_INITED))
>> +		return;
>> +
>> +	if (qcq->flags & IONIC_QCQ_F_INTR) {
>> +		ionic_intr_mask(idev->intr_ctrl, qcq->intr.index,
>> +				IONIC_INTR_MASK_SET);
>> +		synchronize_irq(qcq->intr.vector);
>> +		devm_free_irq(dev, qcq->intr.vector, &qcq->napi);
> Doesn't free_irq() basically imply synchronize_irq()?

The synchronize_irq() waits for any threaded handlers to finish, while 
free_irq() only waits for HW handling.  This helps makes sure we don't 
have anything still running before we remove resources.

sln

>
>> +		netif_napi_del(&qcq->napi);
>> +	}
>> +
>> +	qcq->flags &= ~IONIC_QCQ_F_INITED;


^ permalink raw reply

* memory leak in nr_rx_frame (2)
From: syzbot @ 2019-08-30 19:28 UTC (permalink / raw)
  To: davem, linux-hams, linux-kernel, netdev, ralf, syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    6525771f Merge tag 'arc-5.3-rc7' of git://git.kernel.org/p..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10200912600000
kernel config:  https://syzkaller.appspot.com/x/.config?x=e6131eafb9408877
dashboard link: https://syzkaller.appspot.com/bug?extid=0145ea560de205bc09f0
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=12b51f9c600000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+0145ea560de205bc09f0@syzkaller.appspotmail.com

2019/08/29 23:31:49 executed programs: 8
2019/08/29 23:31:56 executed programs: 15
2019/08/29 23:32:02 executed programs: 24
BUG: memory leak
unreferenced object 0xffff888123355800 (size 2048):
   comm "softirq", pid 0, jiffies 4295062008 (age 25.620s)
   hex dump (first 32 bytes):
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
     06 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00  ...@............
   backtrace:
     [<00000000bbb1ff80>] kmemleak_alloc_recursive  
include/linux/kmemleak.h:43 [inline]
     [<00000000bbb1ff80>] slab_post_alloc_hook mm/slab.h:522 [inline]
     [<00000000bbb1ff80>] slab_alloc mm/slab.c:3319 [inline]
     [<00000000bbb1ff80>] __do_kmalloc mm/slab.c:3653 [inline]
     [<00000000bbb1ff80>] __kmalloc+0x169/0x300 mm/slab.c:3664
     [<000000003948180d>] kmalloc include/linux/slab.h:557 [inline]
     [<000000003948180d>] sk_prot_alloc+0x112/0x170 net/core/sock.c:1603
     [<00000000ad5c33ee>] sk_alloc+0x35/0x2f0 net/core/sock.c:1657
     [<000000004e2b1f5c>] nr_make_new net/netrom/af_netrom.c:476 [inline]
     [<000000004e2b1f5c>] nr_rx_frame+0x339/0x8ee net/netrom/af_netrom.c:959
     [<00000000df4c3d82>] nr_loopback_timer+0x4e/0xd0  
net/netrom/nr_loopback.c:59
     [<00000000e886ef23>] call_timer_fn+0x45/0x1e0 kernel/time/timer.c:1322
     [<00000000cc0c55bd>] expire_timers kernel/time/timer.c:1366 [inline]
     [<00000000cc0c55bd>] __run_timers kernel/time/timer.c:1685 [inline]
     [<00000000cc0c55bd>] __run_timers kernel/time/timer.c:1653 [inline]
     [<00000000cc0c55bd>] run_timer_softirq+0x256/0x740  
kernel/time/timer.c:1698
     [<000000008a8ac853>] __do_softirq+0x115/0x33f kernel/softirq.c:292
     [<00000000c33f7c40>] invoke_softirq kernel/softirq.c:373 [inline]
     [<00000000c33f7c40>] irq_exit+0xbb/0xe0 kernel/softirq.c:413
     [<00000000dc851865>] exiting_irq arch/x86/include/asm/apic.h:537  
[inline]
     [<00000000dc851865>] smp_apic_timer_interrupt+0x96/0x190  
arch/x86/kernel/apic/apic.c:1133
     [<000000006a57c22f>] apic_timer_interrupt+0xf/0x20  
arch/x86/entry/entry_64.S:830
     [<00000000ec52384e>] arch_local_irq_restore  
arch/x86/include/asm/paravirt.h:768 [inline]
     [<00000000ec52384e>] console_unlock.part.0+0x5f0/0x6d0  
kernel/printk/printk.c:2471
     [<0000000013f07031>] console_unlock kernel/printk/printk.c:2364 [inline]
     [<0000000013f07031>] vprintk_emit+0x251/0x360  
kernel/printk/printk.c:1986
     [<00000000704abaae>] vprintk_default+0x28/0x30  
kernel/printk/printk.c:2013
     [<000000008aa8a0ba>] vprintk_func+0x59/0xfa  
kernel/printk/printk_safe.c:386
     [<000000004d884645>] printk+0x60/0x7d kernel/printk/printk.c:2046

BUG: memory leak
unreferenced object 0xffff88810e8bd820 (size 32):
   comm "softirq", pid 0, jiffies 4295062008 (age 25.620s)
   hex dump (first 32 bytes):
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
     03 00 00 00 03 00 00 00 0f 00 00 00 00 00 00 00  ................
   backtrace:
     [<0000000092f05cd5>] kmemleak_alloc_recursive  
include/linux/kmemleak.h:43 [inline]
     [<0000000092f05cd5>] slab_post_alloc_hook mm/slab.h:522 [inline]
     [<0000000092f05cd5>] slab_alloc mm/slab.c:3319 [inline]
     [<0000000092f05cd5>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
     [<00000000f2b13853>] kmalloc include/linux/slab.h:552 [inline]
     [<00000000f2b13853>] kzalloc include/linux/slab.h:748 [inline]
     [<00000000f2b13853>] selinux_sk_alloc_security+0x48/0xb0  
security/selinux/hooks.c:5073
     [<000000002301f7f8>] security_sk_alloc+0x49/0x70  
security/security.c:2029
     [<000000009fb5708b>] sk_prot_alloc+0x12d/0x170 net/core/sock.c:1606
     [<00000000ad5c33ee>] sk_alloc+0x35/0x2f0 net/core/sock.c:1657
     [<000000004e2b1f5c>] nr_make_new net/netrom/af_netrom.c:476 [inline]
     [<000000004e2b1f5c>] nr_rx_frame+0x339/0x8ee net/netrom/af_netrom.c:959
     [<00000000df4c3d82>] nr_loopback_timer+0x4e/0xd0  
net/netrom/nr_loopback.c:59
     [<00000000e886ef23>] call_timer_fn+0x45/0x1e0 kernel/time/timer.c:1322
     [<00000000cc0c55bd>] expire_timers kernel/time/timer.c:1366 [inline]
     [<00000000cc0c55bd>] __run_timers kernel/time/timer.c:1685 [inline]
     [<00000000cc0c55bd>] __run_timers kernel/time/timer.c:1653 [inline]
     [<00000000cc0c55bd>] run_timer_softirq+0x256/0x740  
kernel/time/timer.c:1698
     [<000000008a8ac853>] __do_softirq+0x115/0x33f kernel/softirq.c:292
     [<00000000c33f7c40>] invoke_softirq kernel/softirq.c:373 [inline]
     [<00000000c33f7c40>] irq_exit+0xbb/0xe0 kernel/softirq.c:413
     [<00000000dc851865>] exiting_irq arch/x86/include/asm/apic.h:537  
[inline]
     [<00000000dc851865>] smp_apic_timer_interrupt+0x96/0x190  
arch/x86/kernel/apic/apic.c:1133
     [<000000006a57c22f>] apic_timer_interrupt+0xf/0x20  
arch/x86/entry/entry_64.S:830
     [<00000000ec52384e>] arch_local_irq_restore  
arch/x86/include/asm/paravirt.h:768 [inline]
     [<00000000ec52384e>] console_unlock.part.0+0x5f0/0x6d0  
kernel/printk/printk.c:2471
     [<0000000013f07031>] console_unlock kernel/printk/printk.c:2364 [inline]
     [<0000000013f07031>] vprintk_emit+0x251/0x360  
kernel/printk/printk.c:1986
     [<00000000704abaae>] vprintk_default+0x28/0x30  
kernel/printk/printk.c:2013



---
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.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply

* INFO: task hung in p9_fd_close
From: syzbot @ 2019-08-30 19:28 UTC (permalink / raw)
  To: asmadeus, davem, ericvh, linux-kernel, lucho, netdev,
	syzkaller-bugs, v9fs-developer

Hello,

syzbot found the following crash on:

HEAD commit:    6525771f Merge tag 'arc-5.3-rc7' of git://git.kernel.org/p..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1118a71e600000
kernel config:  https://syzkaller.appspot.com/x/.config?x=58485246ad14eafe
dashboard link: https://syzkaller.appspot.com/bug?extid=8b41a1365f1106fd0f33
compiler:       clang version 9.0.0 (/home/glider/llvm/clang  
80fee25776c2fb61e74c1ecb1a523375c2500b69)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1125ee12600000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+8b41a1365f1106fd0f33@syzkaller.appspotmail.com

INFO: task syz-executor.1:13699 blocked for more than 143 seconds.
       Not tainted 5.3.0-rc6+ #94
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
syz-executor.1  D28888 13699   9148 0x00004004
Call Trace:
  context_switch kernel/sched/core.c:3254 [inline]
  __schedule+0x877/0xc50 kernel/sched/core.c:3880
  schedule+0x131/0x1e0 kernel/sched/core.c:3947
  schedule_timeout+0x46/0x240 kernel/time/timer.c:1783
  do_wait_for_common+0x2e7/0x4d0 kernel/sched/completion.c:83
  __wait_for_common kernel/sched/completion.c:104 [inline]
  wait_for_common kernel/sched/completion.c:115 [inline]
  wait_for_completion+0x47/0x60 kernel/sched/completion.c:136
  __flush_work+0xd4/0x150 kernel/workqueue.c:3040
  __cancel_work_timer+0x420/0x570 kernel/workqueue.c:3127
  cancel_work_sync+0x17/0x20 kernel/workqueue.c:3163
  p9_conn_destroy net/9p/trans_fd.c:868 [inline]
  p9_fd_close+0x297/0x3c0 net/9p/trans_fd.c:898
  p9_client_create+0x974/0xee0 net/9p/client.c:1068
  v9fs_session_init+0x192/0x18e0 fs/9p/v9fs.c:406
  v9fs_mount+0x82/0x810 fs/9p/vfs_super.c:120
  legacy_get_tree+0xf9/0x1a0 fs/fs_context.c:661
  vfs_get_tree+0x8f/0x380 fs/super.c:1413
  do_new_mount fs/namespace.c:2791 [inline]
  do_mount+0x169d/0x2490 fs/namespace.c:3111
  ksys_mount+0xcc/0x100 fs/namespace.c:3320
  __do_sys_mount fs/namespace.c:3334 [inline]
  __se_sys_mount fs/namespace.c:3331 [inline]
  __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3331
  do_syscall_64+0xfe/0x140 arch/x86/entry/common.c:296
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459879
Code: 8b 44 24 18 48 8b 4c 24 30 48 83 c1 08 48 89 0c 24 48 89 44 24 08 48  
c7 44 24 10 10 00 00 00 e8 0d da fa ff 48 8b 44 24 18 48 <89> 44 24 40 48  
8b 6c 24 20 48 83 c4 28 c3 e8 14 b9 ff ff eb 82 cc
RSP: 002b:00007f6b4dda7c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 0000000000459879
RDX: 0000000020000140 RSI: 0000000020000000 RDI: 0000000000000000
RBP: 000000000075c118 R08: 0000000020000480 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6b4dda86d4
R13: 00000000004c5e2f R14: 00000000004da930 R15: 00000000ffffffff
INFO: lockdep is turned off.
NMI backtrace for cpu 0
CPU: 0 PID: 1057 Comm: khungtaskd Not tainted 5.3.0-rc6+ #94
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+0x1d8/0x2f8 lib/dump_stack.c:113
  nmi_cpu_backtrace+0xaf/0x1a0 lib/nmi_backtrace.c:101
  nmi_trigger_cpumask_backtrace+0x174/0x290 lib/nmi_backtrace.c:62
  arch_trigger_cpumask_backtrace+0x10/0x20 arch/x86/kernel/apic/hw_nmi.c:38
  trigger_all_cpu_backtrace+0x17/0x20 include/linux/nmi.h:146
  check_hung_uninterruptible_tasks kernel/hung_task.c:205 [inline]
  watchdog+0xbb9/0xbd0 kernel/hung_task.c:289
  kthread+0x332/0x350 kernel/kthread.c:255
  ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
Sending NMI from CPU 0 to CPUs 1:
NMI backtrace for cpu 1 skipped: idling at native_safe_halt+0xe/0x10  
arch/x86/include/asm/irqflags.h:60


---
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.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply

* memory leak in hci_inquiry_cache_update
From: syzbot @ 2019-08-30 19:28 UTC (permalink / raw)
  To: davem, johan.hedberg, linux-bluetooth, linux-kernel, marcel,
	netdev, syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    6525771f Merge tag 'arc-5.3-rc7' of git://git.kernel.org/p..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11ce405c600000
kernel config:  https://syzkaller.appspot.com/x/.config?x=e6131eafb9408877
dashboard link: https://syzkaller.appspot.com/bug?extid=82e5dfb66f1a36c0ffbb
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=16ef5ade600000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+82e5dfb66f1a36c0ffbb@syzkaller.appspotmail.com

2019/08/30 10:10:13 executed programs: 1
2019/08/30 10:10:24 executed programs: 2
2019/08/30 10:10:39 executed programs: 3
2019/08/30 10:10:49 executed programs: 4
BUG: memory leak
unreferenced object 0xffff8881227b8ac0 (size 64):
   comm "kworker/u5:0", pid 1543, jiffies 4294990660 (age 28.050s)
   hex dump (first 32 bytes):
     70 2a b0 2a 81 88 ff ff c0 7e c6 1a 81 88 ff ff  p*.*.....~......
     80 2a b0 2a 81 88 ff ff d0 7e c6 1a 81 88 ff ff  .*.*.....~......
   backtrace:
     [<0000000003c40121>] kmemleak_alloc_recursive  
include/linux/kmemleak.h:43 [inline]
     [<0000000003c40121>] slab_post_alloc_hook mm/slab.h:522 [inline]
     [<0000000003c40121>] slab_alloc mm/slab.c:3319 [inline]
     [<0000000003c40121>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
     [<00000000bdd76485>] kmalloc include/linux/slab.h:552 [inline]
     [<00000000bdd76485>] kzalloc include/linux/slab.h:748 [inline]
     [<00000000bdd76485>] hci_inquiry_cache_update+0x138/0x2b0  
net/bluetooth/hci_core.c:1183
     [<000000000fa97823>] hci_inquiry_result_with_rssi_evt  
net/bluetooth/hci_event.c:4079 [inline]
     [<000000000fa97823>] hci_event_packet+0x1224/0x3453  
net/bluetooth/hci_event.c:5952
     [<0000000021923028>] hci_rx_work+0x1b6/0x2f0  
net/bluetooth/hci_core.c:4462
     [<00000000eb63bebf>] process_one_work+0x210/0x490  
kernel/workqueue.c:2269
     [<00000000873e1703>] worker_thread+0x56/0x4c0 kernel/workqueue.c:2415
     [<00000000a3c26b57>] kthread+0x13e/0x160 kernel/kthread.c:255
     [<00000000c66acc55>] ret_from_fork+0x1f/0x30  
arch/x86/entry/entry_64.S:352

BUG: memory leak
unreferenced object 0xffff88811ac67ec0 (size 64):
   comm "kworker/u5:0", pid 1543, jiffies 4294990660 (age 28.050s)
   hex dump (first 32 bytes):
     c0 8a 7b 22 81 88 ff ff 80 7e c6 1a 81 88 ff ff  ..{".....~......
     d0 8a 7b 22 81 88 ff ff 90 7e c6 1a 81 88 ff ff  ..{".....~......
   backtrace:
     [<0000000003c40121>] kmemleak_alloc_recursive  
include/linux/kmemleak.h:43 [inline]
     [<0000000003c40121>] slab_post_alloc_hook mm/slab.h:522 [inline]
     [<0000000003c40121>] slab_alloc mm/slab.c:3319 [inline]
     [<0000000003c40121>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
     [<00000000bdd76485>] kmalloc include/linux/slab.h:552 [inline]
     [<00000000bdd76485>] kzalloc include/linux/slab.h:748 [inline]
     [<00000000bdd76485>] hci_inquiry_cache_update+0x138/0x2b0  
net/bluetooth/hci_core.c:1183
     [<000000000fa97823>] hci_inquiry_result_with_rssi_evt  
net/bluetooth/hci_event.c:4079 [inline]
     [<000000000fa97823>] hci_event_packet+0x1224/0x3453  
net/bluetooth/hci_event.c:5952
     [<0000000021923028>] hci_rx_work+0x1b6/0x2f0  
net/bluetooth/hci_core.c:4462
     [<00000000eb63bebf>] process_one_work+0x210/0x490  
kernel/workqueue.c:2269
     [<00000000873e1703>] worker_thread+0x56/0x4c0 kernel/workqueue.c:2415
     [<00000000a3c26b57>] kthread+0x13e/0x160 kernel/kthread.c:255
     [<00000000c66acc55>] ret_from_fork+0x1f/0x30  
arch/x86/entry/entry_64.S:352

BUG: memory leak
unreferenced object 0xffff88811ac67e80 (size 64):
   comm "kworker/u5:0", pid 1543, jiffies 4294990660 (age 28.050s)
   hex dump (first 32 bytes):
     c0 7e c6 1a 81 88 ff ff 40 7e c6 1a 81 88 ff ff  .~......@~......
     d0 7e c6 1a 81 88 ff ff 50 7e c6 1a 81 88 ff ff  .~......P~......
   backtrace:
     [<0000000003c40121>] kmemleak_alloc_recursive  
include/linux/kmemleak.h:43 [inline]
     [<0000000003c40121>] slab_post_alloc_hook mm/slab.h:522 [inline]
     [<0000000003c40121>] slab_alloc mm/slab.c:3319 [inline]
     [<0000000003c40121>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
     [<00000000bdd76485>] kmalloc include/linux/slab.h:552 [inline]
     [<00000000bdd76485>] kzalloc include/linux/slab.h:748 [inline]
     [<00000000bdd76485>] hci_inquiry_cache_update+0x138/0x2b0  
net/bluetooth/hci_core.c:1183
     [<000000000fa97823>] hci_inquiry_result_with_rssi_evt  
net/bluetooth/hci_event.c:4079 [inline]
     [<000000000fa97823>] hci_event_packet+0x1224/0x3453  
net/bluetooth/hci_event.c:5952
     [<0000000021923028>] hci_rx_work+0x1b6/0x2f0  
net/bluetooth/hci_core.c:4462
     [<00000000eb63bebf>] process_one_work+0x210/0x490  
kernel/workqueue.c:2269
     [<00000000873e1703>] worker_thread+0x56/0x4c0 kernel/workqueue.c:2415
     [<00000000a3c26b57>] kthread+0x13e/0x160 kernel/kthread.c:255
     [<00000000c66acc55>] ret_from_fork+0x1f/0x30  
arch/x86/entry/entry_64.S:352

BUG: memory leak
unreferenced object 0xffff88811ac67e40 (size 64):
   comm "kworker/u5:0", pid 1543, jiffies 4294990660 (age 28.050s)
   hex dump (first 32 bytes):
     80 7e c6 1a 81 88 ff ff 00 7e c6 1a 81 88 ff ff  .~.......~......
     90 7e c6 1a 81 88 ff ff 10 7e c6 1a 81 88 ff ff  .~.......~......
   backtrace:
     [<0000000003c40121>] kmemleak_alloc_recursive  
include/linux/kmemleak.h:43 [inline]
     [<0000000003c40121>] slab_post_alloc_hook mm/slab.h:522 [inline]
     [<0000000003c40121>] slab_alloc mm/slab.c:3319 [inline]
     [<0000000003c40121>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
     [<00000000bdd76485>] kmalloc include/linux/slab.h:552 [inline]
     [<00000000bdd76485>] kzalloc include/linux/slab.h:748 [inline]
     [<00000000bdd76485>] hci_inquiry_cache_update+0x138/0x2b0  
net/bluetooth/hci_core.c:1183
     [<000000000fa97823>] hci_inquiry_result_with_rssi_evt  
net/bluetooth/hci_event.c:4079 [inline]
     [<000000000fa97823>] hci_event_packet+0x1224/0x3453  
net/bluetooth/hci_event.c:5952
     [<0000000021923028>] hci_rx_work+0x1b6/0x2f0  
net/bluetooth/hci_core.c:4462
     [<00000000eb63bebf>] process_one_work+0x210/0x490  
kernel/workqueue.c:2269
     [<00000000873e1703>] worker_thread+0x56/0x4c0 kernel/workqueue.c:2415
     [<00000000a3c26b57>] kthread+0x13e/0x160 kernel/kthread.c:255
     [<00000000c66acc55>] ret_from_fork+0x1f/0x30  
arch/x86/entry/entry_64.S:352

BUG: memory leak
unreferenced object 0xffff88811ac67e00 (size 64):
   comm "kworker/u5:0", pid 1543, jiffies 4294990660 (age 28.050s)
   hex dump (first 32 bytes):
     40 7e c6 1a 81 88 ff ff c0 7d c6 1a 81 88 ff ff  @~.......}......
     50 7e c6 1a 81 88 ff ff d0 7d c6 1a 81 88 ff ff  P~.......}......
   backtrace:
     [<0000000003c40121>] kmemleak_alloc_recursive  
include/linux/kmemleak.h:43 [inline]
     [<0000000003c40121>] slab_post_alloc_hook mm/slab.h:522 [inline]
     [<0000000003c40121>] slab_alloc mm/slab.c:3319 [inline]
     [<0000000003c40121>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
     [<00000000bdd76485>] kmalloc include/linux/slab.h:552 [inline]
     [<00000000bdd76485>] kzalloc include/linux/slab.h:748 [inline]
     [<00000000bdd76485>] hci_inquiry_cache_update+0x138/0x2b0  
net/bluetooth/hci_core.c:1183
     [<000000000fa97823>] hci_inquiry_result_with_rssi_evt  
net/bluetooth/hci_event.c:4079 [inline]
     [<000000000fa97823>] hci_event_packet+0x1224/0x3453  
net/bluetooth/hci_event.c:5952
     [<0000000021923028>] hci_rx_work+0x1b6/0x2f0  
net/bluetooth/hci_core.c:4462
     [<00000000eb63bebf>] process_one_work+0x210/0x490  
kernel/workqueue.c:2269
     [<00000000873e1703>] worker_thread+0x56/0x4c0 kernel/workqueue.c:2415
     [<00000000a3c26b57>] kthread+0x13e/0x160 kernel/kthread.c:255
     [<00000000c66acc55>] ret_from_fork+0x1f/0x30  
arch/x86/entry/entry_64.S:352



---
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.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply

* Re: [PATCH bpf-next] tools: libbpf: update extended attributes version of bpf_object__open()
From: Song Liu @ 2019-08-30 19:24 UTC (permalink / raw)
  To: Anton Protopopov
  Cc: Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann, Martin Lau,
	Yonghong Song, Networking, bpf, linux-kernel@vger.kernel.org
In-Reply-To: <CAGn_itwS=bLf8NGVNbByNx8FmR_JtPWnuEnKO23ig8xnK_GYOw@mail.gmail.com>



> On Aug 30, 2019, at 11:53 AM, Anton Protopopov <a.s.protopopov@gmail.com> wrote:
> 
> чт, 29 авг. 2019 г. в 16:02, Song Liu <songliubraving@fb.com>:
>> 
>> 
>> 
>>> On Aug 14, 2019, at 5:03 PM, Anton Protopopov <a.s.protopopov@gmail.com> wrote:
>>> 
>> 
>> [...]
>> 
>>> 
>>> 
>>> int bpf_object__unload(struct bpf_object *obj)
>>> diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
>>> index e8f70977d137..634f278578dd 100644
>>> --- a/tools/lib/bpf/libbpf.h
>>> +++ b/tools/lib/bpf/libbpf.h
>>> @@ -63,8 +63,13 @@ LIBBPF_API libbpf_print_fn_t libbpf_set_print(libbpf_print_fn_t fn);
>>> struct bpf_object;
>>> 
>>> struct bpf_object_open_attr {
>>> -     const char *file;
>>> +     union {
>>> +             const char *file;
>>> +             const char *obj_name;
>>> +     };
>>>      enum bpf_prog_type prog_type;
>>> +     void *obj_buf;
>>> +     size_t obj_buf_sz;
>>> };
>> 
>> I think this would break dynamically linked libbpf. No?
> 
> Ah, yes, sure. What is the right way to make changes which break ABI in libbpf?

I don't have a good idea here on the top of my head.

Maybe we need a new struct and/or function for this. 
 
> 
> BTW, does the commit ddc7c3042614 ("libbpf: implement BPF CO-RE offset
> relocation algorithm") which adds a new field to the struct
> bpf_object_load_attr also break ABI?

I think this change was in the same release, so it is OK. 

Thanks,
Song

^ permalink raw reply

* [PATCH][next] zd1211rw: zd_usb: Use struct_size() helper
From: Gustavo A. R. Silva @ 2019-08-30 18:57 UTC (permalink / raw)
  To: Daniel Drake, Ulrich Kunitz, Kalle Valo, David S. Miller
  Cc: linux-wireless, netdev, linux-kernel, Gustavo A. R. Silva

One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct usb_int_regs {
	...
        struct reg_data regs[0];
} __packed;

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.

So, replace the following function:

static int usb_int_regs_length(unsigned int count)
{
       return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data);
}

with:

struct_size(regs, regs, count)

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
index 1965cd0fafc4..4e44ea8c652d 100644
--- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
@@ -1597,11 +1597,6 @@ static int zd_ep_regs_out_msg(struct usb_device *udev, void *data, int len,
 	}
 }
 
-static int usb_int_regs_length(unsigned int count)
-{
-	return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data);
-}
-
 static void prepare_read_regs_int(struct zd_usb *usb,
 				  struct usb_req_read_regs *req,
 				  unsigned int count)
@@ -1636,10 +1631,10 @@ static bool check_read_regs(struct zd_usb *usb, struct usb_req_read_regs *req,
 	/* The created block size seems to be larger than expected.
 	 * However results appear to be correct.
 	 */
-	if (rr->length < usb_int_regs_length(count)) {
+	if (rr->length < struct_size(regs, regs, count)) {
 		dev_dbg_f(zd_usb_dev(usb),
-			 "error: actual length %d less than expected %d\n",
-			 rr->length, usb_int_regs_length(count));
+			 "error: actual length %d less than expected %ld\n",
+			 rr->length, struct_size(regs, regs, count));
 		return false;
 	}
 
-- 
2.23.0


^ permalink raw reply related

* Re: [PATCH v6 net-next 04/19] ionic: Add port management commands
From: Shannon Nelson @ 2019-08-30 19:18 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, davem
In-Reply-To: <20190829154613.4e2b479a@cakuba.netronome.com>

On 8/29/19 3:46 PM, Jakub Kicinski wrote:
> On Thu, 29 Aug 2019 11:27:05 -0700, Shannon Nelson wrote:
>> The port management commands apply to the physical port
>> associated with the PCI device, which might be shared among
>> several logical interfaces.
>>
>> Signed-off-by: Shannon Nelson <snelson@pensando.io>
>> ---
>>   drivers/net/ethernet/pensando/ionic/ionic.h   |  4 +
>>   .../ethernet/pensando/ionic/ionic_bus_pci.c   | 16 ++++
>>   .../net/ethernet/pensando/ionic/ionic_dev.c   | 92 +++++++++++++++++++
>>   .../net/ethernet/pensando/ionic/ionic_dev.h   | 13 +++
>>   .../net/ethernet/pensando/ionic/ionic_main.c  | 86 +++++++++++++++++
>>   5 files changed, 211 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h
>> index 89ad9c590736..4960effd2bcc 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic.h
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic.h
>> @@ -42,4 +42,8 @@ int ionic_identify(struct ionic *ionic);
>>   int ionic_init(struct ionic *ionic);
>>   int ionic_reset(struct ionic *ionic);
>>   
>> +int ionic_port_identify(struct ionic *ionic);
>> +int ionic_port_init(struct ionic *ionic);
>> +int ionic_port_reset(struct ionic *ionic);
>> +
>>   #endif /* _IONIC_H_ */
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
>> index 286b4b450a73..804dd43e92a6 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
>> @@ -138,12 +138,27 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>>   		goto err_out_teardown;
>>   	}
>>   
>> +	/* Configure the ports */
>> +	err = ionic_port_identify(ionic);
>> +	if (err) {
>> +		dev_err(dev, "Cannot identify port: %d, aborting\n", err);
>> +		goto err_out_reset;
>> +	}
>> +
>> +	err = ionic_port_init(ionic);
>> +	if (err) {
>> +		dev_err(dev, "Cannot init port: %d, aborting\n", err);
>> +		goto err_out_reset;
>> +	}
>> +
>>   	err = ionic_devlink_register(ionic);
>>   	if (err)
>>   		dev_err(dev, "Cannot register devlink: %d\n", err);
>>   
>>   	return 0;
>>   
>> +err_out_reset:
>> +	ionic_reset(ionic);
>>   err_out_teardown:
>>   	ionic_dev_teardown(ionic);
>>   err_out_unmap_bars:
>> @@ -170,6 +185,7 @@ static void ionic_remove(struct pci_dev *pdev)
>>   		return;
>>   
>>   	ionic_devlink_unregister(ionic);
>> +	ionic_port_reset(ionic);
>>   	ionic_reset(ionic);
>>   	ionic_dev_teardown(ionic);
>>   	ionic_unmap_bars(ionic);
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c
>> index 0bf1bd6bd7b1..3137776e9191 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c
>> @@ -134,3 +134,95 @@ void ionic_dev_cmd_reset(struct ionic_dev *idev)
>>   
>>   	ionic_dev_cmd_go(idev, &cmd);
>>   }
>> +
>> +/* Port commands */
>> +void ionic_dev_cmd_port_identify(struct ionic_dev *idev)
>> +{
>> +	union ionic_dev_cmd cmd = {
>> +		.port_init.opcode = IONIC_CMD_PORT_IDENTIFY,
>> +		.port_init.index = 0,
>> +	};
>> +
>> +	ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_init(struct ionic_dev *idev)
>> +{
>> +	union ionic_dev_cmd cmd = {
>> +		.port_init.opcode = IONIC_CMD_PORT_INIT,
>> +		.port_init.index = 0,
>> +		.port_init.info_pa = cpu_to_le64(idev->port_info_pa),
>> +	};
>> +
>> +	ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_reset(struct ionic_dev *idev)
>> +{
>> +	union ionic_dev_cmd cmd = {
>> +		.port_reset.opcode = IONIC_CMD_PORT_RESET,
>> +		.port_reset.index = 0,
>> +	};
>> +
>> +	ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_state(struct ionic_dev *idev, u8 state)
>> +{
>> +	union ionic_dev_cmd cmd = {
>> +		.port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
>> +		.port_setattr.index = 0,
>> +		.port_setattr.attr = IONIC_PORT_ATTR_STATE,
>> +		.port_setattr.state = state,
>> +	};
>> +
>> +	ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_speed(struct ionic_dev *idev, u32 speed)
>> +{
>> +	union ionic_dev_cmd cmd = {
>> +		.port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
>> +		.port_setattr.index = 0,
>> +		.port_setattr.attr = IONIC_PORT_ATTR_SPEED,
>> +		.port_setattr.speed = cpu_to_le32(speed),
>> +	};
>> +
>> +	ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_autoneg(struct ionic_dev *idev, u8 an_enable)
>> +{
>> +	union ionic_dev_cmd cmd = {
>> +		.port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
>> +		.port_setattr.index = 0,
>> +		.port_setattr.attr = IONIC_PORT_ATTR_AUTONEG,
>> +		.port_setattr.an_enable = an_enable,
>> +	};
>> +
>> +	ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_fec(struct ionic_dev *idev, u8 fec_type)
>> +{
>> +	union ionic_dev_cmd cmd = {
>> +		.port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
>> +		.port_setattr.index = 0,
>> +		.port_setattr.attr = IONIC_PORT_ATTR_FEC,
>> +		.port_setattr.fec_type = fec_type,
>> +	};
>> +
>> +	ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_pause(struct ionic_dev *idev, u8 pause_type)
>> +{
>> +	union ionic_dev_cmd cmd = {
>> +		.port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
>> +		.port_setattr.index = 0,
>> +		.port_setattr.attr = IONIC_PORT_ATTR_PAUSE,
>> +		.port_setattr.pause_type = pause_type,
>> +	};
>> +
>> +	ionic_dev_cmd_go(idev, &cmd);
>> +}
> Hm. So you haven't moved those?

They make for a nice consistent bundle of service routines that get used 
in a later patch in this patchset, and helps keep that other patch a 
little leaner and perhaps easier to review.

>
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.h b/drivers/net/ethernet/pensando/ionic/ionic_dev.h
>> index 7050545a83aa..81b6910aabc1 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.h
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.h
>> @@ -117,6 +117,10 @@ struct ionic_dev {
>>   	struct ionic_intr __iomem *intr_ctrl;
>>   	u64 __iomem *intr_status;
>>   
>> +	u32 port_info_sz;
>> +	struct ionic_port_info *port_info;
>> +	dma_addr_t port_info_pa;
>> +
>>   	struct ionic_devinfo dev_info;
>>   };
>>   
>> @@ -135,4 +139,13 @@ void ionic_dev_cmd_identify(struct ionic_dev *idev, u8 ver);
>>   void ionic_dev_cmd_init(struct ionic_dev *idev);
>>   void ionic_dev_cmd_reset(struct ionic_dev *idev);
>>   
>> +void ionic_dev_cmd_port_identify(struct ionic_dev *idev);
>> +void ionic_dev_cmd_port_init(struct ionic_dev *idev);
>> +void ionic_dev_cmd_port_reset(struct ionic_dev *idev);
>> +void ionic_dev_cmd_port_state(struct ionic_dev *idev, u8 state);
>> +void ionic_dev_cmd_port_speed(struct ionic_dev *idev, u32 speed);
>> +void ionic_dev_cmd_port_autoneg(struct ionic_dev *idev, u8 an_enable);
>> +void ionic_dev_cmd_port_fec(struct ionic_dev *idev, u8 fec_type);
>> +void ionic_dev_cmd_port_pause(struct ionic_dev *idev, u8 pause_type);
>> +
>>   #endif /* _IONIC_DEV_H_ */
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c
>> index 5c311b9241ee..96de2789587d 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c
>> @@ -317,6 +317,92 @@ int ionic_reset(struct ionic *ionic)
>>   	return err;
>>   }
>>   
>> +int ionic_port_identify(struct ionic *ionic)
>> +{
>> +	struct ionic_identity *ident = &ionic->ident;
>> +	struct ionic_dev *idev = &ionic->idev;
>> +	size_t sz;
>> +	int err;
>> +
>> +	mutex_lock(&ionic->dev_cmd_lock);
>> +
>> +	ionic_dev_cmd_port_identify(idev);
>> +	err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
>> +	if (!err) {
>> +		sz = min(sizeof(ident->port), sizeof(idev->dev_cmd_regs->data));
>> +		memcpy_fromio(&ident->port, &idev->dev_cmd_regs->data, sz);
>> +	}
>> +
>> +	mutex_unlock(&ionic->dev_cmd_lock);
>> +
>> +	return err;
>> +}
>> +
>> +int ionic_port_init(struct ionic *ionic)
>> +{
>> +	struct ionic_identity *ident = &ionic->ident;
>> +	struct ionic_dev *idev = &ionic->idev;
>> +	size_t sz;
>> +	int err;
>> +
>> +	if (idev->port_info)
>> +		return 0;
>> +
>> +	idev->port_info_sz = ALIGN(sizeof(*idev->port_info), PAGE_SIZE);
>> +	idev->port_info = dma_alloc_coherent(ionic->dev, idev->port_info_sz,
>> +					     &idev->port_info_pa,
>> +					     GFP_KERNEL);
>> +	if (!idev->port_info) {
>> +		dev_err(ionic->dev, "Failed to allocate port info, aborting\n");
>> +		return -ENOMEM;
>> +	}
>> +
>> +	sz = min(sizeof(ident->port.config), sizeof(idev->dev_cmd_regs->data));
>> +
>> +	mutex_lock(&ionic->dev_cmd_lock);
>> +
>> +	memcpy_toio(&idev->dev_cmd_regs->data, &ident->port.config, sz);
>> +	ionic_dev_cmd_port_init(idev);
>> +	err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
>> +
>> +	ionic_dev_cmd_port_state(&ionic->idev, IONIC_PORT_ADMIN_STATE_UP);
>> +	(void)ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
>> +
>> +	mutex_unlock(&ionic->dev_cmd_lock);
>> +	if (err) {
>> +		dev_err(ionic->dev, "Failed to init port\n");
>> +		dma_free_coherent(ionic->dev, idev->port_info_sz,
>> +				  idev->port_info, idev->port_info_pa);
> idev->port_info = NULL;

Yep

Thanks,
sln



^ permalink raw reply

* Re: [v2] net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate
From: Cong Wang @ 2019-08-30 19:11 UTC (permalink / raw)
  To: David Dai
  Cc: Jamal Hadi Salim, Jiri Pirko, David Miller,
	Linux Kernel Network Developers, LKML, zdai
In-Reply-To: <1567191974-11578-1-git-send-email-zdai@linux.vnet.ibm.com>

On Fri, Aug 30, 2019 at 12:06 PM David Dai <zdai@linux.vnet.ibm.com> wrote:
> -       if (p->peak_present)
> +               if ((police->params->rate.rate_bytes_ps >= (1ULL << 32)) &&
> +                   nla_put_u64_64bit(skb, TCA_POLICE_RATE64,
> +                                     police->params->rate.rate_bytes_ps,
> +                                     __TCA_POLICE_MAX))

I think the last parameter should be TCA_POLICE_PAD.

^ permalink raw reply

* [v2] iproute2-next: police: support 64bit rate and peakrate in tc utility
From: David Dai @ 2019-08-30 19:07 UTC (permalink / raw)
  To: jhs, xiyou.wangcong, jiri, netdev, linux-kernel; +Cc: zdai, zdai

For high speed adapter like Mellanox CX-5 card, it can reach upto
100 Gbits per second bandwidth. Currently htb already supports 64bit rate
in tc utility. However police action rate and peakrate are still limited
to 32bit value (upto 32 Gbits per second). Taking advantage of the 2 new
attributes TCA_POLICE_RATE64 and TCA_POLICE_PEAKRATE64 from kernel,
tc can use them to break the 32bit limit, and still keep the backward
binary compatibility.

Tested-by: David Dai <zdai@linux.vnet.ibm.com>
Signed-off-by: David Dai <zdai@linux.vnet.ibm.com>
---
Changelog:
v1->v2:
 - Change patch submit component from iproute2 to iproute2-next
 - Move 2 attributes TCA_POLICE_RATE64 TCA_POLICE_PEAKRATE64 after 
   TCA_POLICE_PAD in pkt_cls.h header to be consistent with kernel's 
   pkt_cls.h header.
---
 include/uapi/linux/pkt_cls.h |    2 +
 tc/m_police.c                |   64 +++++++++++++++++++++++++++--------------
 tc/tc_core.c                 |   29 +++++++++++++++++++
 tc/tc_core.h                 |    3 ++
 4 files changed, 76 insertions(+), 22 deletions(-)

diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index b057aee..a6aa466 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -160,6 +160,8 @@ enum {
 	TCA_POLICE_RESULT,
 	TCA_POLICE_TM,
 	TCA_POLICE_PAD,
+	TCA_POLICE_RATE64,
+	TCA_POLICE_PEAKRATE64,
 	__TCA_POLICE_MAX
 #define TCA_POLICE_RESULT TCA_POLICE_RESULT
 };
diff --git a/tc/m_police.c b/tc/m_police.c
index 862a39f..db913f4 100644
--- a/tc/m_police.c
+++ b/tc/m_police.c
@@ -71,6 +71,7 @@ static int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
 	unsigned int linklayer = LINKLAYER_ETHERNET; /* Assume ethernet */
 	int Rcell_log =  -1, Pcell_log = -1;
 	struct rtattr *tail;
+	__u64 rate64 = 0, prate64 = 0;
 
 	if (a) /* new way of doing things */
 		NEXT_ARG();
@@ -121,11 +122,11 @@ static int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
 			}
 		} else if (strcmp(*argv, "rate") == 0) {
 			NEXT_ARG();
-			if (p.rate.rate) {
+			if (rate64) {
 				fprintf(stderr, "Double \"rate\" spec\n");
 				return -1;
 			}
-			if (get_rate(&p.rate.rate, *argv)) {
+			if (get_rate64(&rate64, *argv)) {
 				explain1("rate");
 				return -1;
 			}
@@ -141,11 +142,11 @@ static int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
 			}
 		} else if (matches(*argv, "peakrate") == 0) {
 			NEXT_ARG();
-			if (p.peakrate.rate) {
+			if (prate64) {
 				fprintf(stderr, "Double \"peakrate\" spec\n");
 				return -1;
 			}
-			if (get_rate(&p.peakrate.rate, *argv)) {
+			if (get_rate64(&prate64, *argv)) {
 				explain1("peakrate");
 				return -1;
 			}
@@ -189,23 +190,23 @@ action_ctrl_ok:
 	if (!ok)
 		return -1;
 
-	if (p.rate.rate && avrate)
+	if (rate64 && avrate)
 		return -1;
 
 	/* Must at least do late binding, use TB or ewma policing */
-	if (!p.rate.rate && !avrate && !p.index) {
+	if (!rate64 && !avrate && !p.index) {
 		fprintf(stderr, "\"rate\" or \"avrate\" MUST be specified.\n");
 		return -1;
 	}
 
 	/* When the TB policer is used, burst is required */
-	if (p.rate.rate && !buffer && !avrate) {
+	if (rate64 && !buffer && !avrate) {
 		fprintf(stderr, "\"burst\" requires \"rate\".\n");
 		return -1;
 	}
 
-	if (p.peakrate.rate) {
-		if (!p.rate.rate) {
+	if (prate64) {
+		if (!rate64) {
 			fprintf(stderr, "\"peakrate\" requires \"rate\".\n");
 			return -1;
 		}
@@ -215,22 +216,24 @@ action_ctrl_ok:
 		}
 	}
 
-	if (p.rate.rate) {
+	if (rate64) {
+		p.rate.rate = (rate64 >= (1ULL << 32)) ? ~0U : rate64;
 		p.rate.mpu = mpu;
 		p.rate.overhead = overhead;
-		if (tc_calc_rtable(&p.rate, rtab, Rcell_log, mtu,
-				   linklayer) < 0) {
+		if (tc_calc_rtable_64(&p.rate, rtab, Rcell_log, mtu,
+				   linklayer, rate64) < 0) {
 			fprintf(stderr, "POLICE: failed to calculate rate table.\n");
 			return -1;
 		}
-		p.burst = tc_calc_xmittime(p.rate.rate, buffer);
+		p.burst = tc_calc_xmittime(rate64, buffer);
 	}
 	p.mtu = mtu;
-	if (p.peakrate.rate) {
+	if (prate64) {
+		p.peakrate.rate = (prate64 >= (1ULL << 32)) ? ~0U : prate64;
 		p.peakrate.mpu = mpu;
 		p.peakrate.overhead = overhead;
-		if (tc_calc_rtable(&p.peakrate, ptab, Pcell_log, mtu,
-				   linklayer) < 0) {
+		if (tc_calc_rtable_64(&p.peakrate, ptab, Pcell_log, mtu,
+				   linklayer, prate64) < 0) {
 			fprintf(stderr, "POLICE: failed to calculate peak rate table.\n");
 			return -1;
 		}
@@ -238,10 +241,16 @@ action_ctrl_ok:
 
 	tail = addattr_nest(n, MAX_MSG, tca_id);
 	addattr_l(n, MAX_MSG, TCA_POLICE_TBF, &p, sizeof(p));
-	if (p.rate.rate)
+	if (rate64) {
 		addattr_l(n, MAX_MSG, TCA_POLICE_RATE, rtab, 1024);
-	if (p.peakrate.rate)
+		if (rate64 >= (1ULL << 32))
+			addattr64(n, MAX_MSG, TCA_POLICE_RATE64, rate64);
+	}
+	if (prate64) {
 		addattr_l(n, MAX_MSG, TCA_POLICE_PEAKRATE, ptab, 1024);
+		if (prate64 >= (1ULL << 32))
+			addattr64(n, MAX_MSG, TCA_POLICE_PEAKRATE64, prate64);
+	}
 	if (avrate)
 		addattr32(n, MAX_MSG, TCA_POLICE_AVRATE, avrate);
 	if (presult)
@@ -268,6 +277,7 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
 	struct rtattr *tb[TCA_POLICE_MAX+1];
 	unsigned int buffer;
 	unsigned int linklayer;
+	__u64 rate64, prate64;
 
 	if (arg == NULL)
 		return 0;
@@ -286,16 +296,26 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
 #endif
 	p = RTA_DATA(tb[TCA_POLICE_TBF]);
 
+	rate64 = p->rate.rate;
+	if (tb[TCA_POLICE_RATE64] &&
+	    RTA_PAYLOAD(tb[TCA_POLICE_RATE64]) >= sizeof(rate64))
+		rate64 = rta_getattr_u64(tb[TCA_POLICE_RATE64]);
+
 	fprintf(f, " police 0x%x ", p->index);
-	fprintf(f, "rate %s ", sprint_rate(p->rate.rate, b1));
-	buffer = tc_calc_xmitsize(p->rate.rate, p->burst);
+	fprintf(f, "rate %s ", sprint_rate(rate64, b1));
+	buffer = tc_calc_xmitsize(rate64, p->burst);
 	fprintf(f, "burst %s ", sprint_size(buffer, b1));
 	fprintf(f, "mtu %s ", sprint_size(p->mtu, b1));
 	if (show_raw)
 		fprintf(f, "[%08x] ", p->burst);
 
-	if (p->peakrate.rate)
-		fprintf(f, "peakrate %s ", sprint_rate(p->peakrate.rate, b1));
+	prate64 = p->peakrate.rate;
+	if (tb[TCA_POLICE_PEAKRATE64] &&
+	    RTA_PAYLOAD(tb[TCA_POLICE_PEAKRATE64]) >= sizeof(prate64))
+		prate64 = rta_getattr_u64(tb[TCA_POLICE_PEAKRATE64]);
+
+	if (prate64)
+		fprintf(f, "peakrate %s ", sprint_rate(prate64, b1));
 
 	if (tb[TCA_POLICE_AVRATE])
 		fprintf(f, "avrate %s ",
diff --git a/tc/tc_core.c b/tc/tc_core.c
index 8eb1122..498d35d 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -152,6 +152,35 @@ int tc_calc_rtable(struct tc_ratespec *r, __u32 *rtab,
 	return cell_log;
 }
 
+int tc_calc_rtable_64(struct tc_ratespec *r, __u32 *rtab,
+		   int cell_log, unsigned int mtu,
+		   enum link_layer linklayer, __u64 rate)
+{
+	int i;
+	unsigned int sz;
+	__u64 bps = rate;
+	unsigned int mpu = r->mpu;
+
+	if (mtu == 0)
+		mtu = 2047;
+
+	if (cell_log < 0) {
+		cell_log = 0;
+		while ((mtu >> cell_log) > 255)
+			cell_log++;
+	}
+
+	for (i = 0; i < 256; i++) {
+		sz = tc_adjust_size((i + 1) << cell_log, mpu, linklayer);
+		rtab[i] = tc_calc_xmittime(bps, sz);
+	}
+
+	r->cell_align =  -1;
+	r->cell_log = cell_log;
+	r->linklayer = (linklayer & TC_LINKLAYER_MASK);
+	return cell_log;
+}
+
 /*
    stab[pkt_len>>cell_log] = pkt_xmit_size>>size_log
  */
diff --git a/tc/tc_core.h b/tc/tc_core.h
index bd4a99f..6dab272 100644
--- a/tc/tc_core.h
+++ b/tc/tc_core.h
@@ -21,6 +21,9 @@ unsigned tc_calc_xmittime(__u64 rate, unsigned size);
 unsigned tc_calc_xmitsize(__u64 rate, unsigned ticks);
 int tc_calc_rtable(struct tc_ratespec *r, __u32 *rtab,
 		   int cell_log, unsigned mtu, enum link_layer link_layer);
+int tc_calc_rtable_64(struct tc_ratespec *r, __u32 *rtab,
+			int cell_log, unsigned mtu, enum link_layer link_layer,
+			__u64 rate);
 int tc_calc_size_table(struct tc_sizespec *s, __u16 **stab);
 
 int tc_setup_estimator(unsigned A, unsigned time_const, struct tc_estimator *est);
-- 
1.7.1


^ permalink raw reply related

* [v2] net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate
From: David Dai @ 2019-08-30 19:06 UTC (permalink / raw)
  To: jhs, xiyou.wangcong, jiri, davem, netdev, linux-kernel; +Cc: zdai, zdai

For high speed adapter like Mellanox CX-5 card, it can reach upto
100 Gbits per second bandwidth. Currently htb already supports 64bit rate
in tc utility. However police action rate and peakrate are still limited
to 32bit value (upto 32 Gbits per second). Add 2 new attributes
TCA_POLICE_RATE64 and TCA_POLICE_RATE64 in kernel for 64bit support
so that tc utility can use them for 64bit rate and peakrate value to
break the 32bit limit, and still keep the backward binary compatibility.

Tested-by: David Dai <zdai@linux.vnet.ibm.com>
Signed-off-by: David Dai <zdai@linux.vnet.ibm.com>
---
Changelog:
v1->v2:
 - Move 2 attributes TCA_POLICE_RATE64 TCA_POLICE_PEAKRATE64 after
   TCA_POLICE_PAD in pkt_cls.h header.
---
 include/uapi/linux/pkt_cls.h |    2 ++
 net/sched/act_police.c       |   27 +++++++++++++++++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index b057aee..a6aa466 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -160,6 +160,8 @@ enum {
 	TCA_POLICE_RESULT,
 	TCA_POLICE_TM,
 	TCA_POLICE_PAD,
+	TCA_POLICE_RATE64,
+	TCA_POLICE_PEAKRATE64,
 	__TCA_POLICE_MAX
 #define TCA_POLICE_RESULT TCA_POLICE_RESULT
 };
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 49cec3e..425f2a3 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -40,6 +40,8 @@ static int tcf_police_walker(struct net *net, struct sk_buff *skb,
 	[TCA_POLICE_PEAKRATE]	= { .len = TC_RTAB_SIZE },
 	[TCA_POLICE_AVRATE]	= { .type = NLA_U32 },
 	[TCA_POLICE_RESULT]	= { .type = NLA_U32 },
+	[TCA_POLICE_RATE64]     = { .type = NLA_U64 },
+	[TCA_POLICE_PEAKRATE64] = { .type = NLA_U64 },
 };
 
 static int tcf_police_init(struct net *net, struct nlattr *nla,
@@ -58,6 +60,7 @@ static int tcf_police_init(struct net *net, struct nlattr *nla,
 	struct tcf_police_params *new;
 	bool exists = false;
 	u32 index;
+	u64 rate64, prate64;
 
 	if (nla == NULL)
 		return -EINVAL;
@@ -155,14 +158,18 @@ static int tcf_police_init(struct net *net, struct nlattr *nla,
 	}
 	if (R_tab) {
 		new->rate_present = true;
-		psched_ratecfg_precompute(&new->rate, &R_tab->rate, 0);
+		rate64 = tb[TCA_POLICE_RATE64] ?
+			 nla_get_u64(tb[TCA_POLICE_RATE64]) : 0;
+		psched_ratecfg_precompute(&new->rate, &R_tab->rate, rate64);
 		qdisc_put_rtab(R_tab);
 	} else {
 		new->rate_present = false;
 	}
 	if (P_tab) {
 		new->peak_present = true;
-		psched_ratecfg_precompute(&new->peak, &P_tab->rate, 0);
+		prate64 = tb[TCA_POLICE_PEAKRATE64] ?
+			  nla_get_u64(tb[TCA_POLICE_PEAKRATE64]) : 0;
+		psched_ratecfg_precompute(&new->peak, &P_tab->rate, prate64);
 		qdisc_put_rtab(P_tab);
 	} else {
 		new->peak_present = false;
@@ -313,10 +320,22 @@ static int tcf_police_dump(struct sk_buff *skb, struct tc_action *a,
 				      lockdep_is_held(&police->tcf_lock));
 	opt.mtu = p->tcfp_mtu;
 	opt.burst = PSCHED_NS2TICKS(p->tcfp_burst);
-	if (p->rate_present)
+	if (p->rate_present) {
 		psched_ratecfg_getrate(&opt.rate, &p->rate);
-	if (p->peak_present)
+		if ((police->params->rate.rate_bytes_ps >= (1ULL << 32)) &&
+		    nla_put_u64_64bit(skb, TCA_POLICE_RATE64,
+				      police->params->rate.rate_bytes_ps,
+				      __TCA_POLICE_MAX))
+			goto nla_put_failure;
+	}
+	if (p->peak_present) {
 		psched_ratecfg_getrate(&opt.peakrate, &p->peak);
+		if ((police->params->peak.rate_bytes_ps >= (1ULL << 32)) &&
+		    nla_put_u64_64bit(skb, TCA_POLICE_PEAKRATE64,
+				      police->params->peak.rate_bytes_ps,
+				      __TCA_POLICE_MAX))
+			goto nla_put_failure;
+	}
 	if (nla_put(skb, TCA_POLICE_TBF, sizeof(opt), &opt))
 		goto nla_put_failure;
 	if (p->tcfp_result &&
-- 
1.7.1


^ permalink raw reply related

* Re: [PATCH v6 net-next 02/19] ionic: Add basic framework for IONIC Network device driver
From: Shannon Nelson @ 2019-08-30 19:02 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, davem
In-Reply-To: <20190829153825.396efbf5@cakuba.netronome.com>

On 8/29/19 3:38 PM, Jakub Kicinski wrote:
> On Thu, 29 Aug 2019 11:27:03 -0700, Shannon Nelson wrote:
>> This patch adds a basic driver framework for the Pensando IONIC
>> network device.  There is no functionality right now other than
>> the ability to load and unload.
>>
>> Signed-off-by: Shannon Nelson <snelson@pensando.io>
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
>> new file mode 100644
>> index 000000000000..6892409cd64b
>> --- /dev/null
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
>> @@ -0,0 +1,44 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
>> +
>> +#include <linux/module.h>
>> +#include <linux/netdevice.h>
>> +
>> +#include "ionic.h"
>> +#include "ionic_bus.h"
>> +#include "ionic_devlink.h"
>> +
>> +static int ionic_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
>> +			     struct netlink_ext_ack *extack)
>> +{
>> +	devlink_info_driver_name_put(req, IONIC_DRV_NAME);
> This may fail, should the error not be propagated?

Will fix

>
>> +	return 0;
>> +}
>> +
>> +static const struct devlink_ops ionic_dl_ops = {
>> +	.info_get	= ionic_dl_info_get,
>> +};
>> +
>> +struct ionic *ionic_devlink_alloc(struct device *dev)
>> +{
>> +	struct ionic *ionic;
>> +	struct devlink *dl;
>> +
>> +	dl = devlink_alloc(&ionic_dl_ops, sizeof(struct ionic));
>> +	if (!dl) {
>> +		dev_warn(dev, "devlink_alloc failed");
> missing new line at the end of warning, but the warning is unnecessary,
> if memory allocation fails kernel will generate a big OOM splat, anyway

yep

>
>> +		return NULL;
>> +	}
>> +
>> +	ionic = devlink_priv(dl);
>> +
>> +	return ionic;
> return devlink_priv(dl);

yep

Thanks,
sln

>
>> +}
>> +
>> +void ionic_devlink_free(struct ionic *ionic)
>> +{
>> +	struct devlink *dl = priv_to_devlink(ionic);
>> +
>> +	devlink_free(dl);
>> +}


^ permalink raw reply

* Re: [PATCH bpf-next] tools: libbpf: update extended attributes version of bpf_object__open()
From: Anton Protopopov @ 2019-08-30 18:53 UTC (permalink / raw)
  To: Song Liu
  Cc: Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann, Martin Lau,
	Yonghong Song, Networking, bpf, linux-kernel@vger.kernel.org
In-Reply-To: <796E4DA8-4844-4708-866E-A8AE9477E94E@fb.com>

чт, 29 авг. 2019 г. в 16:02, Song Liu <songliubraving@fb.com>:
>
>
>
> > On Aug 14, 2019, at 5:03 PM, Anton Protopopov <a.s.protopopov@gmail.com> wrote:
> >
>
> [...]
>
> >
> >
> > int bpf_object__unload(struct bpf_object *obj)
> > diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
> > index e8f70977d137..634f278578dd 100644
> > --- a/tools/lib/bpf/libbpf.h
> > +++ b/tools/lib/bpf/libbpf.h
> > @@ -63,8 +63,13 @@ LIBBPF_API libbpf_print_fn_t libbpf_set_print(libbpf_print_fn_t fn);
> > struct bpf_object;
> >
> > struct bpf_object_open_attr {
> > -     const char *file;
> > +     union {
> > +             const char *file;
> > +             const char *obj_name;
> > +     };
> >       enum bpf_prog_type prog_type;
> > +     void *obj_buf;
> > +     size_t obj_buf_sz;
> > };
>
> I think this would break dynamically linked libbpf. No?

Ah, yes, sure. What is the right way to make changes which break ABI in libbpf?

BTW, does the commit ddc7c3042614 ("libbpf: implement BPF CO-RE offset
relocation algorithm") which adds a new field to the struct
bpf_object_load_attr also break ABI?

>
> Thanks,
> Song
>

^ permalink raw reply

* Re: [PATCH] net: bcmgenet: use ethtool_op_get_ts_info()
From: Florian Fainelli @ 2019-08-30 18:51 UTC (permalink / raw)
  To: Ryan M. Collins, Doug Berger, David S. Miller
  Cc: bcm-kernel-feedback-list, netdev, linux-kernel
In-Reply-To: <20190830184955.GA27521@pop-os.localdomain>

On 8/30/19 11:49 AM, Ryan M. Collins wrote:
> This change enables the use of SW timestamping on the Raspberry Pi 4.

Finally the first bcmgenet patch that was tested on the Pi 4!

> 
> bcmgenet's transmit function bcmgenet_xmit() implements software
> timestamping. However the SOF_TIMESTAMPING_TX_SOFTWARE capability was
> missing and only SOF_TIMESTAMPING_RX_SOFTWARE was announced. By using
> ethtool_ops bcmgenet_ethtool_ops() as get_ts_info(), the
> SOF_TIMESTAMPING_TX_SOFTWARE capability is announced.
> 
> Similar to commit a8f5cb9e7991 ("smsc95xx: use ethtool_op_get_ts_info()")
> 
> Signed-off-by: Ryan M. Collins <rmc032@bucknell.edu>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply

* [PATCH] net: bcmgenet: use ethtool_op_get_ts_info()
From: Ryan M. Collins @ 2019-08-30 18:49 UTC (permalink / raw)
  To: Doug Berger, Florian Fainelli, David S. Miller
  Cc: bcm-kernel-feedback-list, netdev, linux-kernel

This change enables the use of SW timestamping on the Raspberry Pi 4.

bcmgenet's transmit function bcmgenet_xmit() implements software
timestamping. However the SOF_TIMESTAMPING_TX_SOFTWARE capability was
missing and only SOF_TIMESTAMPING_RX_SOFTWARE was announced. By using
ethtool_ops bcmgenet_ethtool_ops() as get_ts_info(), the
SOF_TIMESTAMPING_TX_SOFTWARE capability is announced.

Similar to commit a8f5cb9e7991 ("smsc95xx: use ethtool_op_get_ts_info()")

Signed-off-by: Ryan M. Collins <rmc032@bucknell.edu>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 1586316eb6f1..12cb77ef1081 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1124,6 +1124,7 @@ static const struct ethtool_ops bcmgenet_ethtool_ops = {
 	.set_coalesce		= bcmgenet_set_coalesce,
 	.get_link_ksettings	= bcmgenet_get_link_ksettings,
 	.set_link_ksettings	= bcmgenet_set_link_ksettings,
+	.get_ts_info		= ethtool_op_get_ts_info,
 };
 
 /* Power down the unimac, based on mode. */
-- 
2.23.0


^ 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