* Re: [PATCH net-next RFC 5/5] net-timestamp: tx timestamping default mode flag
From: Willem de Bruijn @ 2015-01-12 1:49 UTC (permalink / raw)
To: Richard Cochran
Cc: Network Development, David Miller, Eric Dumazet, Andy Lutomirski
In-Reply-To: <20150111203256.GC4214@localhost.localdomain>
On Sun, Jan 11, 2015 at 3:32 PM, Richard Cochran
<richardcochran@gmail.com> wrote:
> On Fri, Jan 09, 2015 at 12:31:59PM -0500, Willem de Bruijn wrote:
>> From: Willem de Bruijn <willemb@google.com>
>>
>> The number of timestamping points along the transmit path has grown,
>> as have the options. Preferred behavior is to request timestamps with
>> ID, without data (which enables batching) and for all supported
>> timestamp points. Define a short option that enables all these
>> defaults.
>
> This "preferred behavior" is subjective, and it depends on the
> application. I am sure it reflects your own interest, but for people
> doing PTP over UDP or raw, it is a bit misleading.
>
> I would drop this default and just let applications define their own.
Okay. I indeed hadn't considered that use-case.
Just so I understand: ptp has no use for the sw tstamps
that would be generated with this flag, but is otherwise
okay with enabling counters to order tx timestamps
(OPT_ID) and disabling payload (OPT_TSONLY)?
In the documentation, I would like to strongly suggest all
processes to enable these, even in absence of this default.
because that is more robust wrt the sysctl (if merged).
>
> Thanks,
Thanks for taking a look at the patches.
> Richard
^ permalink raw reply
* Re: [PATCH V3 for 3.19] rtlwifi: Fix error when accessing unmapped memory in skb
From: Ben Hutchings @ 2015-01-12 2:12 UTC (permalink / raw)
To: Larry Finger; +Cc: Eric Biggers, kvalo, linux-wireless, netdev, Stable
In-Reply-To: <54A4665A.8090906@lwfinger.net>
[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]
On Wed, 2014-12-31 at 15:10 -0600, Larry Finger wrote:
> On 12/30/2014 11:07 PM, Eric Biggers wrote:
> > On Tue, Dec 30, 2014 at 09:33:07PM -0600, Larry Finger wrote:
> >> v3 - Unmap skb before trying to allocate a new one so as to not leak mapping.
> >
> > Looks good to me, although I'm not sure about the handling of DMA mapping errors
> > (perhaps that's something that drivers typically don't even try to handle?).
> > Anyway, the skb allocation issue appears to be resolved now. I am running your
> > patch with an extra hack to inject some occasional skb allocation failures, and
> > I haven't noticed any problems except dropped packets.
>
> The last time I saw any DMA mapping errors were for some early BCM43xx cards
> that only had 20 bits of DMA addressing space. These Realtek devices have a full
> 32 bits of addressing, thus any physical address in the first 4GB of RAM will be
> OK. I suppose that it might be possible to get a physical address outside this
> range for machines with a lot of RAM, but they are unlikely to have wifi interfaces.
[...]
Really, you don't think laptops and desktops come with 4GB RAM or more?
Besides that, DMA mapping may involve calling an IOMMU driver that may
fail for some reason.
Drivers need to check for DMA mapping errors, it is not optional.
Ben.
--
Ben Hutchings
The world is coming to an end. Please log off.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply
* Re: [PATCH v2 0/6] irda: Use ktime_t instead of timeval
From: David Miller @ 2015-01-12 2:44 UTC (permalink / raw)
To: zhang.chunyan; +Cc: samuel, arnd, zhang.lyra, netdev, linux-kernel
In-Reply-To: <1420689692-8760-1-git-send-email-zhang.chunyan@linaro.org>
From: Chunyan Zhang <zhang.chunyan@linaro.org>
Date: Thu, 8 Jan 2015 12:01:26 +0800
> This patch-set removed all uses of timeval and used ktime_t instead if
> needed, since 32-bit time types will break in the year 2038.
>
> This patch-set also used the ktime_xxx functions accordingly.
> e.g.
> * Used ktime_get to get the current time instead of do_gettimeofday.
> * And, used ktime_us_delta to get the elapsed time directly.
Applied to net-next, thanks.
^ permalink raw reply
* Re: [PATCH] net: dnet: fix dnet_poll()
From: David Miller @ 2015-01-12 2:45 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1421002952.5947.106.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 11 Jan 2015 11:02:32 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> A NAPI poll() handler is supposed to return exactly the budget when/if
> napi_complete() has not been called.
>
> It is also supposed to return number of frames that were received, so
> that netdev_budget can have a meaning.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply
* Re: [PATCH net] alx: fix alx_poll()
From: David Miller @ 2015-01-12 2:46 UTC (permalink / raw)
To: eric.dumazet
Cc: oded.gabbay, johannes.berg, edumazet, netdev, willemb,
John.Bridgman, Dana.Elifaz
In-Reply-To: <1421001138.5947.100.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 11 Jan 2015 10:32:18 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> Commit d75b1ade567f ("net: less interrupt masking in NAPI") uncovered
> wrong alx_poll() behavior.
>
> A NAPI poll() handler is supposed to return exactly the budget when/if
> napi_complete() has not been called.
>
> It is also supposed to return number of frames that were received, so
> that netdev_budget can have a meaning.
>
> Also, in case of TX pressure, we still have to dequeue received
> packets : alx_clean_rx_irq() has to be called even if
> alx_clean_tx_irq(alx) returns false, otherwise device is half duplex.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Fixes: d75b1ade567f ("net: less interrupt masking in NAPI")
> Reported-by: Oded Gabbay <oded.gabbay@amd.com>
> Bisected-by: Oded Gabbay <oded.gabbay@amd.com>
> Tested-by: Oded Gabbay <oded.gabbay@amd.com>
Applied and queued up for -stable, thanks Eric.
^ permalink raw reply
* Re: [PATCH 3/3] x_tables: Factor out 16bit aligment ifname_compare()
From: David Miller @ 2015-01-12 2:50 UTC (permalink / raw)
To: richard
Cc: joe, coreteam, netfilter-devel, linux-kernel, netdev, bhutchings,
john.fastabend, herbert, vyasevic, jiri, vfalico, therbert,
edumazet, yoshfuji, jmorris, kuznet, kadlec, kaber, pablo, kay,
stephen
In-Reply-To: <54B2EE4D.2080802@nod.at>
From: Richard Weinberger <richard@nod.at>
Date: Sun, 11 Jan 2015 22:42:37 +0100
> Joe, I really don't care. This is the least significant
> patch of the series.
> I'll no longer waste my time with that.
If you're not willing to fix stylistic issues now, then nobody should
bother wasting their time on the high level issues of your patch.
Just fix these things now rather than being difficult, this is a part
of patch review that everyone has to do, not just you.
^ permalink raw reply
* Re: [PATCH net] packet: bail out of packet_snd() if L2 header creation fails
From: David Miller @ 2015-01-12 2:54 UTC (permalink / raw)
To: cj; +Cc: willemb, edumazet, dborkman, netdev, linux-kernel
In-Reply-To: <1420999276-28225-1-git-send-email-cj@linux.com>
From: Christoph Jaeger <cj@linux.com>
Date: Sun, 11 Jan 2015 13:01:16 -0500
> Due to a misplaced parenthesis, the expression
>
> (unlikely(offset) < 0),
>
> which expands to
>
> (__builtin_expect(!!(offset), 0) < 0),
>
> never evaluates to true. Therefore, when sending packets with
> PF_PACKET/SOCK_DGRAM, packet_snd() does not abort as intended
> if the creation of the layer 2 header fails.
>
> Spotted by Coverity - CID 1259975 ("Operands don't affect result").
>
> Fixes: 9c7077622dd9 ("packet: make packet_snd fail on len smaller than l2 header")
> Signed-off-by: Christoph Jaeger <cj@linux.com>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH net-next] doc: fix the compile fix of txtimestamp.c
From: David Miller @ 2015-01-12 2:56 UTC (permalink / raw)
To: willemb; +Cc: netdev, xiyou.wangcong, vlee, carlos
In-Reply-To: <1420909698-25025-1-git-send-email-willemb@google.com>
From: Willem de Bruijn <willemb@google.com>
Date: Sat, 10 Jan 2015 12:08:18 -0500
> From: Willem de Bruijn <willemb@google.com>
>
> A fix to ipv6 structure definitions removed the now superfluous
> definition of in6_pktinfo in this file.
>
> But, use of the glibc definition requires defining _GNU_SOURCE
> (see also https://sourceware.org/bugzilla/show_bug.cgi?id=6775).
>
> Before this change, the following would fail for me:
>
> make
> make headers_install
> make M=Documentation/networking/timestamping
>
> with
>
> Documentation/networking/timestamping/txtimestamp.c: In function '__recv_errmsg_cmsg':
> Documentation/networking/timestamping/txtimestamp.c:205:33: error: dereferencing pointer to incomplete type
> Documentation/networking/timestamping/txtimestamp.c:206:23: error: dereferencing pointer to incomplete type
>
> After this patch compilation succeeded.
>
> Fixes: cd91cc5bdddf ("doc: fix the compile error of txtimestamp.c")
> Signed-off-by: Willem de Bruijn <willemb@google.com>
Applied, thanks.
^ permalink raw reply
* linux-next: build failure after merge of the net-next tree
From: Stephen Rothwell @ 2015-01-12 3:05 UTC (permalink / raw)
To: David Miller, netdev; +Cc: linux-next, linux-kernel, WANG Cong, Vinson Lee
[-- Attachment #1: Type: text/plain, Size: 770 bytes --]
Hi all,
After merging the net-next tree, today's linux-next build (x86_64 allmodconfig)
failed like this:
Documentation/networking/timestamping/txtimestamp.c: In function '__recv_errmsg_cmsg':
Documentation/networking/timestamping/txtimestamp.c:205:33: error: dereferencing pointer to incomplete type
Documentation/networking/timestamping/txtimestamp.c:206:23: error: dereferencing pointer to incomplete type
Caused by commit cd91cc5bdddf ("doc: fix the compile error of
txtimestamp.c"). On (at least) Debian stable, the system's definition
of struct in6_pktinfo depends on __USE_GNU being defined (at least, I
think that is the problem).
I have reverted that commit for today.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: linux-next: build failure after merge of the net-next tree
From: David Miller @ 2015-01-12 3:08 UTC (permalink / raw)
To: sfr; +Cc: netdev, linux-next, linux-kernel, xiyou.wangcong, vlee
In-Reply-To: <20150112140515.369eb687@canb.auug.org.au>
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Mon, 12 Jan 2015 14:05:15 +1100
> Hi all,
>
> After merging the net-next tree, today's linux-next build (x86_64 allmodconfig)
> failed like this:
>
> Documentation/networking/timestamping/txtimestamp.c: In function '__recv_errmsg_cmsg':
> Documentation/networking/timestamping/txtimestamp.c:205:33: error: dereferencing pointer to incomplete type
> Documentation/networking/timestamping/txtimestamp.c:206:23: error: dereferencing pointer to incomplete type
>
> Caused by commit cd91cc5bdddf ("doc: fix the compile error of
> txtimestamp.c"). On (at least) Debian stable, the system's definition
> of struct in6_pktinfo depends on __USE_GNU being defined (at least, I
> think that is the problem).
>
> I have reverted that commit for today.
It's fixed as of 5 minutes ago in the net-next tree, sorry for this.
^ permalink raw reply
* Re: linux-next: build failure after merge of the net-next tree
From: Stephen Rothwell @ 2015-01-12 3:12 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-next, linux-kernel, xiyou.wangcong, vlee
In-Reply-To: <20150111.220829.865175509346236586.davem@davemloft.net>
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
Hi David,
On Sun, 11 Jan 2015 22:08:29 -0500 (EST) David Miller <davem@davemloft.net> wrote:
>
> It's fixed as of 5 minutes ago in the net-next tree, sorry for this.
OK, thanks.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* RE: [PATCH] net/fsl: Add mEMAC MDIO support to XGMAC MDIO
From: Shaohui Xie @ 2015-01-12 3:13 UTC (permalink / raw)
To: Emilian Medve, shh.xie@gmail.com, netdev@vger.kernel.org,
davem@davemloft.net
Cc: Andy Fleming
In-Reply-To: <54B035F4.4020804@Freescale.com>
Hello Emil,
> -----Original Message-----
> From: Emil Medve [mailto:Emilian.Medve@Freescale.com]
> Sent: Saturday, January 10, 2015 4:12 AM
> To: shh.xie@gmail.com; netdev@vger.kernel.org; davem@davemloft.net
> Cc: Andy Fleming; Xie Shaohui-B21989
> Subject: Re: [PATCH] net/fsl: Add mEMAC MDIO support to XGMAC MDIO
>
> Hello Shao-Hui,
>
>
> On 01/04/2015 03:36 AM, shh.xie@gmail.com wrote:
> > From: Andy Fleming <afleming@gmail.com>
> >
> > The Freescale mEMAC supports operating at 10/100/1000/10G, and its
> > associated MDIO controller is likewise capable of operating both
> > Clause 22 and Clause 45 MDIO buses. It is nearly identical to the MDIO
> > controller on the XGMAC, so we just modify that driver.
> >
> > Portions of this driver developed by:
> >
> > Sandeep Singh <sandeep@freescale.com>
> > Roy Zang <tie-fei.zang@freescale.com>
> >
> > Signed-off-by: Andy Fleming <afleming@gmail.com>
> > Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
> > ---
> > drivers/net/ethernet/freescale/Kconfig | 3 +-
> > drivers/net/ethernet/freescale/xgmac_mdio.c | 64
> > ++++++++++++++++++++++++-----
> > 2 files changed, 55 insertions(+), 12 deletions(-)
> >
> > ...
> >
> > diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c
> > b/drivers/net/ethernet/freescale/xgmac_mdio.c
> > index a352445..e0fc3d1 100644
> > --- a/drivers/net/ethernet/freescale/xgmac_mdio.c
> > +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
> >
> > ...
> >
> > @@ -123,21 +144,39 @@ static int xgmac_mdio_write(struct mii_bus *bus,
> > int phy_id, int regnum, u16 val static int xgmac_mdio_read(struct
> > mii_bus *bus, int phy_id, int regnum) {
> > struct tgec_mdio_controller __iomem *regs = bus->priv;
> > - uint16_t dev_addr = regnum >> 16;
> > + uint16_t dev_addr;
> > + uint32_t mdio_stat;
> > uint32_t mdio_ctl;
> > uint16_t value;
> > int ret;
> >
> > + mdio_stat = in_be32(®s->mdio_stat);
> > + if (regnum & MII_ADDR_C45) {
> > + dev_addr = (regnum >> 16) & 0x1f;
> > + mdio_stat |= MDIO_STAT_ENC;
> > + } else {
> > + dev_addr = regnum & 0x1f;
> > + mdio_stat = ~MDIO_STAT_ENC;
>
> Shouldn't this be 'mdio_stat &= ~MDIO_STAT_ENC'?
[S.H] You are right! should be "mdio_stat &= ~MDIO_STAT_ENC".
We have this bug for a long time!
I'll post a patch to fix it.
Thanks!
Shaohui
^ permalink raw reply
* [PATCH net-next] r8152: replace tasklet with NAPI
From: Hayes Wang @ 2015-01-12 4:06 UTC (permalink / raw)
To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang
Replace tasklet with NAPI.
Add rx_queue to queue the remaining rx packets if the number of the
rx packets is more than the request from poll().
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 120 ++++++++++++++++++++++++++++++++++--------------
1 file changed, 85 insertions(+), 35 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index b23426e..50387fe 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -27,7 +27,7 @@
#include <linux/usb/cdc.h>
/* Version Information */
-#define DRIVER_VERSION "v1.07.0 (2014/10/09)"
+#define DRIVER_VERSION "v1.08.0 (2015/01/13)"
#define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>"
#define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters"
#define MODULENAME "r8152"
@@ -448,6 +448,7 @@ enum rtl_register_content {
#define RTL8152_RMS (VLAN_ETH_FRAME_LEN + VLAN_HLEN)
#define RTL8153_RMS RTL8153_MAX_PACKET
#define RTL8152_TX_TIMEOUT (5 * HZ)
+#define RTL8152_NAPI_WEIGHT 64
/* rtl8152 flags */
enum rtl8152_flags {
@@ -457,7 +458,7 @@ enum rtl8152_flags {
RTL8152_LINK_CHG,
SELECTIVE_SUSPEND,
PHY_RESET,
- SCHEDULE_TASKLET,
+ SCHEDULE_NAPI,
};
/* Define these values to match your device */
@@ -549,14 +550,14 @@ struct tx_agg {
struct r8152 {
unsigned long flags;
struct usb_device *udev;
- struct tasklet_struct tl;
+ struct napi_struct napi;
struct usb_interface *intf;
struct net_device *netdev;
struct urb *intr_urb;
struct tx_agg tx_info[RTL8152_MAX_TX];
struct rx_agg rx_info[RTL8152_MAX_RX];
struct list_head rx_done, tx_free;
- struct sk_buff_head tx_queue;
+ struct sk_buff_head tx_queue, rx_queue;
spinlock_t rx_lock, tx_lock;
struct delayed_work schedule;
struct mii_if_info mii;
@@ -1062,7 +1063,7 @@ static void read_bulk_callback(struct urb *urb)
spin_lock(&tp->rx_lock);
list_add_tail(&agg->list, &tp->rx_done);
spin_unlock(&tp->rx_lock);
- tasklet_schedule(&tp->tl);
+ napi_schedule(&tp->napi);
return;
case -ESHUTDOWN:
set_bit(RTL8152_UNPLUG, &tp->flags);
@@ -1126,7 +1127,7 @@ static void write_bulk_callback(struct urb *urb)
return;
if (!skb_queue_empty(&tp->tx_queue))
- tasklet_schedule(&tp->tl);
+ napi_schedule(&tp->napi);
}
static void intr_callback(struct urb *urb)
@@ -1245,6 +1246,7 @@ static int alloc_all_mem(struct r8152 *tp)
spin_lock_init(&tp->tx_lock);
INIT_LIST_HEAD(&tp->tx_free);
skb_queue_head_init(&tp->tx_queue);
+ skb_queue_head_init(&tp->rx_queue);
for (i = 0; i < RTL8152_MAX_RX; i++) {
buf = kmalloc_node(agg_buf_sz, GFP_KERNEL, node);
@@ -1649,13 +1651,32 @@ return_result:
return checksum;
}
-static void rx_bottom(struct r8152 *tp)
+static int rx_bottom(struct r8152 *tp, int budget)
{
unsigned long flags;
struct list_head *cursor, *next, rx_queue;
+ int work_done = 0;
+
+ if (!skb_queue_empty(&tp->rx_queue)) {
+ while (work_done < budget) {
+ struct sk_buff *skb = __skb_dequeue(&tp->rx_queue);
+ struct net_device *netdev = tp->netdev;
+ struct net_device_stats *stats = &netdev->stats;
+ unsigned int pkt_len;
+
+ if (!skb)
+ break;
+
+ pkt_len = skb->len;
+ napi_gro_receive(&tp->napi, skb);
+ work_done++;
+ stats->rx_packets++;
+ stats->rx_bytes += pkt_len;
+ }
+ }
if (list_empty(&tp->rx_done))
- return;
+ goto out1;
INIT_LIST_HEAD(&rx_queue);
spin_lock_irqsave(&tp->rx_lock, flags);
@@ -1708,9 +1729,14 @@ static void rx_bottom(struct r8152 *tp)
skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, netdev);
rtl_rx_vlan_tag(rx_desc, skb);
- netif_receive_skb(skb);
- stats->rx_packets++;
- stats->rx_bytes += pkt_len;
+ if (work_done < budget) {
+ napi_gro_receive(&tp->napi, skb);
+ work_done++;
+ stats->rx_packets++;
+ stats->rx_bytes += pkt_len;
+ } else {
+ __skb_queue_tail(&tp->rx_queue, skb);
+ }
find_next_rx:
rx_data = rx_agg_align(rx_data + pkt_len + CRC_SIZE);
@@ -1722,6 +1748,9 @@ find_next_rx:
submit:
r8152_submit_rx(tp, agg, GFP_ATOMIC);
}
+
+out1:
+ return work_done;
}
static void tx_bottom(struct r8152 *tp)
@@ -1761,12 +1790,8 @@ static void tx_bottom(struct r8152 *tp)
} while (res == 0);
}
-static void bottom_half(unsigned long data)
+static void bottom_half(struct r8152 *tp)
{
- struct r8152 *tp;
-
- tp = (struct r8152 *)data;
-
if (test_bit(RTL8152_UNPLUG, &tp->flags))
return;
@@ -1778,12 +1803,28 @@ static void bottom_half(unsigned long data)
if (!netif_carrier_ok(tp->netdev))
return;
- clear_bit(SCHEDULE_TASKLET, &tp->flags);
+ clear_bit(SCHEDULE_NAPI, &tp->flags);
- rx_bottom(tp);
tx_bottom(tp);
}
+static int r8152_poll(struct napi_struct *napi, int budget)
+{
+ struct r8152 *tp = container_of(napi, struct r8152, napi);
+ int work_done;
+
+ work_done = rx_bottom(tp, budget);
+ bottom_half(tp);
+
+ if (work_done < budget) {
+ napi_complete(napi);
+ if (!list_empty(&tp->rx_done))
+ napi_schedule(napi);
+ }
+
+ return work_done;
+}
+
static
int r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg, gfp_t mem_flags)
{
@@ -1810,7 +1851,11 @@ int r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg, gfp_t mem_flags)
spin_lock_irqsave(&tp->rx_lock, flags);
list_add_tail(&agg->list, &tp->rx_done);
spin_unlock_irqrestore(&tp->rx_lock, flags);
- tasklet_schedule(&tp->tl);
+
+ netif_err(tp, rx_err, tp->netdev,
+ "Couldn't submit rx[%p], ret = %d\n", agg, ret);
+
+ napi_schedule(&tp->napi);
}
return ret;
@@ -1929,11 +1974,11 @@ static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb,
if (!list_empty(&tp->tx_free)) {
if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
- set_bit(SCHEDULE_TASKLET, &tp->flags);
+ set_bit(SCHEDULE_NAPI, &tp->flags);
schedule_delayed_work(&tp->schedule, 0);
} else {
usb_mark_last_busy(tp->udev);
- tasklet_schedule(&tp->tl);
+ napi_schedule(&tp->napi);
}
} else if (skb_queue_len(&tp->tx_queue) > tp->tx_qlen) {
netif_stop_queue(netdev);
@@ -2012,6 +2057,7 @@ static int rtl_start_rx(struct r8152 *tp)
{
int i, ret = 0;
+ napi_disable(&tp->napi);
INIT_LIST_HEAD(&tp->rx_done);
for (i = 0; i < RTL8152_MAX_RX; i++) {
INIT_LIST_HEAD(&tp->rx_info[i].list);
@@ -2019,6 +2065,7 @@ static int rtl_start_rx(struct r8152 *tp)
if (ret)
break;
}
+ napi_enable(&tp->napi);
if (ret && ++i < RTL8152_MAX_RX) {
struct list_head rx_queue;
@@ -2049,6 +2096,9 @@ static int rtl_stop_rx(struct r8152 *tp)
for (i = 0; i < RTL8152_MAX_RX; i++)
usb_kill_urb(tp->rx_info[i].urb);
+ while (!skb_queue_empty(&tp->rx_queue))
+ dev_kfree_skb(__skb_dequeue(&tp->rx_queue));
+
return 0;
}
@@ -2884,9 +2934,9 @@ static void set_carrier(struct r8152 *tp)
} else {
if (tp->speed & LINK_STATUS) {
netif_carrier_off(netdev);
- tasklet_disable(&tp->tl);
+ napi_disable(&tp->napi);
tp->rtl_ops.disable(tp);
- tasklet_enable(&tp->tl);
+ napi_enable(&tp->napi);
}
}
tp->speed = speed;
@@ -2919,10 +2969,11 @@ static void rtl_work_func_t(struct work_struct *work)
if (test_bit(RTL8152_SET_RX_MODE, &tp->flags))
_rtl8152_set_rx_mode(tp->netdev);
- if (test_bit(SCHEDULE_TASKLET, &tp->flags) &&
+ /* don't schedule napi before linking */
+ if (test_bit(SCHEDULE_NAPI, &tp->flags) &&
(tp->speed & LINK_STATUS)) {
- clear_bit(SCHEDULE_TASKLET, &tp->flags);
- tasklet_schedule(&tp->tl);
+ clear_bit(SCHEDULE_NAPI, &tp->flags);
+ napi_schedule(&tp->napi);
}
if (test_bit(PHY_RESET, &tp->flags))
@@ -2983,7 +3034,7 @@ static int rtl8152_open(struct net_device *netdev)
res);
free_all_mem(tp);
} else {
- tasklet_enable(&tp->tl);
+ napi_enable(&tp->napi);
}
mutex_unlock(&tp->control);
@@ -2999,7 +3050,7 @@ static int rtl8152_close(struct net_device *netdev)
struct r8152 *tp = netdev_priv(netdev);
int res = 0;
- tasklet_disable(&tp->tl);
+ napi_disable(&tp->napi);
clear_bit(WORK_ENABLE, &tp->flags);
usb_kill_urb(tp->intr_urb);
cancel_delayed_work_sync(&tp->schedule);
@@ -3008,6 +3059,7 @@ static int rtl8152_close(struct net_device *netdev)
res = usb_autopm_get_interface(tp->intf);
if (res < 0) {
rtl_drop_queued_tx(tp);
+ rtl_stop_rx(tp);
} else {
mutex_lock(&tp->control);
@@ -3263,7 +3315,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message)
if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) {
clear_bit(WORK_ENABLE, &tp->flags);
usb_kill_urb(tp->intr_urb);
- tasklet_disable(&tp->tl);
+ napi_disable(&tp->napi);
if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
rtl_stop_rx(tp);
rtl_runtime_suspend_enable(tp, true);
@@ -3271,7 +3323,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message)
cancel_delayed_work_sync(&tp->schedule);
tp->rtl_ops.down(tp);
}
- tasklet_enable(&tp->tl);
+ napi_enable(&tp->napi);
}
out1:
mutex_unlock(&tp->control);
@@ -3855,7 +3907,6 @@ static int rtl8152_probe(struct usb_interface *intf,
if (ret)
goto out;
- tasklet_init(&tp->tl, bottom_half, (unsigned long)tp);
mutex_init(&tp->control);
INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t);
@@ -3891,6 +3942,7 @@ static int rtl8152_probe(struct usb_interface *intf,
set_ethernet_addr(tp);
usb_set_intfdata(intf, tp);
+ netif_napi_add(netdev, &tp->napi, r8152_poll, RTL8152_NAPI_WEIGHT);
ret = register_netdev(netdev);
if (ret != 0) {
@@ -3904,15 +3956,13 @@ static int rtl8152_probe(struct usb_interface *intf,
else
device_set_wakeup_enable(&udev->dev, false);
- tasklet_disable(&tp->tl);
-
netif_info(tp, probe, netdev, "%s\n", DRIVER_VERSION);
return 0;
out1:
+ netif_napi_del(&tp->napi);
usb_set_intfdata(intf, NULL);
- tasklet_kill(&tp->tl);
out:
free_netdev(netdev);
return ret;
@@ -3929,7 +3979,7 @@ static void rtl8152_disconnect(struct usb_interface *intf)
if (udev->state == USB_STATE_NOTATTACHED)
set_bit(RTL8152_UNPLUG, &tp->flags);
- tasklet_kill(&tp->tl);
+ netif_napi_del(&tp->napi);
unregister_netdev(tp->netdev);
tp->rtl_ops.unload(tp);
free_netdev(tp->netdev);
--
2.1.0
^ permalink raw reply related
* Re: [PATCH 0/6] netfilter/ipvs fixes for net
From: David Miller @ 2015-01-12 5:15 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
In-Reply-To: <1420915808-7160-1-git-send-email-pablo@netfilter.org>
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Sat, 10 Jan 2015 19:50:02 +0100
> The following patchset contains netfilter/ipvs fixes, they are:
...
> Note that this batch comes later than usual because of the short
> winter holidays.
>
> You can pull these changes from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git
>
> Have a happy new year, thanks!
Happy new year to you too Pablo!
Pulled, thanks a lot.
^ permalink raw reply
* Re: pull-request: wireless-drivers 2015-01-09
From: David Miller @ 2015-01-12 5:24 UTC (permalink / raw)
To: kvalo-sgV2jX0FEOL9JmXXK+q4OQ
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <87lhlbj4pp.fsf-HodKDYzPHsUD5k0oWYwrnHL1okKdlPRT@public.gmane.org>
From: Kalle Valo <kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Date: Fri, 09 Jan 2015 18:31:30 +0200
> here are few more fixes to 3.19. Please let me know if there are any
> problems.
Pulled, thanks Kalle.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 1/1] csiostor:fix sparse warnings
From: David Miller @ 2015-01-12 5:40 UTC (permalink / raw)
To: praveenm; +Cc: netdev, linux-scsi, JBottomley, hch, hariprasad
In-Reply-To: <1420818916-12185-1-git-send-email-praveenm@chelsio.com>
From: Praveen Madhavan <praveenm@chelsio.com>
Date: Fri, 9 Jan 2015 21:25:16 +0530
> This patch fixes sparse warning reported by kbuild.
> Apply this on net-next since it depends on previous commit.
>
> drivers/scsi/csiostor/csio_hw.c:259:17: sparse: cast to restricted __le32
> drivers/scsi/csiostor/csio_hw.c:536:31: sparse: incorrect type in assignment
> (different base types)
> drivers/scsi/csiostor/csio_hw.c:536:31: expected unsigned int [unsigned]
> [usertype] <noident>
> drivers/scsi/csiostor/csio_hw.c:536:31: got restricted __be32 [usertype]
> <noident>
>>> drivers/scsi/csiostor/csio_hw.c:2012:5: sparse: symbol 'csio_hw_prep_fw' was
> not declared. Should it be static?
>
> Signed-off-by: Praveen Madhavan <praveenm@chelsio.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH net-next] doc: fix the compile fix of txtimestamp.c
From: Cong Wang @ 2015-01-12 5:43 UTC (permalink / raw)
To: Willem de Bruijn
Cc: Linux Kernel Network Developers, David Miller, vlee,
Carlos O'Donell
In-Reply-To: <1420909698-25025-1-git-send-email-willemb@google.com>
On Sat, Jan 10, 2015 at 9:08 AM, Willem de Bruijn <willemb@google.com> wrote:
>
> Due to the many libc headers included in txtimestamp.c, I was unable
> to make it compile cleanly by including the kernel header
> (linux/ipv6.h) first, as opposed to using the libc definition.
>
> Btw, should we add the libc-compat.h directly to that file, as opposed
> to reading it indirectly through linux/in6.h?
>
That seems fine.
Thanks for the fix!
^ permalink raw reply
* [PATCH v5 net-net 0/2] Increase the limit of tuntap queues
From: Pankaj Gupta @ 2015-01-12 6:11 UTC (permalink / raw)
To: linux-kernel, netdev
Cc: davem, jasowang, mst, dgibson, vfalico, edumazet, vyasevic, hkchu,
wuzhy, xemul, therbert, bhutchings, xii, stephen, jiri,
sergei.shtylyov, Pankaj Gupta
Networking under KVM works best if we allocate a per-vCPU rx and tx
queue in a virtual NIC. This requires a per-vCPU queue on the host side.
Modern physical NICs have multiqueue support for large number of queues.
To scale vNIC to run multiple queues parallel to maximum number of vCPU's
we need to increase number of queues support in tuntap.
Changes from v4:
PATCH2: Michael.S.Tsirkin - Updated change comment message.
Changes from v3:
PATCH1: Michael.S.Tsirkin - Some cleanups and updated commit message.
Perf numbers on 10 Gbs NIC
Changes from v2:
PATCH 3: David Miller - flex array adds extra level of indirection
for preallocated array.(dropped, as flow array
is allocated using kzalloc with failover to zalloc).
Changes from v1:
PATCH 2: David Miller - sysctl changes to limit number of queues
not required for unprivileged users(dropped).
Changes from RFC
PATCH 1: Sergei Shtylyov - Add an empty line after declarations.
PATCH 2: Jiri Pirko - Do not introduce new module paramaters.
Michael.S.Tsirkin- We can use sysctl for limiting max number
of queues.
This series is to increase the number of tuntap queues. Original work is being
done by 'jasowang@redhat.com'. I am taking this 'https://lkml.org/lkml/2013/6/19/29'
patch series as a reference. As per discussion in the patch series:
There were two reasons which prevented us from increasing number of tun queues:
- The netdev_queue array in netdevice were allocated through kmalloc, which may
cause a high order memory allocation too when we have several queues.
E.g. sizeof(netdev_queue) is 320, which means a high order allocation would
happens when the device has more than 16 queues.
- We store the hash buckets in tun_struct which results a very large size of
tun_struct, this high order memory allocation fail easily when the memory is
fragmented.
The patch 60877a32bce00041528576e6b8df5abe9251fa73 increases the number of tx
queues. Memory allocation fallback to vzalloc() when kmalloc() fails.
This series tries to address following issues:
- Increase the number of netdev_queue queues for rx similarly its done for tx
queues by falling back to vzalloc() when memory allocation with kmalloc() fails.
- Increase number of queues to 256, maximum number is equal to maximum number
of vCPUS allowed in a guest.
I have also done testing with multiple parallel Netperf sessions for different
combination of queues and CPU's. It seems to be working fine without much increase
in cpu load with increase in number of queues. I also see good increase in throughput
with increase in number of queues. Though i had limitation of 8 physical CPU's.
For this test: Two Hosts(Host1 & Host2) are directly connected with cable
Host1 is running Guest1. Data is sent from Host2 to Guest1 via Host1.
Host kernel: 3.19.0-rc2+, AMD Opteron(tm) Processor 6320
NIC : Emulex Corporation OneConnect 10Gb NIC (be3)
Patch Applied %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle throughput
Single Queue, 2 vCPU's
-------------
Before Patch :all 0.19 0.00 0.16 0.07 0.04 0.10 0.00 0.18 0.00 99.26 57864.18
After Patch :all 0.99 0.00 0.64 0.69 0.07 0.26 0.00 1.58 0.00 95.77 57735.77
With 2 Queues, 2 vCPU's
---------------
Before Patch :all 0.19 0.00 0.19 0.10 0.04 0.11 0.00 0.28 0.00 99.08 63083.09
After Patch :all 0.87 0.00 0.73 0.78 0.09 0.35 0.00 2.04 0.00 95.14 62917.03
With 4 Queues, 4 vCPU's
--------------
Before Patch :all 0.20 0.00 0.21 0.11 0.04 0.12 0.00 0.32 0.00 99.00 80865.06
After Patch :all 0.71 0.00 0.93 0.85 0.11 0.51 0.00 2.62 0.00 94.27 86463.19
With 8 Queues, 8 vCPU's
--------------
Before Patch :all 0.19 0.00 0.18 0.09 0.04 0.11 0.00 0.23 0.00 99.17 86795.31
After Patch :all 0.65 0.00 1.18 0.93 0.13 0.68 0.00 3.38 0.00 93.05 89459.93
With 16 Queues, 8 vCPU's
--------------
After Patch :all 0.61 0.00 1.59 0.97 0.18 0.92 0.00 4.32 0.00 91.41 120951.60
Patches Summary:
net: allow large number of rx queues
tuntap: Increase the number of queues in tun
drivers/net/tun.c | 7 +++----
net/core/dev.c | 13 ++++++++-----
2 files changed, 11 insertions(+), 9 deletions(-)
^ permalink raw reply
* [PATCH v5 net-next 1/2] net: allow large number of rx queues
From: Pankaj Gupta @ 2015-01-12 6:11 UTC (permalink / raw)
To: linux-kernel, netdev
Cc: davem, jasowang, mst, dgibson, vfalico, edumazet, vyasevic, hkchu,
wuzhy, xemul, therbert, bhutchings, xii, stephen, jiri,
sergei.shtylyov, Pankaj Gupta
In-Reply-To: <1421043089-30103-1-git-send-email-pagupta@redhat.com>
netif_alloc_rx_queues() uses kcalloc() to allocate memory
for "struct netdev_queue *_rx" array.
If we are doing large rx queue allocation kcalloc() might
fail, so this patch does a fallback to vzalloc().
Similar implementation is done for tx queue allocation in
netif_alloc_netdev_queues().
We avoid failure of high order memory allocation
with the help of vzalloc(), this allows us to do large
rx and tx queue allocation which in turn helps us to
increase the number of queues in tun.
As vmalloc() adds overhead on a critical network path,
__GFP_REPEAT flag is used with kzalloc() to do this fallback
only when really needed.
Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: David Gibson <dgibson@redhat.com>
---
net/core/dev.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 1ab168e..954591a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6145,13 +6145,16 @@ static int netif_alloc_rx_queues(struct net_device *dev)
{
unsigned int i, count = dev->num_rx_queues;
struct netdev_rx_queue *rx;
+ size_t sz = count * sizeof(*rx);
BUG_ON(count < 1);
- rx = kcalloc(count, sizeof(struct netdev_rx_queue), GFP_KERNEL);
- if (!rx)
- return -ENOMEM;
-
+ rx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT);
+ if (!rx) {
+ rx = vzalloc(sz);
+ if (!rx)
+ return -ENOMEM;
+ }
dev->_rx = rx;
for (i = 0; i < count; i++)
@@ -6781,7 +6784,7 @@ void free_netdev(struct net_device *dev)
netif_free_tx_queues(dev);
#ifdef CONFIG_SYSFS
- kfree(dev->_rx);
+ kvfree(dev->_rx);
#endif
kfree(rcu_dereference_protected(dev->ingress_queue, 1));
--
1.8.3.1
^ permalink raw reply related
* [PATCH v5 net-next 2/2] tuntap: Increase the number of queues in tun.
From: Pankaj Gupta @ 2015-01-12 6:11 UTC (permalink / raw)
To: linux-kernel, netdev
Cc: davem, jasowang, mst, dgibson, vfalico, edumazet, vyasevic, hkchu,
wuzhy, xemul, therbert, bhutchings, xii, stephen, jiri,
sergei.shtylyov, Pankaj Gupta
In-Reply-To: <1421043089-30103-1-git-send-email-pagupta@redhat.com>
Networking under kvm works best if we allocate a per-vCPU RX and TX
queue in a virtual NIC. This requires a per-vCPU queue on the host side.
It is now safe to increase the maximum number of queues.
Preceding patch: 'net: allow large number of rx queues'
made sure this won't cause failures due to high order memory
allocations. Increase it to 256: this is the max number of vCPUs
KVM supports.
Size of tun_struct changes from 8512 to 10496 after this patch. This keeps
pages allocated for tun_struct before and after the patch to 3.
Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
Reviewed-by: David Gibson <dgibson@redhat.com>
---
drivers/net/tun.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index e3fa65a..a3f13f7 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -113,10 +113,9 @@ struct tap_filter {
unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN];
};
-/* DEFAULT_MAX_NUM_RSS_QUEUES were chosen to let the rx/tx queues allocated for
- * the netdevice to be fit in one page. So we can make sure the success of
- * memory allocation. TODO: increase the limit. */
-#define MAX_TAP_QUEUES DEFAULT_MAX_NUM_RSS_QUEUES
+/* MAX_TAP_QUEUES 256 is chosen to allow rx/tx queues to be equal
+ * to max number of VCPUs in guest. */
+#define MAX_TAP_QUEUES 256
#define MAX_TAP_FLOWS 4096
#define TUN_FLOW_EXPIRE (3 * HZ)
--
1.8.3.1
^ permalink raw reply related
* [PATCH] brcmfmac: avoid duplicated suspend/resume operation
From: Fu, Zhonghui @ 2015-01-12 6:41 UTC (permalink / raw)
To: brudley, arend@broadcom.com >> Arend van Spriel, Franky Lin,
meuleman, kvalo, linville, pieterpg, hdegoede, wens,
linux-wireless, brcm80211-dev-list, netdev,
linux-kernel@vger.kernel.org
>From 8685c3c2746b4275fc808d9db23c364b2f54b52a Mon Sep 17 00:00:00 2001
From: Zhonghui Fu <zhonghui.fu@linux.intel.com>
Date: Mon, 12 Jan 2015 14:25:46 +0800
Subject: [PATCH] brcmfmac: avoid duplicated suspend/resume operation
WiFi chip has 2 SDIO functions, and PM core will trigger
twice suspend/resume operations for one WiFi chip to do
the same things. This patch avoid this case.
Acked-by: Arend van Spriel<arend@broadcom.com>
Acked-by: Sergei Shtylyov<sergei.shtylyov@cogentembedded.com>
Signed-off-by: Zhonghui Fu <zhonghui.fu@linux.intel.com>
---
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index 9880dae..8f71485 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -1070,7 +1070,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
*/
if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
- (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
+ (sdiodev->pdata->oob_irq_supported)))
bus_if->wowl_supported = true;
#endif
@@ -1139,11 +1139,17 @@ void brcmf_sdio_wowl_config(struct device *dev, bool enabled)
static int brcmf_ops_sdio_suspend(struct device *dev)
{
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
- struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+ struct brcmf_sdio_dev *sdiodev;
mmc_pm_flag_t sdio_flags;
+ struct sdio_func *func = dev_to_sdio_func(dev);
brcmf_dbg(SDIO, "Enter\n");
+ if (func->num == 2)
+ return 0;
+
+ sdiodev = bus_if->bus_priv.sdio;
+
atomic_set(&sdiodev->suspend, true);
if (sdiodev->wowl_enabled) {
@@ -1164,10 +1170,17 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
static int brcmf_ops_sdio_resume(struct device *dev)
{
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
- struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+ struct brcmf_sdio_dev *sdiodev;
+ struct sdio_func *func = dev_to_sdio_func(dev);
brcmf_dbg(SDIO, "Enter\n");
- if (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)
+
+ if (func->num == 2)
+ return 0;
+
+ sdiodev = bus_if->bus_priv.sdio;
+
+ if (sdiodev->pdata->oob_irq_supported)
disable_irq_wake(sdiodev->pdata->oob_irq_nr);
brcmf_sdio_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS);
atomic_set(&sdiodev->suspend, false);
-- 1.7.1
^ permalink raw reply related
* Re: [PATCH] brcmfmac: avoid duplicated suspend/resume operation
From: Fu, Zhonghui @ 2015-01-12 6:43 UTC (permalink / raw)
To: Arend van Spriel
Cc: brudley, Franky Lin, meuleman, kvalo, linville, pieterpg,
hdegoede, wens, linux-wireless, brcm80211-dev-list, netdev,
linux-kernel
In-Reply-To: <54AA6BEB.9060207@broadcom.com>
I sent a new version of this patch in another mail.
Thanks,
Zhonghui
On 2015/1/5 18:48, Arend van Spriel wrote:
> On 01/05/15 03:34, Fu, Zhonghui wrote:
>> Hi Arend,
>>
>> Where to find your patch for this?
>
> Well, we did not submit it. Hence my "Acked-by:" to your patch below.
>
> Regards,
> Arend
>
>>
>> Thanks,
>> Zhonghui
>>
>> On 2014/12/31 17:56, Arend van Spriel wrote:
>>> On 12/31/14 09:20, Fu, Zhonghui wrote:
>>>> From e34419970a07bfcd365f9c66bdfa552188a0cd26 Mon Sep 17 00:00:00 2001
>>>> From: Zhonghui Fu<zhonghui.fu@linux.intel.com>
>>>> Date: Mon, 29 Dec 2014 21:25:31 +0800
>>>> Subject: [PATCH] brcmfmac: avoid duplicated suspend/resume operation
>>>>
>>>> WiFi chip has 2 SDIO functions, and PM core will trigger
>>>> twice suspend/resume operations for one WiFi chip to do
>>>> the same things. This patch avoid this case.
>>>
>>> We have a patch queued up for this as well, but this one looks good enough although I personally prefer container_of() instead of dev_to_sdio_func().
>>>
>>> Acked-by: Arend van Spriel<arend@broadcom.com>
>>>> Signed-off-by: Zhonghui Fu<zhonghui.fu@linux.intel.com>
>>>> ---
>>>> drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 19 +++++++++++++++++--
>>>> 1 files changed, 17 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
>>>> index 3c06e93..eee7818 100644
>>>> --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
>>>> +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
>>>> @@ -1139,11 +1139,18 @@ void brcmf_sdio_wowl_config(struct device *dev, bool enabled)
>>>> static int brcmf_ops_sdio_suspend(struct device *dev)
>>>> {
>>>> struct brcmf_bus *bus_if = dev_get_drvdata(dev);
>>>> - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
>>>> + struct brcmf_sdio_dev *sdiodev;
>>>> mmc_pm_flag_t sdio_flags;
>>>> + struct sdio_func *func = dev_to_sdio_func(dev);
>>>>
>>>> brcmf_dbg(SDIO, "Enter\n");
>>>>
>>>> + if (func->num == 2) {
>>>> + return 0;
>>>> + }
>>>> +
>>>> + sdiodev = bus_if->bus_priv.sdio;
>>>> +
>>>> atomic_set(&sdiodev->suspend, true);
>>>>
>>>> if (sdiodev->wowl_enabled) {
>>>> @@ -1164,9 +1171,17 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
>>>> static int brcmf_ops_sdio_resume(struct device *dev)
>>>> {
>>>> struct brcmf_bus *bus_if = dev_get_drvdata(dev);
>>>> - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
>>>> + struct brcmf_sdio_dev *sdiodev;
>>>> + struct sdio_func *func = dev_to_sdio_func(dev);
>>>>
>>>> brcmf_dbg(SDIO, "Enter\n");
>>>> +
>>>> + if (func->num == 2) {
>>>> + return 0;
>>>> + }
>>>> +
>>>> + sdiodev = bus_if->bus_priv.sdio;
>>>> +
>>>> if (sdiodev->pdata->oob_irq_supported)
>>>> disable_irq_wake(sdiodev->pdata->oob_irq_nr);
>>>> brcmf_sdio_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS);
>>>> -- 1.7.1
>>>>
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH net-next v2 0/3] remove nl_sk_hash_lock from netlink socket
From: Ying Xue @ 2015-01-12 6:52 UTC (permalink / raw)
To: tgraf; +Cc: davem, netdev
After tipc socket successfully avoids the involvement of an extra lock
with rhashtable_lookup_insert(), it's possible for netlink socket to
remove its hash socket lock now. But as netlink socket needs a compare
function to look for an object, we first introduce a new function
called rhashtable_lookup_compare_insert() in commit #1 which is
implemented based on original rhashtable_lookup_insert(). We
subsequently remove nl_sk_hash_lock from netlink socket with the new
introduced function in commit #2. Lastly, as Thomas requested, we add
commit #3 to indicate the implementation of what the grow and shrink
decision function must enforce min/max shift.
v2:
As Thomas pointed out, there was a race between checking portid and
then setting it in commit #2. Now use socket lock to make the process
of both checking and setting portid atomic, and then eliminate the
race.
Ying Xue (3):
rhashtable: involve rhashtable_lookup_compare_insert routine
netlink: eliminate nl_sk_hash_lock
rhashtable: add a note for grow and shrink decision functions
include/linux/rhashtable.h | 9 +++++++++
lib/rhashtable.c | 42 ++++++++++++++++++++++++++++++++++++++++--
net/netlink/af_netlink.c | 33 ++++++++++++++++++++-------------
net/netlink/af_netlink.h | 1 -
net/netlink/diag.c | 10 +++++-----
5 files changed, 74 insertions(+), 21 deletions(-)
--
1.7.9.5
^ permalink raw reply
* [PATCH net-next v2 1/3] rhashtable: involve rhashtable_lookup_compare_insert routine
From: Ying Xue @ 2015-01-12 6:52 UTC (permalink / raw)
To: tgraf; +Cc: davem, netdev
In-Reply-To: <1421045544-13670-1-git-send-email-ying.xue@windriver.com>
Introduce a new function called rhashtable_lookup_compare_insert()
which is very similar to rhashtable_lookup_insert(). But the former
makes use of users' given compare function to look for an object,
and then inserts it into hash table if found. As the entire process
of search and insertion is under protection of per bucket lock, this
can help users to avoid the involvement of extra lock.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Cc: Thomas Graf <tgraf@suug.ch>
Acked-by: Thomas Graf <tgraf@suug.ch>
---
include/linux/rhashtable.h | 5 +++++
lib/rhashtable.c | 42 ++++++++++++++++++++++++++++++++++++++++--
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 326acd8..7b9bd77 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -168,7 +168,12 @@ int rhashtable_shrink(struct rhashtable *ht);
void *rhashtable_lookup(struct rhashtable *ht, const void *key);
void *rhashtable_lookup_compare(struct rhashtable *ht, const void *key,
bool (*compare)(void *, void *), void *arg);
+
bool rhashtable_lookup_insert(struct rhashtable *ht, struct rhash_head *obj);
+bool rhashtable_lookup_compare_insert(struct rhashtable *ht,
+ struct rhash_head *obj,
+ bool (*compare)(void *, void *),
+ void *arg);
void rhashtable_destroy(struct rhashtable *ht);
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 8023b55..ed6ae1a 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -727,6 +727,43 @@ EXPORT_SYMBOL_GPL(rhashtable_lookup_compare);
*/
bool rhashtable_lookup_insert(struct rhashtable *ht, struct rhash_head *obj)
{
+ struct rhashtable_compare_arg arg = {
+ .ht = ht,
+ .key = rht_obj(ht, obj) + ht->p.key_offset,
+ };
+
+ BUG_ON(!ht->p.key_len);
+
+ return rhashtable_lookup_compare_insert(ht, obj, &rhashtable_compare,
+ &arg);
+}
+EXPORT_SYMBOL_GPL(rhashtable_lookup_insert);
+
+/**
+ * rhashtable_lookup_compare_insert - search and insert object to hash table
+ * with compare function
+ * @ht: hash table
+ * @obj: pointer to hash head inside object
+ * @compare: compare function, must return true on match
+ * @arg: argument passed on to compare function
+ *
+ * Locks down the bucket chain in both the old and new table if a resize
+ * is in progress to ensure that writers can't remove from the old table
+ * and can't insert to the new table during the atomic operation of search
+ * and insertion. Searches for duplicates in both the old and new table if
+ * a resize is in progress.
+ *
+ * Lookups may occur in parallel with hashtable mutations and resizing.
+ *
+ * Will trigger an automatic deferred table resizing if the size grows
+ * beyond the watermark indicated by grow_decision() which can be passed
+ * to rhashtable_init().
+ */
+bool rhashtable_lookup_compare_insert(struct rhashtable *ht,
+ struct rhash_head *obj,
+ bool (*compare)(void *, void *),
+ void *arg)
+{
struct bucket_table *new_tbl, *old_tbl;
spinlock_t *new_bucket_lock, *old_bucket_lock;
u32 new_hash, old_hash;
@@ -747,7 +784,8 @@ bool rhashtable_lookup_insert(struct rhashtable *ht, struct rhash_head *obj)
if (unlikely(old_tbl != new_tbl))
spin_lock_bh_nested(new_bucket_lock, RHT_LOCK_NESTED);
- if (rhashtable_lookup(ht, rht_obj(ht, obj) + ht->p.key_offset)) {
+ if (rhashtable_lookup_compare(ht, rht_obj(ht, obj) + ht->p.key_offset,
+ compare, arg)) {
success = false;
goto exit;
}
@@ -763,7 +801,7 @@ exit:
return success;
}
-EXPORT_SYMBOL_GPL(rhashtable_lookup_insert);
+EXPORT_SYMBOL_GPL(rhashtable_lookup_compare_insert);
static size_t rounded_hashtable_size(struct rhashtable_params *params)
{
--
1.7.9.5
^ permalink raw reply related
* [PATCH net-next v2 3/3] rhashtable: add a note for grow and shrink decision functions
From: Ying Xue @ 2015-01-12 6:52 UTC (permalink / raw)
To: tgraf; +Cc: davem, netdev
In-Reply-To: <1421045544-13670-1-git-send-email-ying.xue@windriver.com>
As commit c0c09bfdc415 ("rhashtable: avoid unnecessary wakeup for
worker queue") moves condition statements of verifying whether hash
table size exceeds its maximum threshold or reaches its minimum
threshold from resizing functions to resizing decision functions,
we should add a note in rhashtable.h to indicate the implementation
of what the grow and shrink decision function must enforce min/max
shift, otherwise, it's failed to take min/max shift's set watermarks
into effect.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Cc: Thomas Graf <tgraf@suug.ch>
Acked-by: Thomas Graf <tgraf@suug.ch>
---
include/linux/rhashtable.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 7b9bd77..9570832 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -79,6 +79,10 @@ struct rhashtable;
* @obj_hashfn: Function to hash object
* @grow_decision: If defined, may return true if table should expand
* @shrink_decision: If defined, may return true if table should shrink
+ *
+ * Note: when implementing the grow and shrink decision function, min/max
+ * shift must be enforced, otherwise, resizing watermarks they set may be
+ * useless.
*/
struct rhashtable_params {
size_t nelem_hint;
--
1.7.9.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox