* [PATCH net-next] bnx2x: Fix sparse warnings
From: Yuval Mintz @ 2014-08-28 5:07 UTC (permalink / raw)
To: davem, netdev; +Cc: Yuval Mintz, Ariel Elior
This fixes a sprase warning introduced recently by commit
eeed018cbfa30 ("bnx2x: Add timestamping and PTP hardware clock support"),
as well as another unrelated sparse endian issue.
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
---
Hi Dave,
Please consider applying this to `net-next'.
Thanks,
Yuval Mintz
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 +-
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index a54ac45..06d6d3c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -1065,7 +1065,7 @@ reuse_rx:
skb_record_rx_queue(skb, fp->rx_queue);
/* Check if this packet was timestamped */
- if (unlikely(le16_to_cpu(cqe->fast_path_cqe.type_error_flags) &
+ if (unlikely(cqe->fast_path_cqe.type_error_flags &
(1 << ETH_FAST_PATH_RX_CQE_PTP_PKT_SHIFT)))
bnx2x_set_rx_ts(bp, skb);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 38acecd..19d0c11 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -4063,6 +4063,13 @@ static int bnx2x_setup_rss(struct bnx2x *bp,
if (test_bit(BNX2X_RSS_GRE_INNER_HDRS, &p->rss_flags))
caps |= ETH_RSS_UPDATE_RAMROD_DATA_GRE_INNER_HDRS_CAPABILITY;
+ /* RSS keys */
+ if (test_bit(BNX2X_RSS_SET_SRCH, &p->rss_flags)) {
+ memcpy(&data->rss_key[0], &p->rss_key[0],
+ sizeof(data->rss_key));
+ caps |= ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY;
+ }
+
data->capabilities = cpu_to_le16(caps);
/* Hashing mask */
@@ -4084,13 +4091,6 @@ static int bnx2x_setup_rss(struct bnx2x *bp,
if (netif_msg_ifup(bp))
bnx2x_debug_print_ind_table(bp, p);
- /* RSS keys */
- if (test_bit(BNX2X_RSS_SET_SRCH, &p->rss_flags)) {
- memcpy(&data->rss_key[0], &p->rss_key[0],
- sizeof(data->rss_key));
- data->capabilities |= ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY;
- }
-
/* No need for an explicit memory barrier here as long as we
* ensure the ordering of writing to the SPQ element
* and updating of the SPQ producer which involves a memory
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2 net-next 1/9] net: Allocate a new 16 bits for flags in skbuff
From: Tom Herbert @ 2014-08-28 4:48 UTC (permalink / raw)
To: davem, netdev
Signed-off-by: Tom Herbert <therbert@google.com>
---
include/linux/skbuff.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index b69b7b5..3c9574c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -598,6 +598,10 @@ struct sk_buff {
__u32 reserved_tailroom;
};
+ kmemcheck_bitfield_begin(flags3);
+ /* 16 bit hole */
+ kmemcheck_bitfield_end(flags3);
+
__be16 inner_protocol;
__u16 inner_transport_header;
__u16 inner_network_header;
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related
* [PATCH (net-next) v3] net: stmmac: fix warning from Sparse for socfpga
From: Ley Foon Tan @ 2014-08-28 4:59 UTC (permalink / raw)
To: netdev, linux-kernel, David S. Miller
Cc: Ley Foon Tan, lftan.linux, Giuseppe Cavallaro, Vince Bridgers
Warning:
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:122:41:
sparse: cast removes address space of expression
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:122:38:
sparse: incorrect type in assignment (different address spaces)
Signed-off-by: Ley Foon Tan <lftan@altera.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index cd613d7..ddc6115 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -119,8 +119,7 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
return -EINVAL;
}
- dwmac->splitter_base = (void *)devm_ioremap_resource(dev,
- &res_splitter);
+ dwmac->splitter_base = devm_ioremap_resource(dev, &res_splitter);
if (!dwmac->splitter_base) {
dev_info(dev, "Failed to mapping emac splitter\n");
return -EINVAL;
--
1.8.2.1
^ permalink raw reply related
* [PATCH v2 net-next 1/9] net: Allocate a new 16 bits for flags in skbuff
From: Tom Herbert @ 2014-08-28 4:26 UTC (permalink / raw)
To: davem, netdev
Signed-off-by: Tom Herbert <therbert@google.com>
---
include/linux/skbuff.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index b69b7b5..3c9574c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -598,6 +598,10 @@ struct sk_buff {
__u32 reserved_tailroom;
};
+ kmemcheck_bitfield_begin(flags3);
+ /* 16 bit hole */
+ kmemcheck_bitfield_end(flags3);
+
__be16 inner_protocol;
__u16 inner_transport_header;
__u16 inner_network_header;
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related
* [PATCH v2 net-next 5/9] benet: Set skb->csum_level for encapsulated checksum
From: Tom Herbert @ 2014-08-28 4:27 UTC (permalink / raw)
To: davem, netdev
Set skb->csum_level instead of skb->encapsulation when indicating
CHECKSUM_UNNECESSARY for an encapsulated checksum.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 93ff8ef..f69fa99 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1683,7 +1683,7 @@ static void be_rx_compl_process(struct be_rx_obj *rxo, struct napi_struct *napi,
if (netdev->features & NETIF_F_RXHASH)
skb_set_hash(skb, rxcp->rss_hash, PKT_HASH_TYPE_L3);
- skb->encapsulation = rxcp->tunneled;
+ skb->csum_level = rxcp->tunneled;
skb_mark_napi_id(skb, napi);
if (rxcp->vlanf)
@@ -1741,7 +1741,7 @@ static void be_rx_compl_process_gro(struct be_rx_obj *rxo,
if (adapter->netdev->features & NETIF_F_RXHASH)
skb_set_hash(skb, rxcp->rss_hash, PKT_HASH_TYPE_L3);
- skb->encapsulation = rxcp->tunneled;
+ skb->csum_level = rxcp->tunneled;
skb_mark_napi_id(skb, napi);
if (rxcp->vlanf)
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related
* [PATCH v2 net-next 0/8] net: Checksum offload changes - Part VI
From: Tom Herbert @ 2014-08-28 4:26 UTC (permalink / raw)
To: davem, netdev
I am working on overhauling RX checksum offload. Goals of this effort
are:
- Specify what exactly it means when driver returns CHECKSUM_UNNECESSARY
- Preserve CHECKSUM_COMPLETE through encapsulation layers
- Don't do skb_checksum more than once per packet
- Unify GRO and non-GRO csum verification as much as possible
- Unify the checksum functions (checksum_init)
- Simplify code
What is in this sixth patch set:
- Clarify the specific requirements of devices returning
CHECKSUM_UNNECESSARY (comments in skbuff.h).
- Add csum_level field to skbuff. This is used to express how
many checksums are covered by CHECKSUM_UNNECESSARY (stores n - 1).
- Change __skb_checksum_validate_needed to "consume" each checksum
as indicated by csum_level as layers of the the packet are parsed.
- Remove skb_pop_rcv_encapsulation, no longer needed in the new
csum_level model.
- Allow GRO path to "consume" checksums provided in CHECKSUM_UNNECESSARY
and to report new verfied checksums for use in normal path fallback.
- Add proper support to SCTP to accept CHECKSUM_UNNECESSARY to validate
header CRC.
- Modify drivers to set skb->csum_level instead of setting
skb->encapsulation to indicate validation of an encapsulated
checksum on receive.
v2:
Allocate a new 16 bits for flags in skbuff.
Please review carefully and test if possible, mucking with basic
checksum functions is always a little precarious :-)
----
Test results with this patch set are below. I did not see any
obvious performace regression.
Tests run:
TCP_STREAM: super_netperf with 200 streams
TCP_RR: super_netperf with 200 streams and -r 1,1
Device bnx2x (10Gbps):
No GRE RSS hash (RX interrupts occur on one core)
UDP RSS port hashing enabled.
* GRE with checksum with IPv4 encapsulated packets
With fix:
TCP_STREAM
12.56% CPU utilization
9341.21 Mbps
TCP_RR
90.96% CPU utilization
155/230/367 90/95/99% latencies
1.18032e+06 tps
Without fix:
TCP_STREAM
12.09% CPU utilization
9330.38 Mbps
TCP_RR
91.91% CPU utilization
155/231/369 90/95/99% latencies
1.17714e+06 tps
* GRE without checksum with IPv4 encapsulated packets
With fix:
TCP_STREAM
18.53% CPU utilization
9320.57 Mbps
TCP_RR
89.23% CPU utilization
157/229/365 90/95/99% latencies
1.17998e+06 tps
Without fix:
TCP_STREAM
18.4% CPU utilization
9240.72 Mbps
TCP_RR
91.61% CPU utilization
158/235/370 90/95/99% latencies
1.17375e+06 tps
* VXLAN with checksum
With fix:
TCP_STREAM
19.90% CPU utilization
9094.12 Mbps
TCP_RR
94.62% CPU utilization
152/245/459 90/95/99% latencies
1.18346e+06 tps
Without fix:
TCP_STREAM
20.68% CPU utilization
9175.63 Mbps
TCP_RR
95.15% CPU utilization
151/243/459 90/95/99% latencies
1.17244e+06 tps
* VXLAN with checksum
With fix:
TCP_STREAM
23.97% CPU utilization
9086.91 Mbps
TCP_RR
92.45% CPU utilization
154/241/436 90/95/99% latencies
1.17305e+06 tps
Without fix:
TCP_STREAM
24.02% CPU utilization
9084.82 Mbps
TCP_RR
94.1% CPU utilization
154/244/449 90/95/99% latencies
1.16107e+06 tps
^ permalink raw reply
* [PATCH v2 net-next 9/9] qlcnic: Set skb->csum_level for encapsulated checksum
From: Tom Herbert @ 2014-08-28 4:28 UTC (permalink / raw)
To: davem, netdev
Set skb->csum_level instead of skb->encapsulation when indicating
CHECKSUM_UNNECESSARY for an encapsulated checksum.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index e45bf09..18e5de7 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -1753,7 +1753,7 @@ qlcnic_83xx_process_rcv(struct qlcnic_adapter *adapter,
if (qlcnic_encap_length(sts_data[1]) &&
skb->ip_summed == CHECKSUM_UNNECESSARY) {
- skb->encapsulation = 1;
+ skb->csum_level = 1;
adapter->stats.encap_rx_csummed++;
}
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related
* [PATCH v2 net-next 7/9] i40evf: Set skb->csum_level for encapsulated checksum
From: Tom Herbert @ 2014-08-28 4:27 UTC (permalink / raw)
To: davem, netdev
Set skb->csum_level instead of skb->encapsulation when indicating
CHECKSUM_UNNECESSARY for an encapsulated checksum.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index 79bf96c..7232f265 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -744,7 +744,6 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
ipv6_tunnel = (rx_ptype > I40E_RX_PTYPE_GRENAT6_MAC_PAY3) &&
(rx_ptype < I40E_RX_PTYPE_GRENAT6_MACVLAN_IPV6_ICMP_PAY4);
- skb->encapsulation = ipv4_tunnel || ipv6_tunnel;
skb->ip_summed = CHECKSUM_NONE;
/* Rx csum enabled and ip headers found? */
@@ -818,6 +817,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
}
skb->ip_summed = CHECKSUM_UNNECESSARY;
+ skb->csum_level = ipv4_tunnel || ipv6_tunnel;
return;
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related
* [PATCH] net: attempt a single high order allocation
From: Eric Dumazet @ 2014-08-28 3:49 UTC (permalink / raw)
To: David Rientjes, David Miller; +Cc: netdev
In-Reply-To: <1409154398.3173.69.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <edumazet@google.com>
In commit ed98df3361f0 ("net: use __GFP_NORETRY for high order
allocations") we tried to address one issue caused by order-3
allocations.
We still observe high latencies and system overhead in situations where
compaction is not successful.
Instead of trying order-3, order-2, and order-1, do a single order-3
best effort and immediately fallback to plain order-0.
This mimics slub strategy to fallback to slab min order if the high
order allocation used for performance failed.
Order-3 allocations give a performance boost only if they can be done
without recurring and expensive memory scan.
Quoting David :
The page allocator relies on synchronous (sync light) memory compaction
after direct reclaim for allocations that don't retry and deferred
compaction doesn't work with this strategy because the allocation order
is always decreasing from the previous failed attempt.
This means sync light compaction will always be encountered if memory
cannot be defragmented or reclaimed several times during the
skb_page_frag_refill() iteration.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: David Rientjes <rientjes@google.com>
---
net/core/sock.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index 2714811afbd8..29870571c42f 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1822,6 +1822,9 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
order);
if (page)
goto fill_page;
+ /* Do not retry other high order allocations */
+ order = 1;
+ max_page_order = 0;
}
order--;
}
@@ -1869,10 +1872,8 @@ EXPORT_SYMBOL(sock_alloc_send_skb);
* no guarantee that allocations succeed. Therefore, @sz MUST be
* less or equal than PAGE_SIZE.
*/
-bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio)
+bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp)
{
- int order;
-
if (pfrag->page) {
if (atomic_read(&pfrag->page->_count) == 1) {
pfrag->offset = 0;
@@ -1883,20 +1884,21 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio)
put_page(pfrag->page);
}
- order = SKB_FRAG_PAGE_ORDER;
- do {
- gfp_t gfp = prio;
-
- if (order)
- gfp |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY;
- pfrag->page = alloc_pages(gfp, order);
+ pfrag->offset = 0;
+ if (SKB_FRAG_PAGE_ORDER) {
+ pfrag->page = alloc_pages(gfp | __GFP_COMP |
+ __GFP_NOWARN | __GFP_NORETRY,
+ SKB_FRAG_PAGE_ORDER);
if (likely(pfrag->page)) {
- pfrag->offset = 0;
- pfrag->size = PAGE_SIZE << order;
+ pfrag->size = PAGE_SIZE << SKB_FRAG_PAGE_ORDER;
return true;
}
- } while (--order >= 0);
-
+ }
+ pfrag->page = alloc_page(gfp);
+ if (likely(pfrag->page)) {
+ pfrag->size = PAGE_SIZE;
+ return true;
+ }
return false;
}
EXPORT_SYMBOL(skb_page_frag_refill);
^ permalink raw reply related
* Re: [PATCH] net: stmmac: fix warning from Sparse for socfpga
From: Ley Foon Tan @ 2014-08-28 3:33 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-kernel@vger.kernel.org, Giuseppe Cavallaro,
Vince Bridgers
In-Reply-To: <20140827.163343.715764078341662382.davem@davemloft.net>
On Thu, Aug 28, 2014 at 7:33 AM, David Miller <davem@davemloft.net> wrote:
> From: Ley Foon Tan <lftan@altera.com>
> Date: Tue, 26 Aug 2014 15:11:16 +0800
>
>> @@ -119,7 +119,8 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
>> return -EINVAL;
>> }
>>
>> - dwmac->splitter_base = (void *)devm_ioremap_resource(dev,
>> + dwmac->splitter_base =
>> + (void __iomem *)devm_ioremap_resource(dev,
>> &res_splitter);
>
> Please either put this entire call on one line (it'll only be slightly
> over 80 columns, which is fine), or indent it properly.
>
> And by properly I meant that the second and subsequent lines of a function
> call must be indented precisely to the first column after the openning
> parenthesis of the function call on the first line. You must use the
> appropriate number of TAB and SPACE characters necessary to do so.
>
> If it is indented using only TAB characters, it is very likely that you
> are doing it wrong.
Okay, will send in new patch to fix this.
Thanks.
^ permalink raw reply
* Re: [PATCH net-next v5 00/13] dsa: Broadcom Starfighter 2 switch support
From: Florian Fainelli @ 2014-08-28 2:51 UTC (permalink / raw)
To: David Miller; +Cc: netdev, John Linville, Jamal Hadi Salim, Alexander Duyck
In-Reply-To: <20140827.183033.1723409609887880785.davem@davemloft.net>
2014-08-27 18:30 GMT-07:00 David Miller <davem@davemloft.net>:
> From: David Miller <davem@davemloft.net>
> Date: Wed, 27 Aug 2014 18:12:29 -0700 (PDT)
>
>> From: Florian Fainelli <f.fainelli@gmail.com>
>> Date: Wed, 27 Aug 2014 17:04:14 -0700
>>
>>> This patch series adds support for the Broadcom Starfighter 2 (Roboswitch
>>> successor) using the existing DSA infrastructure. This integrated switch
>>> is heavily used in Set Top Box, Cable gateways and DSL gateways products
>>> from Broadcom, and to a larger extent the new ARM-based Wi-Fi routers although
>>> slightly differently.
>>
>> Series applied, thanks Florian.
>
> Florian, I had to make an adjustment to make your series work.
>
> The Tulip dmfe driver internally has static functions named phy_read()
> and phy_write(). I had to add a commit to rename them before your
> series.
Ah, I should have caught that.
>
> Please when adjusting globally visible interfaces, do an allmodconfig
> build to catch these kinds of problems.
Will do next time, thanks!
>
> Thanks.
--
Florian
^ permalink raw reply
* [PATCH net-next v2] r8152: reduce the number of Tx
From: Hayes Wang @ 2014-08-28 2:24 UTC (permalink / raw)
To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb
In-Reply-To: <1394712342-15778-23-Taiwan-albertk@realtek.com>
Because the Tx has the features of stopping queue and aggregation,
We don't need many tx buffers. Change the tx number from 10 to 4
to reduce the usage of the memory. This could save 16K * 6 bytes
memory.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 33dcc97..cc64dc0 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -424,7 +424,7 @@ enum rtl_register_content {
FULL_DUP = 0x01,
};
-#define RTL8152_MAX_TX 10
+#define RTL8152_MAX_TX 4
#define RTL8152_MAX_RX 10
#define INTBUFSIZE 2
#define CRC_SIZE 4
--
1.9.3
^ permalink raw reply related
* [PATCH net-next] r8152: reduce the number of Tx
From: Hayes Wang @ 2014-08-28 2:17 UTC (permalink / raw)
To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang
Because the Tx has the features of stopping queue and aggregation,
We don't need many tx buffers. Change the tx number from 10 to 4
to reduce the usage of the memory. This could save 16K * 10 bytes
memory.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 33dcc97..cc64dc0 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -424,7 +424,7 @@ enum rtl_register_content {
FULL_DUP = 0x01,
};
-#define RTL8152_MAX_TX 10
+#define RTL8152_MAX_TX 4
#define RTL8152_MAX_RX 10
#define INTBUFSIZE 2
#define CRC_SIZE 4
--
1.9.3
^ permalink raw reply related
* [PATCH nf] ipvs: fix ipv6 hook registration for local replies
From: Simon Horman @ 2014-08-28 2:04 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Simon Horman
In-Reply-To: <1409191468-28013-1-git-send-email-horms@verge.net.au>
From: Julian Anastasov <ja@ssi.bg>
commit fc604767613b6d2036cdc35b660bc39451040a47
("ipvs: changes for local real server") from 2.6.37
introduced DNAT support to local real server but the
IPv6 LOCAL_OUT handler ip_vs_local_reply6() is
registered incorrectly as IPv4 hook causing any outgoing
IPv4 traffic to be dropped depending on the IP header values.
Chris tracked down the problem to CONFIG_IP_VS_IPV6=y
Bug report: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1349768
Reported-by: Chris J Arges <chris.j.arges@canonical.com>
Tested-by: Chris J Arges <chris.j.arges@canonical.com>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index e683675..5c34e8d 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1906,7 +1906,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {
{
.hook = ip_vs_local_reply6,
.owner = THIS_MODULE,
- .pf = NFPROTO_IPV4,
+ .pf = NFPROTO_IPV6,
.hooknum = NF_INET_LOCAL_OUT,
.priority = NF_IP6_PRI_NAT_DST + 1,
},
--
2.0.1
^ permalink raw reply related
* [GIT PULL nf] Second round of IPVS fixes for v3.17
From: Simon Horman @ 2014-08-28 2:04 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Simon Horman
Hi Pablo,
please consider this fix IPVS fix for v3.17.
This pull request is based on the first round of fixes for IPVS for v3.17,
tagged as ipvs-fixes2-for-v3.17, which I sent yesterday.
This fix resolves a problem with conflicting hooks whereby DNAT support for
the local server would drop outgoing IPv4 packets if the kernel was
compiled CONFIG_IP_VS_IPV6=y.
This problem dates back to v3.6.37 when the feature in question was added.
I would like this fix considered for -stable.
The following changes since commit ea1d5d7755a3e556de78cc757d1895d5c7180548:
ipvs: properly declare tunnel encapsulation (2014-08-27 14:31:56 +0900)
are available in the git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git tags/ipvs-fixes2-for-v3.17
for you to fetch changes up to eb90b0c734ad793d5f5bf230a9e9a4dcc48df8aa:
ipvs: fix ipv6 hook registration for local replies (2014-08-28 10:52:37 +0900)
----------------------------------------------------------------
Julian Anastasov (1):
ipvs: fix ipv6 hook registration for local replies
net/netfilter/ipvs/ip_vs_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
^ permalink raw reply
* [PATCH net-next] tipc: fix a potential oops
From: Ying Xue @ 2014-08-28 2:02 UTC (permalink / raw)
To: davem; +Cc: jon.maloy, erik.hugne, netdev, tipc-discussion
Commit 6c9808ce09f7 ("tipc: remove port_lock") accidentally involves
a potential bug: when tipc socket instance(tsk) is not got with given
reference number in tipc_sk_get(), tsk is set to NULL. Subsequently
we jump to exit label where to decrease socket reference counter
pointed by tsk pointer in tipc_sk_put(). However, As now tsk is NULL,
oops may happen because of touching a NULL pointer.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Erik Hugne <erik.hugne@ericsson.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
---
Hi David, please notice that I just sumibt the patch to net-next as
the commit 6c9808ce09f7 is not merged into net tree so far.
net/tipc/socket.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index d416e83..75275c5 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2118,9 +2118,9 @@ static void tipc_sk_timeout(unsigned long ref)
tsk = tipc_sk_get(ref);
if (!tsk)
- goto exit;
- sk = &tsk->sk;
+ return;
+ sk = &tsk->sk;
bh_lock_sock(sk);
if (!tsk->connected) {
bh_unlock_sock(sk);
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH net-next v4 01/13] net: dsa: reduce number of protocol hooks
From: Alexander Duyck @ 2014-08-28 1:49 UTC (permalink / raw)
To: Florian Fainelli, David Miller, alexander.h.duyck; +Cc: netdev, linville, jhs
In-Reply-To: <53FE6D2D.4060708@gmail.com>
On 08/27/2014 04:43 PM, Florian Fainelli wrote:
> On 08/27/2014 04:24 PM, David Miller wrote:
>> From: Alexander Duyck <alexander.h.duyck@intel.com>
>> Date: Wed, 27 Aug 2014 08:25:45 -0700
>>
>>> Just a thought, you might want to consider using a protocol value other
>>> than ETH_P_DSA. Maybe we should add a new value named ETH_P_XDSA for
>>> this approach since what we are doing is a multiplexed DSA protocol now.
>>>
>>> This would allow for much easier back-porting of this if needed and also
>>> prevents us from possibly triggering any issues if there are any
>>> user-space APIs that might be trying to capture packets based on the
>>> protocol value.
>> Agreed, Florian can you respin this patch set using a newly allocated
>> ETH_P_* value for these new semantics?
> Absolutely. While at it, I just realized that ETH_P_BRCMTAG should
> probably remain within include/net/dsa.h. We don't want that to be
> exported to user-space since it is used for internal DSA de-multiplexing.
>
> Stay tuned!
> --
> Florian
>
Actually you could probably simplify this all a bit more by replacing
the ETH_P_BRCMTAG and tag_protcol values with a simple enum/u16 instead
of having to use be16 values. It would make things a bit more explicit
as well since you could specify something like DSA_TAG_NONE = 0.
If you can't get to it I will probably work on submitting a patch for it
next week.
Thanks,
Alex
^ permalink raw reply
* [PATCH net-next v2] lib/rhashtable: allow users to set the minimum shifts of shrinking
From: Ying Xue @ 2014-08-28 1:45 UTC (permalink / raw)
To: tgraf; +Cc: davem, eric.dumazet, netdev
Now the resizeable hash table size is allowed to shrink a too smaller
size - HASH_MIN_SIZE(4) although users initially specify a rather big
size when table is created. Especially when the number of objects
saved in the table keeps a small value in comparison with the initial
setting of table size during a quite long time, lots of actions of
expanding and shrinking are involved with objects being inserted or
removed from table. However, as synchronize_rcu() has to be called
during expanding and shrinking, these unnecessary actions would
seriously hit users' performance.
Therefore, we should permit users to set the minimum table size
through configuring the minimum of number of shifts when table is
created according to users specific requirement.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
---
v2: Translate HASH_MIN_SIZE to .min_shift in rhashtable_init() by
Thomas's suggestion.
include/linux/rhashtable.h | 2 ++
lib/rhashtable.c | 15 +++++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 36826c0..fb298e9d 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -44,6 +44,7 @@ struct rhashtable;
* @head_offset: Offset of rhash_head in struct to be hashed
* @hash_rnd: Seed to use while hashing
* @max_shift: Maximum number of shifts while expanding
+ * @min_shift: Minimum number of shifts while shrinking
* @hashfn: Function to hash key
* @obj_hashfn: Function to hash object
* @grow_decision: If defined, may return true if table should expand
@@ -57,6 +58,7 @@ struct rhashtable_params {
size_t head_offset;
u32 hash_rnd;
size_t max_shift;
+ size_t min_shift;
rht_hashfn_t hashfn;
rht_obj_hashfn_t obj_hashfn;
bool (*grow_decision)(const struct rhashtable *ht,
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index a2c7881..85a4ac2 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -298,7 +298,7 @@ int rhashtable_shrink(struct rhashtable *ht, gfp_t flags)
ASSERT_RHT_MUTEX(ht);
- if (tbl->size <= HASH_MIN_SIZE)
+ if (ht->shift <= ht->p.min_shift)
return 0;
ntbl = bucket_table_alloc(tbl->size / 2, flags);
@@ -506,9 +506,10 @@ void *rhashtable_lookup_compare(const struct rhashtable *ht, u32 hash,
}
EXPORT_SYMBOL_GPL(rhashtable_lookup_compare);
-static size_t rounded_hashtable_size(unsigned int nelem)
+static size_t rounded_hashtable_size(struct rhashtable_params *params)
{
- return max(roundup_pow_of_two(nelem * 4 / 3), HASH_MIN_SIZE);
+ return max(roundup_pow_of_two(params->nelem_hint * 4 / 3),
+ 1UL << params->min_shift);
}
/**
@@ -557,6 +558,7 @@ static size_t rounded_hashtable_size(unsigned int nelem)
*/
int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params)
{
+ size_t min_shift = ilog2(HASH_MIN_SIZE);
struct bucket_table *tbl;
size_t size;
@@ -566,8 +568,13 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params)
(!params->key_len && !params->obj_hashfn))
return -EINVAL;
+ if (params->min_shift)
+ params->min_shift = max(params->min_shift, min_shift);
+ else
+ params->min_shift = min_shift;
+
if (params->nelem_hint)
- size = rounded_hashtable_size(params->nelem_hint);
+ size = rounded_hashtable_size(params);
tbl = bucket_table_alloc(size, GFP_KERNEL);
if (tbl == NULL)
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 0/2] Get rid of ndo_xmit_flush
From: Hannes Frederic Sowa @ 2014-08-28 1:42 UTC (permalink / raw)
To: David Miller
Cc: netdev, therbert, jhs, edumazet, jeffrey.t.kirsher, rusty,
dborkman, brouer, John Fastabend
In-Reply-To: <20140827.134510.2172564669938048576.davem@davemloft.net>
On Mi, 2014-08-27 at 13:45 -0700, David Miller wrote:
> From: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Date: Wed, 27 Aug 2014 14:31:12 +0200
>
> > On Mo, 2014-08-25 at 16:34 -0700, David Miller wrote:
> >> Given Jesper's performance numbers, it's not the way to go.
> >>
> >> Instead, go with a signalling scheme via new boolean skb->xmit_more.
> >>
> >> This has several advantages:
> >>
> >> 1) Nearly trivial driver support, just protect the tail pointer
> >> update with the skb->xmit_more check.
> >
> > One thing one should keep in mind is, that there must be a skb available
> > to trigger the flush, maybe this will hurt us one day.
> >
> > Thinking more about it should we go with a coccinelle script and
> > replace/extend ndo_start_xmit with an additional argument?
> >
> > We can also add a new function pointer and call that instead of
> > ndo_start_xmit. I think only the callq *%rax hurts performance.
>
> I don't think we will have any problems here, the caller will always
> be the entity which analyzes the upcoming set of SKBs to submit and
> tag them properly.
>
> I really do not want to add a new OP and I even more so do not want to
> adjust the ndo_start_xmit() signature. It's effect is far reaching,
> and for absolutely no gain as far as I can see.
>
> Thanks.
Just brainstorming a bit:
I wonder if we still might need a separate call for tx_flush, e.g. for
af_packet if one wants to allow user space control of batching, MSG_MORE
with tx hangcheck (also in case user space has control over it) or
implement TCP_CORK alike option in af_packet. Even in the case we
someday might allow concurrent dequeueing from a qdisc we might want to
use xmit_more opportunistic (also user space might use xmit_more
opportunistic if dequeueing from lockless data structures). I just want
to ensure we thought about possible reuses of this driver api change. ;)
To do so just some proposals:
1) export tx_flush function nonetheless but normal/fast path just depends on
skb->xmit_more (so driver just does a static call to the flushing
function, no indirection here). We would keep the ndo_op for flushing
around, but ndo_start_xmit must still honor xmit_more by itself.
af_packet sockets could then flush the queues separately if wanted. Also if
ndo_op != NULL we know that driver supports batching.
2) add new op like ndo_start_xmit_flags op with an additional flags
parameter and document that NULL skbs can happen. In this case tx-queue
should only get flushed. By checking for the new method we also know
that the driver supports batching.
3) provide special skb (only head) with no data to ndo_start_xmit which
only clears the queue but prepare drivers to not enqueue any new data.
I am concerned that if user space can control batching to the NIC we can
have side-effects if user space did not flush the queue of the nic
before and we dequeue more packets from qdisc into the same nic's tx
queue.
Allowing user space control over batching might make the conversion of
drivers more painful, as driver might have to check for "dirtiness"
before it tries to enqueue the packet internally. (To track queueing
state of nic we also must track the state globally per queue which might
also become a performance problem cache trashing wise, I am unsure about
that; at least seems not to be the case with bql. My idea was a tx-queue
dirty bit somewhere, or check bql state before submitting skb. But maybe
one has to extend bql to keep track of unflushed vs. flushed skbs to
make this safe.)
If queuing failed because of missing tx_flush we either have to requeue
the skb to the qdisc or do a fast retry, but I don't think that NICs
will catch up that fast, no? Or can we just blame user space
applications that they are wrong if they use xmit_more irresponsible?
I liked the separate ndo ops approach because it seemed so very well
extendable to me. :/
I know that these concerns a bit messy but wanted to share them
nonetheless. Maybe they are all void in the end. ;)
Also maybe these concerns can get solved by the addition of future
AF_PACKETV4 ndo ops and we can just postpone this discussion.
Bye,
Hannes
^ permalink raw reply
* Re: [PATCH net-next v5 00/13] dsa: Broadcom Starfighter 2 switch support
From: David Miller @ 2014-08-28 1:30 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, linville, jhs, alexander.duyck
In-Reply-To: <20140827.181229.2168894985069137270.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Wed, 27 Aug 2014 18:12:29 -0700 (PDT)
> From: Florian Fainelli <f.fainelli@gmail.com>
> Date: Wed, 27 Aug 2014 17:04:14 -0700
>
>> This patch series adds support for the Broadcom Starfighter 2 (Roboswitch
>> successor) using the existing DSA infrastructure. This integrated switch
>> is heavily used in Set Top Box, Cable gateways and DSL gateways products
>> from Broadcom, and to a larger extent the new ARM-based Wi-Fi routers although
>> slightly differently.
>
> Series applied, thanks Florian.
Florian, I had to make an adjustment to make your series work.
The Tulip dmfe driver internally has static functions named phy_read()
and phy_write(). I had to add a commit to rename them before your
series.
Please when adjusting globally visible interfaces, do an allmodconfig
build to catch these kinds of problems.
Thanks.
^ permalink raw reply
* Re: [PATCH net-next v2 0/4] Broadcom BCM7xxx PHY updates for new entries
From: David Miller @ 2014-08-28 1:15 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev
In-Reply-To: <1409084127-30387-1-git-send-email-f.fainelli@gmail.com>
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 26 Aug 2014 13:15:23 -0700
> Another week, another set of updates for the Broadcom BCM7xxx PHY driver. This
> patch set cleanups the existing definitions, adds a macro to ease the addition
> of future chips, and finally add two new SoCs to the list of supported chips.
>
> Resending since the first patch did not make it to the list, sorry about that.
>
> Changes in v2:
> - rephrased commit message for patch 1 to make it pass majordomo
> capital triple X was rejected
Series applied, thanks Florian.
^ permalink raw reply
* Re: [PATCH v3 net-next 1/2] tipc: refactor name table updates out of named packet receive routine
From: David Miller @ 2014-08-28 1:10 UTC (permalink / raw)
To: erik.hugne; +Cc: jon.maloy, ying.xue, richard.alpe, netdev, tipc-discussion
In-Reply-To: <1409065550-9648-1-git-send-email-erik.hugne@ericsson.com>
From: <erik.hugne@ericsson.com>
Date: Tue, 26 Aug 2014 17:05:49 +0200
> From: Erik Hugne <erik.hugne@ericsson.com>
>
> We need to perform the same actions when processing deferred name
> table updates, so this functionality is moved to a separate
> function.
>
> Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
> Acked-by: Ying Xue <ying.xue@windriver.com>
This patch set adds compiler warnings:
net/tipc/name_distr.c: In function ‘tipc_named_process_backlog’:
net/tipc/name_distr.c:346:7: warning: comparison of distinct pointer types lacks a cast [enabled by default]
net/tipc/name_distr.c:346:7: warning: comparison of distinct pointer types lacks a cast [enabled by default]
Please fix them and resubmit the entire series.
Thanks.
^ permalink raw reply
* Re: [PATCH] ipv6: sit: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
From: David Miller @ 2014-08-28 1:07 UTC (permalink / raw)
To: bernat.ada
Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel, paulmck
In-Reply-To: <20140826134632.GA1473@ada>
From: Andreea-Cristina Bernat <bernat.ada@gmail.com>
Date: Tue, 26 Aug 2014 16:46:32 +0300
> According to RCU_INIT_POINTER()'s block comment 3.a, it can be used if
> "3. The referenced data structure has already been exposed to readers either
> at compile time or via rcu_assign_pointer() -and-
> a. You have not made -any- reader-visible changes to this structure since
> then".
>
> This case fulfills the conditions above because between the rtnl_dereference()
> call and the rcu_assign_pointer() call there is no update of that value.
> Therefore, this patch makes the replacement.
>
> The following Coccinelle semantic patch was used:
> @@
> @@
>
> - rcu_assign_pointer
> + RCU_INIT_POINTER
> (...,
> (
> rtnl_dereference(...)
> |
> rcu_dereference_protected(...)
> ) )
>
> Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
These changes are not correct.
We need the memory barrier added by rcu_assign_pointer(), which occurs
before the assignment, otherwise the RCU pointer update might be visible
before the stores that initialize the rest of the structure in question.
I'm not applying any of these patches, sorry.
^ permalink raw reply
* [PATCH net v4 4/4] tg3: Fix tx_pending checks for tg3_tso_bug
From: Benjamin Poirier @ 2014-08-28 1:04 UTC (permalink / raw)
To: Prashant Sreedharan, Michael Chan; +Cc: netdev, linux-kernel
In-Reply-To: <1409187858-7698-1-git-send-email-bpoirier@suse.de>
In tg3_set_ringparam(), the tx_pending test to cover the cases where
tg3_tso_bug() is entered has two problems
1) the check is only done for certain hardware whereas the workaround
is now used more broadly. IOW, the check may not be performed when it
is needed.
2) the check is too optimistic.
For example, with a 5761 (SHORT_DMA_BUG), tg3_set_ringparam() skips over the
"tx_pending <= (MAX_SKB_FRAGS * 3)" check because TSO_BUG is false. Even if it
did do the check, with a full sized skb, frag_cnt_est = 135 but the check is
for <= MAX_SKB_FRAGS * 3 (= 17 * 3 = 51). So the check is insufficient. This
leads to the following situation: by setting, ex. tx_pending = 100, there can
be an skb that triggers tg3_tso_bug() and that is large enough to cause
tg3_tso_bug() to stop the queue even when it is empty. We then end up with a
netdev watchdog transmit timeout.
Given that 1) some of the conditions tested for in tg3_tx_frag_set() apply
regardless of the chipset flags and that 2) it is difficult to estimate ahead
of time the max possible number of frames that a large skb may be split into
by gso, we instead take the approach of adjusting dev->gso_max_segs according
to the requested tx_pending size.
This puts us in the exceptional situation that a single skb that triggers
tg3_tso_bug() may require the entire tx ring. Usually the tx queue is woken up
when at least a quarter of it is available (TG3_TX_WAKEUP_THRESH) but that
would be insufficient now. To avoid useless wakeups, the tx queue wake up
threshold is made dynamic. Likewise, usually the tx queue is stopped as soon
as an skb with max frags may overrun it. Since the skbs submitted from
tg3_tso_bug() use a controlled number of descriptors, the tx queue stop
threshold may be lowered.
Signed-off-by: Benjamin Poirier <bpoirier@suse.de>
---
Changes v1->v2
* in tg3_set_ringparam(), reduce gso_max_segs further to budget 3 descriptors
per gso seg instead of only 1 as in v1
* in tg3_tso_bug(), check that this estimation (3 desc/seg) holds, otherwise
linearize some skbs as needed
* in tg3_start_xmit(), make the queue stop threshold a parameter, for the
reason explained in the commit description
Changes v2->v3
* use tg3_maybe_stop_txq() instead of repeatedly open coding it
* add the requested tp->tx_dropped++ stat increase in tg3_tso_bug() if
skb_linearize() fails and we must abort
* in the same code block, add an additional check to stop the queue with the
default threshold. Otherwise, the netdev_err message at the start of
__tg3_start_xmit() could be triggered when the next frame is transmitted.
That is because the previous calls to __tg3_start_xmit() in tg3_tso_bug()
may have been using a stop_thresh=segs_remaining that is < MAX_SKB_FRAGS +
1.
Changes v3->v4
* in tg3_set_ringparam(), make sure that wakeup_thresh does not end up being
>= tx_pending. Identified by Prashant.
I reproduced this bug using the same approach explained in patch 1.
The bug reproduces with tx_pending <= 135
---
drivers/net/ethernet/broadcom/tg3.c | 70 +++++++++++++++++++++++++++++--------
drivers/net/ethernet/broadcom/tg3.h | 1 +
2 files changed, 57 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index f706a1e..05cb940 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -204,6 +204,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)
/* minimum number of free TX descriptors required to wake up TX process */
#define TG3_TX_WAKEUP_THRESH(tnapi) max_t(u32, (tnapi)->tx_pending / 4, \
MAX_SKB_FRAGS + 1)
+/* estimate a certain number of descriptors per gso segment */
+#define TG3_TX_DESC_PER_SEG(seg_nb) ((seg_nb) * 3)
+#define TG3_TX_SEG_PER_DESC(desc_nb) ((desc_nb) / 3)
+
#define TG3_TX_BD_DMA_MAX_2K 2048
#define TG3_TX_BD_DMA_MAX_4K 4096
@@ -6609,10 +6613,10 @@ static void tg3_tx(struct tg3_napi *tnapi)
smp_mb();
if (unlikely(netif_tx_queue_stopped(txq) &&
- (tg3_tx_avail(tnapi) > TG3_TX_WAKEUP_THRESH(tnapi)))) {
+ (tg3_tx_avail(tnapi) > tnapi->wakeup_thresh))) {
__netif_tx_lock(txq, smp_processor_id());
if (netif_tx_queue_stopped(txq) &&
- (tg3_tx_avail(tnapi) > TG3_TX_WAKEUP_THRESH(tnapi)))
+ (tg3_tx_avail(tnapi) > tnapi->wakeup_thresh))
netif_tx_wake_queue(txq);
__netif_tx_unlock(txq);
}
@@ -7830,6 +7834,8 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
}
static netdev_tx_t tg3_start_xmit(struct sk_buff *, struct net_device *);
+static netdev_tx_t __tg3_start_xmit(struct sk_buff *, struct net_device *,
+ u32);
/* Returns true if the queue has been stopped. Note that it may have been
* restarted since.
@@ -7844,6 +7850,7 @@ static inline bool tg3_maybe_stop_txq(struct tg3_napi *tnapi,
if (!netif_tx_queue_stopped(txq)) {
stopped = true;
netif_tx_stop_queue(txq);
+ tnapi->wakeup_thresh = wakeup_thresh;
if (wakeup_thresh >= tnapi->tx_pending)
netdev_err(tnapi->tp->dev,
"BUG! wakeup_thresh too large (%u >= %u)\n",
@@ -7851,10 +7858,11 @@ static inline bool tg3_maybe_stop_txq(struct tg3_napi *tnapi,
}
/* netif_tx_stop_queue() must be done before checking tx index
* in tg3_tx_avail(), because in tg3_tx(), we update tx index
- * before checking for netif_tx_queue_stopped().
+ * before checking for netif_tx_queue_stopped(). The memory
+ * barrier also synchronizes wakeup_thresh changes.
*/
smp_mb();
- if (tg3_tx_avail(tnapi) > wakeup_thresh)
+ if (tg3_tx_avail(tnapi) > tnapi->wakeup_thresh)
netif_tx_wake_queue(txq);
}
return stopped;
@@ -7867,10 +7875,10 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi,
struct netdev_queue *txq, struct sk_buff *skb)
{
struct sk_buff *segs, *nskb;
- u32 frag_cnt_est = skb_shinfo(skb)->gso_segs * 3;
+ unsigned int segs_remaining = skb_shinfo(skb)->gso_segs;
+ u32 desc_cnt_est = TG3_TX_DESC_PER_SEG(segs_remaining);
- /* Estimate the number of fragments in the worst case */
- tg3_maybe_stop_txq(tnapi, txq, frag_cnt_est, frag_cnt_est);
+ tg3_maybe_stop_txq(tnapi, txq, desc_cnt_est, desc_cnt_est);
if (netif_tx_queue_stopped(txq))
return NETDEV_TX_BUSY;
@@ -7880,10 +7888,32 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi,
goto tg3_tso_bug_end;
do {
+ unsigned int desc_cnt = skb_shinfo(segs)->nr_frags + 1;
+
nskb = segs;
segs = segs->next;
nskb->next = NULL;
- tg3_start_xmit(nskb, tp->dev);
+
+ if (tg3_tx_avail(tnapi) <= segs_remaining - 1 + desc_cnt &&
+ skb_linearize(nskb)) {
+ tp->tx_dropped++;
+ nskb->next = segs;
+ segs = nskb;
+ do {
+ nskb = segs->next;
+
+ dev_kfree_skb_any(segs);
+ segs = nskb;
+ } while (segs);
+ tg3_maybe_stop_txq(tnapi, txq, MAX_SKB_FRAGS + 1,
+ TG3_TX_WAKEUP_THRESH(tnapi));
+ goto tg3_tso_bug_end;
+ }
+ segs_remaining--;
+ if (segs_remaining)
+ __tg3_start_xmit(nskb, tp->dev, segs_remaining);
+ else
+ tg3_start_xmit(nskb, tp->dev);
} while (segs);
tg3_tso_bug_end:
@@ -7895,6 +7925,12 @@ tg3_tso_bug_end:
/* hard_start_xmit for all devices */
static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
+ return __tg3_start_xmit(skb, dev, MAX_SKB_FRAGS + 1);
+}
+
+static netdev_tx_t __tg3_start_xmit(struct sk_buff *skb,
+ struct net_device *dev, u32 stop_thresh)
+{
struct tg3 *tp = netdev_priv(dev);
u32 len, entry, base_flags, mss, vlan = 0;
u32 budget;
@@ -8102,7 +8138,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
tw32_tx_mbox(tnapi->prodmbox, entry);
tnapi->tx_prod = entry;
- tg3_maybe_stop_txq(tnapi, txq, MAX_SKB_FRAGS + 1,
+ tg3_maybe_stop_txq(tnapi, txq, stop_thresh,
TG3_TX_WAKEUP_THRESH(tnapi));
mmiowb();
@@ -12324,9 +12360,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
if ((ering->rx_pending > tp->rx_std_ring_mask) ||
(ering->rx_jumbo_pending > tp->rx_jmb_ring_mask) ||
(ering->tx_pending > TG3_TX_RING_SIZE - 1) ||
- (ering->tx_pending <= MAX_SKB_FRAGS + 1) ||
- (tg3_flag(tp, TSO_BUG) &&
- (ering->tx_pending <= (MAX_SKB_FRAGS * 3))))
+ (ering->tx_pending <= MAX_SKB_FRAGS + 1))
return -EINVAL;
if (netif_running(dev)) {
@@ -12346,8 +12380,15 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
if (tg3_flag(tp, JUMBO_RING_ENABLE))
tp->rx_jumbo_pending = ering->rx_jumbo_pending;
- for (i = 0; i < tp->irq_max; i++)
- tp->napi[i].tx_pending = ering->tx_pending;
+ dev->gso_max_segs = TG3_TX_SEG_PER_DESC(ering->tx_pending - 1);
+ for (i = 0; i < tp->irq_max; i++) {
+ struct tg3_napi *tnapi = &tp->napi[i];
+
+ tnapi->tx_pending = ering->tx_pending;
+ if (netif_tx_queue_stopped(netdev_get_tx_queue(dev, i)) &&
+ tnapi->wakeup_thresh >= ering->tx_pending)
+ tnapi->wakeup_thresh = MAX_SKB_FRAGS + 1;
+ }
if (netif_running(dev)) {
tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
@@ -17822,6 +17863,7 @@ static int tg3_init_one(struct pci_dev *pdev,
else
sndmbx += 0xc;
}
+ dev->gso_max_segs = TG3_TX_SEG_PER_DESC(TG3_DEF_TX_RING_PENDING - 1);
tg3_init_coal(tp);
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
index 461acca..6a7e13d 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -3006,6 +3006,7 @@ struct tg3_napi {
u32 tx_pending;
u32 last_tx_cons;
u32 prodmbox;
+ u32 wakeup_thresh;
struct tg3_tx_buffer_desc *tx_ring;
struct tg3_tx_ring_info *tx_buffers;
--
1.8.4.5
^ permalink raw reply related
* Re: [PATCH RFC] lib/rhashtable: allow users to set the minimum shifts of shrinking
From: Ying Xue @ 2014-08-28 1:04 UTC (permalink / raw)
To: Thomas Graf; +Cc: davem, eric.dumazet, netdev
In-Reply-To: <20140827103412.GC13116@casper.infradead.org>
On 08/27/2014 06:34 PM, Thomas Graf wrote:
> On 08/27/14 at 04:57pm, Ying Xue wrote:
>> diff --git a/lib/rhashtable.c b/lib/rhashtable.c
>> index a2c7881..1466e2d 100644
>> --- a/lib/rhashtable.c
>> +++ b/lib/rhashtable.c
>> @@ -293,12 +293,15 @@ EXPORT_SYMBOL_GPL(rhashtable_expand);
>> int rhashtable_shrink(struct rhashtable *ht, gfp_t flags)
>> {
>> struct bucket_table *ntbl, *tbl = rht_dereference(ht->tbl, ht);
>> + size_t min_shift = ilog2(HASH_MIN_SIZE);
>> struct rhash_head __rcu **pprev;
>> unsigned int i;
>>
>> ASSERT_RHT_MUTEX(ht);
>>
>> - if (tbl->size <= HASH_MIN_SIZE)
>> + if (ht->p.min_shift)
>> + min_shift = max(ht->p.min_shift, min_shift);
>> + if (ht->shift <= min_shift)
>> return 0;
>
> I like it. Can you translate HASH_MIN_SIZE to .minshift in
> rhashtable_init()? That way we only have to deal with .min_shift in
> rhashtable_shrink().
>
Good suggestion! I will change it in next version.
> Note that shrinking can also be disabled by not providing a
> .shrink_decision function in rhashtable_params if the shrinking is
> too expensive for your case.
>
Yes, I know the rule. But in some case we hope that rhashtable doesn't
take such expensive actions like expanding and shrinking when its size
is small; meanwhile, when its size is rather big, shrinking is able to
de done as usual.
In fact, we already published the max_shift to users, allowing them to
limit the biggest size of rhashtable. So, exporting min_shift should be
reasonable, having users have a chance to specify the smallest size of
rhashtable.
>> -static size_t rounded_hashtable_size(unsigned int nelem)
>> +static size_t rounded_hashtable_size(struct rhashtable_params *params)
>> {
>> - return max(roundup_pow_of_two(nelem * 4 / 3), HASH_MIN_SIZE);
>> + size_t size = HASH_MIN_SIZE;
>> +
>> + if (params->min_shift)
>> + size = max((1UL << params->min_shift), HASH_MIN_SIZE);
>> +
>> + return max(roundup_pow_of_two(params->nelem_hint * 4 / 3), size);
>> }
>
> Same here. If you merge the provided .min_shift with HASH_MIN_SIZE
> in rhashtable_init() before calculating the size, the above logic
> can be simplified a lot.
>
Thanks for your suggestion.
Regards,
Ying
>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox