* Re: [PATCH net 2/3] ipv6: fill rt6i_gateway with nexthop address
From: Hannes Frederic Sowa @ 2013-10-21 5:01 UTC (permalink / raw)
To: Julian Anastasov
Cc: David Miller, netdev, netfilter-devel, lvs-devel,
Hideaki YOSHIFUJI
In-Reply-To: <1382272985-1528-3-git-send-email-ja@ssi.bg>
On Sun, Oct 20, 2013 at 03:43:04PM +0300, Julian Anastasov wrote:
> Make sure rt6i_gateway contains nexthop information in
> all routes returned from lookup or when routes are directly
> attached to skb for generated ICMP packets.
>
> The effect of this patch should be a faster version of
> rt6_nexthop() and the consideration of local addresses as
> nexthop.
>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
The patch is fine. I don't mind if we leave it as is or remove rt6_nexthop,
so:
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Thanks,
Hannes
^ permalink raw reply
* Re: [PATCH net 3/3] netfilter: nf_conntrack: fix rt6i_gateway checks for H.323 helper
From: Hannes Frederic Sowa @ 2013-10-21 5:04 UTC (permalink / raw)
To: Julian Anastasov
Cc: David Miller, netdev, netfilter-devel, lvs-devel,
Hideaki YOSHIFUJI
In-Reply-To: <1382272985-1528-4-git-send-email-ja@ssi.bg>
On Sun, Oct 20, 2013 at 03:43:05PM +0300, Julian Anastasov wrote:
> Now when rt6_nexthop() can return nexthop address we can use it
> for proper nexthop comparison of directly connected destinations.
> For more information refer to commit bbb5823cf742a7
> ("netfilter: nf_conntrack: fix rt_gateway checks for H.323 helper").
>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cool, that the bug is fixed and the code is a bit more simple. :)
Thanks,
Hannes
^ permalink raw reply
* Re: [PATCH] chelsio: remove duplicate defines
From: Michael Opdenacker @ 2013-10-21 5:08 UTC (permalink / raw)
To: divy; +Cc: netdev, linux-kernel, Michael Opdenacker
In-Reply-To: <1382331307-4962-1-git-send-email-michael.opdenacker@free-electrons.com>
On 10/21/2013 06:55 AM, Michael Opdenacker wrote:
> This removes duplicate definitions of S_BUSY, V_BUSY() and F_BUSY
> in drivers/net/ethernet/chelsio/cxgb3/regs.h
Forget this version. There are other duplicates in this file. I'll
submit a new version of this patch.
>
> Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
> ---
> drivers/net/ethernet/chelsio/cxgb3/regs.h | 12 ------------
> 1 file changed, 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb3/regs.h b/drivers/net/ethernet/chelsio/cxgb3/regs.h
> index 6990f6c..b8367ec 100644
> --- a/drivers/net/ethernet/chelsio/cxgb3/regs.h
> +++ b/drivers/net/ethernet/chelsio/cxgb3/regs.h
> @@ -685,10 +685,6 @@
> #define V_BUSY(x) ((x) << S_BUSY)
> #define F_BUSY V_BUSY(1U)
>
> -#define S_BUSY 31
> -#define V_BUSY(x) ((x) << S_BUSY)
> -#define F_BUSY V_BUSY(1U)
> -
> #define A_MC7_EXT_MODE1 0x108
>
> #define A_MC7_EXT_MODE2 0x10c
> @@ -749,14 +745,6 @@
>
> #define A_MC7_CAL 0x128
>
> -#define S_BUSY 31
> -#define V_BUSY(x) ((x) << S_BUSY)
> -#define F_BUSY V_BUSY(1U)
> -
> -#define S_BUSY 31
> -#define V_BUSY(x) ((x) << S_BUSY)
> -#define F_BUSY V_BUSY(1U)
> -
> #define S_CAL_FAULT 30
> #define V_CAL_FAULT(x) ((x) << S_CAL_FAULT)
> #define F_CAL_FAULT V_CAL_FAULT(1U)
--
Michael Opdenacker, CEO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
+33 484 258 098
^ permalink raw reply
* [PATCH v2] chelsio: remove duplicate defines
From: Michael Opdenacker @ 2013-10-21 5:09 UTC (permalink / raw)
To: divy; +Cc: netdev, linux-kernel, Michael Opdenacker
This removes multiple duplicate definitions
in drivers/net/ethernet/chelsio/cxgb3/regs.h
Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
---
drivers/net/ethernet/chelsio/cxgb3/regs.h | 35 -------------------------------
1 file changed, 35 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb3/regs.h b/drivers/net/ethernet/chelsio/cxgb3/regs.h
index 6990f6c..81029b8 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/regs.h
+++ b/drivers/net/ethernet/chelsio/cxgb3/regs.h
@@ -685,10 +685,6 @@
#define V_BUSY(x) ((x) << S_BUSY)
#define F_BUSY V_BUSY(1U)
-#define S_BUSY 31
-#define V_BUSY(x) ((x) << S_BUSY)
-#define F_BUSY V_BUSY(1U)
-
#define A_MC7_EXT_MODE1 0x108
#define A_MC7_EXT_MODE2 0x10c
@@ -749,14 +745,6 @@
#define A_MC7_CAL 0x128
-#define S_BUSY 31
-#define V_BUSY(x) ((x) << S_BUSY)
-#define F_BUSY V_BUSY(1U)
-
-#define S_BUSY 31
-#define V_BUSY(x) ((x) << S_BUSY)
-#define F_BUSY V_BUSY(1U)
-
#define S_CAL_FAULT 30
#define V_CAL_FAULT(x) ((x) << S_CAL_FAULT)
#define F_CAL_FAULT V_CAL_FAULT(1U)
@@ -815,9 +803,6 @@
#define V_OP(x) ((x) << S_OP)
#define F_OP V_OP(1U)
-#define F_OP V_OP(1U)
-#define A_SF_OP 0x6dc
-
#define A_MC7_BIST_ADDR_BEG 0x168
#define A_MC7_BIST_ADDR_END 0x16c
@@ -830,8 +815,6 @@
#define V_CONT(x) ((x) << S_CONT)
#define F_CONT V_CONT(1U)
-#define F_CONT V_CONT(1U)
-
#define A_MC7_INT_ENABLE 0x178
#define S_AE 17
@@ -1017,8 +1000,6 @@
#define V_NICMODE(x) ((x) << S_NICMODE)
#define F_NICMODE V_NICMODE(1U)
-#define F_NICMODE V_NICMODE(1U)
-
#define S_IPV6ENABLE 15
#define V_IPV6ENABLE(x) ((x) << S_IPV6ENABLE)
#define F_IPV6ENABLE V_IPV6ENABLE(1U)
@@ -1562,27 +1543,15 @@
#define A_ULPRX_STAG_ULIMIT 0x530
#define A_ULPRX_RQ_LLIMIT 0x534
-#define A_ULPRX_RQ_LLIMIT 0x534
#define A_ULPRX_RQ_ULIMIT 0x538
-#define A_ULPRX_RQ_ULIMIT 0x538
#define A_ULPRX_PBL_LLIMIT 0x53c
#define A_ULPRX_PBL_ULIMIT 0x540
-#define A_ULPRX_PBL_ULIMIT 0x540
#define A_ULPRX_TDDP_TAGMASK 0x524
-#define A_ULPRX_RQ_LLIMIT 0x534
-#define A_ULPRX_RQ_LLIMIT 0x534
-
-#define A_ULPRX_RQ_ULIMIT 0x538
-#define A_ULPRX_RQ_ULIMIT 0x538
-
-#define A_ULPRX_PBL_ULIMIT 0x540
-#define A_ULPRX_PBL_ULIMIT 0x540
-
#define A_ULPTX_CONFIG 0x580
#define S_CFG_CQE_SOP_MASK 1
@@ -2053,8 +2022,6 @@
#define V_TMMODE(x) ((x) << S_TMMODE)
#define F_TMMODE V_TMMODE(1U)
-#define F_TMMODE V_TMMODE(1U)
-
#define A_MC5_DB_ROUTING_TABLE_INDEX 0x70c
#define A_MC5_DB_FILTER_TABLE 0x710
@@ -2454,8 +2421,6 @@
#define V_TXACTENABLE(x) ((x) << S_TXACTENABLE)
#define F_TXACTENABLE V_TXACTENABLE(1U)
-#define A_XGM_SERDES_CTRL0 0x8e0
-
#define S_RESET3 23
#define V_RESET3(x) ((x) << S_RESET3)
#define F_RESET3 V_RESET3(1U)
--
1.8.1.2
^ permalink raw reply related
* [PATCH 1/1] [PATCH] ax88179_178a: Correct the RX error definition in RX header
From: freddy @ 2013-10-21 6:37 UTC (permalink / raw)
To: davem, linux-usb, linux-kernel, netdev, louis, allan; +Cc: Freddy Xin
From: Freddy Xin <freddy@asix.com.tw>
Correct the definition of AX_RXHDR_CRC_ERR and
AX_RXHDR_DROP_ERR. They are BIT29 and BIT31 in pkt_hdr
seperately.
Add VID:DID for Samsung USB Ethernet Adapter.
Signed-off-by: Freddy Xin <freddy@asix.com.tw>
---
drivers/net/usb/ax88179_178a.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index 3569293..846cc19 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -36,8 +36,8 @@
#define AX_RXHDR_L4_TYPE_TCP 16
#define AX_RXHDR_L3CSUM_ERR 2
#define AX_RXHDR_L4CSUM_ERR 1
-#define AX_RXHDR_CRC_ERR ((u32)BIT(31))
-#define AX_RXHDR_DROP_ERR ((u32)BIT(30))
+#define AX_RXHDR_CRC_ERR ((u32)BIT(29))
+#define AX_RXHDR_DROP_ERR ((u32)BIT(31))
#define AX_ACCESS_MAC 0x01
#define AX_ACCESS_PHY 0x02
#define AX_ACCESS_EEPROM 0x04
@@ -1406,6 +1406,19 @@ static const struct driver_info sitecom_info = {
.tx_fixup = ax88179_tx_fixup,
};
+static const struct driver_info samsung_info = {
+ .description = "Samsung USB Ethernet Adapter",
+ .bind = ax88179_bind,
+ .unbind = ax88179_unbind,
+ .status = ax88179_status,
+ .link_reset = ax88179_link_reset,
+ .reset = ax88179_reset,
+ .stop = ax88179_stop,
+ .flags = FLAG_ETHER | FLAG_FRAMING_AX,
+ .rx_fixup = ax88179_rx_fixup,
+ .tx_fixup = ax88179_tx_fixup,
+};
+
static const struct usb_device_id products[] = {
{
/* ASIX AX88179 10/100/1000 */
@@ -1418,7 +1431,11 @@ static const struct usb_device_id products[] = {
}, {
/* Sitecom USB 3.0 to Gigabit Adapter */
USB_DEVICE(0x0df6, 0x0072),
- .driver_info = (unsigned long) &sitecom_info,
+ .driver_info = (unsigned long)&sitecom_info,
+}, {
+ /* Samsung USB Ethernet Adapter */
+ USB_DEVICE(0x04e8, 0xa100),
+ .driver_info = (unsigned long)&samsung_info,
},
{ },
};
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH net-next] bonding: move bond-specific init after enslave happens
From: Veaceslav Falico @ 2013-10-21 7:03 UTC (permalink / raw)
To: Ding Tianhong; +Cc: netdev, jiri, Jay Vosburgh, Andy Gospodarek
In-Reply-To: <526484CD.3010100@huawei.com>
On Mon, Oct 21, 2013 at 09:35:09AM +0800, Ding Tianhong wrote:
>On 2013/10/20 20:47, Veaceslav Falico wrote:
>> As Jiri noted, currently we first do all bonding-specific initialization
>> (specifically - bond_select_active_slave(bond)) before we actually attach
>> the slave (so that it becomes visible through bond_for_each_slave() and
>> friends). This might result in bond_select_active_slave() not seeing the
>> first/new slave and, thus, not actually selecting an active slave.
>>
>> Fix this by moving all the bond-related init part after we've actually
>> completely initialized and linked (via bond_master_upper_dev_link()) the
>> new slave.
>>
>> After this we have all the initialization of the new slave *before*
>> linking, and all the stuff that needs to be done on bonding *after* it. It
>> has also a bonus effect - we can remove the locking on the new slave init
>> completely, and only use it for bond_select_active_slave().
>>
>> Reported-by: Jiri Pirko <jiri@resnulli.us>
>> CC: Jay Vosburgh <fubar@us.ibm.com>
>> CC: Andy Gospodarek <andy@greyhouse.net>
>> Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
>> ---
>> drivers/net/bonding/bond_main.c | 29 ++++++++++-------------------
>> 1 file changed, 10 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index d90734f..047c0fb 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -1471,22 +1471,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>> goto err_close;
>> }
>>
>> - write_lock_bh(&bond->lock);
>> -
>> prev_slave = bond_last_slave(bond);
>> bond_attach_slave(bond, new_slave);
>>
>> new_slave->delay = 0;
>> new_slave->link_failure_count = 0;
>>
>> - write_unlock_bh(&bond->lock);
>> -
>> - bond_compute_features(bond);
>> -
>> bond_update_speed_duplex(new_slave);
>>
>> - read_lock(&bond->lock);
>> -
>> new_slave->last_arp_rx = jiffies -
>> (msecs_to_jiffies(bond->params.arp_interval) + 1);
>> for (i = 0; i < BOND_MAX_ARP_TARGETS; i++)
>> @@ -1547,12 +1539,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>> }
>> }
>>
>> - write_lock_bh(&bond->curr_slave_lock);
>> -
>> switch (bond->params.mode) {
>> case BOND_MODE_ACTIVEBACKUP:
>> bond_set_slave_inactive_flags(new_slave);
>> - bond_select_active_slave(bond);
>> break;
>> case BOND_MODE_8023AD:
>> /* in 802.3ad mode, the internal mechanism
>> @@ -1578,7 +1567,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>> case BOND_MODE_ALB:
>> bond_set_active_slave(new_slave);
>> bond_set_slave_inactive_flags(new_slave);
>> - bond_select_active_slave(bond);
>> break;
>> default:
>> pr_debug("This slave is always active in trunk mode\n");
>> @@ -1596,10 +1584,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>> break;
>> } /* switch(bond_mode) */
>>
>> - write_unlock_bh(&bond->curr_slave_lock);
>> -
>> - bond_set_carrier(bond);
>> -
>> #ifdef CONFIG_NET_POLL_CONTROLLER
>> slave_dev->npinfo = bond->dev->npinfo;
>> if (slave_dev->npinfo) {
>> @@ -1614,8 +1598,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>> }
>> #endif
>>
>> - read_unlock(&bond->lock);
>> -
>> res = netdev_rx_handler_register(slave_dev, bond_handle_frame,
>> new_slave);
>> if (res) {
>> @@ -1629,6 +1611,16 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>> goto err_unregister;
>> }
>>
>> + bond_compute_features(bond);
>> + bond_set_carrier(bond);
>> +
>> + if (USES_PRIMARY(bond->params.mode)) {
>> + read_lock(&bond->lock);
>> + write_lock_bh(&bond->curr_slave_lock);
>> + bond_select_active_slave(bond);
>> + write_unlock_bh(&bond->curr_slave_lock);
>> + read_unlock(&bond->lock);
>> + }
>>
>
>agree to move the lock, and I think bond_attach_slave() should add here,
>as it look more logical, the slave_cnt should not add before the slave truly
>add to the bond.
bond_(de)attach_slave() should be removed completely, actually. we don't
need special functions for ++/--.
OTOH, the whole slave_cnt is flawed a bit, whilst using RCU - we can never
guarantee that it's the actual value if we don't hold rtnl lock (we do in
ioctl, but we don't in the hash functions).
I'll take a closer look and send v2.
>
>Regards.
>Ding
>
>> pr_info("%s: enslaving %s as a%s interface with a%s link.\n",
>> bond_dev->name, slave_dev->name,
>> @@ -1686,7 +1678,6 @@ err_free:
>> kfree(new_slave);
>>
>> err_undo_flags:
>> - bond_compute_features(bond);
>> /* Enslave of first slave has failed and we need to fix master's mac */
>> if (!bond_has_slaves(bond) &&
>> ether_addr_equal(bond_dev->dev_addr, slave_dev->dev_addr))
>>
>
>
^ permalink raw reply
* Re: [PATCH net 2/3] ipv6: fill rt6i_gateway with nexthop address
From: Julian Anastasov @ 2013-10-21 7:31 UTC (permalink / raw)
To: Hannes Frederic Sowa
Cc: David Miller, netdev, netfilter-devel, lvs-devel,
Hideaki YOSHIFUJI
In-Reply-To: <20131021050159.GE28333@order.stressinduktion.org>
Hello,
On Mon, 21 Oct 2013, Hannes Frederic Sowa wrote:
> On Sun, Oct 20, 2013 at 03:43:04PM +0300, Julian Anastasov wrote:
> > Make sure rt6i_gateway contains nexthop information in
> > all routes returned from lookup or when routes are directly
> > attached to skb for generated ICMP packets.
> >
> > The effect of this patch should be a faster version of
> > rt6_nexthop() and the consideration of local addresses as
> > nexthop.
> >
> > Signed-off-by: Julian Anastasov <ja@ssi.bg>
>
> The patch is fine. I don't mind if we leave it as is or remove rt6_nexthop,
> so:
>
> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Thanks for the review! I don't mind too about
removing rt6_nexthop. For me it is 51% against 49% to keep it
as it denotes the places that use nexthop and not gateway.
May be more opinions will help to decide because I don't know
if there are any plans to use similar techniques as done for IPv4.
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* [PATCH] atm: firestream: remove duplicate define
From: Michael Opdenacker @ 2013-10-21 8:12 UTC (permalink / raw)
To: chas; +Cc: linux-atm-general, netdev, linux-kernel, Michael Opdenacker
This patch removes a duplicate define in drivers/atm/firestream.h
Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
---
drivers/atm/firestream.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/atm/firestream.h b/drivers/atm/firestream.h
index 49e783e..364eded 100644
--- a/drivers/atm/firestream.h
+++ b/drivers/atm/firestream.h
@@ -420,7 +420,6 @@ struct fs_transmit_config {
#define RC_FLAGS_BFPS_BFP27 (0xd << 17)
#define RC_FLAGS_BFPS_BFP47 (0xe << 17)
-#define RC_FLAGS_BFPS (0x1 << 17)
#define RC_FLAGS_BFPP (0x1 << 21)
#define RC_FLAGS_TEVC (0x1 << 22)
#define RC_FLAGS_TEP (0x1 << 23)
--
1.8.1.2
^ permalink raw reply related
* Re: [PATCH RFC 1/4] net: mvmdio: make orion_mdio_wait_ready consistent
From: Sebastian Hesselbarth @ 2013-10-21 7:13 UTC (permalink / raw)
To: Leigh Brown, linux-arm-kernel; +Cc: Thomas Petazzoni, netdev
In-Reply-To: <3acbec7a5077d1375777e26cd808b787eb677fb3.1382199042.git.leigh@solinno.co.uk>
On 10/19/2013 05:23 PM, Leigh Brown wrote:
> Amend orion_mdio_wait_ready so that the same timeout is used when
> polling or using wait_event_timeout. Set the timeout to 10ms.
>
> Generate the same log message at timeout when polling or using
> wait_event_timeout.
>
> Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
> ---
> drivers/net/ethernet/marvell/mvmdio.c | 41 ++++++++++++++++++---------------
> 1 file changed, 22 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
> index e2f6626..11e6415 100644
> --- a/drivers/net/ethernet/marvell/mvmdio.c
> +++ b/drivers/net/ethernet/marvell/mvmdio.c
> @@ -44,6 +44,13 @@
> #define MVMDIO_ERR_INT_SMI_DONE 0x00000010
> #define MVMDIO_ERR_INT_MASK 0x0080
>
> +/*
> + * Testing on a Dreamplug showed that the SMI interface took an average of
> + * 3.2ms to respond, with a maximum time of 4.9ms.
> + */
> +#define MVMDIO_SMI_TIMEOUT 10000 /* 10000us = 10ms */
> +#define MVMDIO_SMI_POLL_INTERVAL 10
> +
> struct orion_mdio_dev {
> struct mutex lock;
> void __iomem *regs;
> @@ -70,32 +77,28 @@ static int orion_mdio_wait_ready(struct mii_bus *bus)
> struct orion_mdio_dev *dev = bus->priv;
> int count;
>
> - if (dev->err_interrupt <= 0) {
> - count = 0;
> - while (1) {
> + if (dev->err_interrupt <= 0)
> + for (count = MVMDIO_SMI_TIMEOUT / MVMDIO_SMI_POLL_INTERVAL;
> + count > 0;
> + --count) {
> if (orion_mdio_smi_is_done(dev))
> - break;
> -
> - if (count > 100) {
> - dev_err(bus->parent,
> - "Timeout: SMI busy for too long\n");
> - return -ETIMEDOUT;
> - }
> + return 0;
>
> - udelay(10);
> - count++;
> + udelay(MVMDIO_SMI_POLL_INTERVAL);
Leigh,
this isn't happening in interrupt context, is it? According to
Documentation/timers/timers-howto.txt starting from 10us you
should use usleep_range instead. I guess it isn't really critical
but IMHO sleeping is always better than delay.
Sebastian
> }
> - } else {
> - if (!orion_mdio_smi_is_done(dev)) {
> + else {
> + if (!orion_mdio_smi_is_done(dev))
> wait_event_timeout(dev->smi_busy_wait,
> orion_mdio_smi_is_done(dev),
> - msecs_to_jiffies(100));
> - if (!orion_mdio_smi_is_done(dev))
> - return -ETIMEDOUT;
> - }
> + usecs_to_jiffies(MVMDIO_SMI_TIMEOUT));
> +
> + if (orion_mdio_smi_is_done(dev))
> + return 0;
> }
>
> - return 0;
> + dev_err(bus->parent,
> + "Timeout: SMI busy for too long\n");
> + return -ETIMEDOUT;
> }
>
> static int orion_mdio_read(struct mii_bus *bus, int mii_id,
>
^ permalink raw reply
* Re: [PATCH RFC 2/5] net:stmmac: fix rx buffer allocation.
From: Giuseppe CAVALLARO @ 2013-10-21 8:54 UTC (permalink / raw)
To: Jimmy Perchet; +Cc: netdev
In-Reply-To: <1381937052-8999-3-git-send-email-jimmy.perchet@parrot.com>
On 10/16/2013 5:24 PM, Jimmy Perchet wrote:
> Rx buffers used wrong size, because priv->dma_buf_sz was updated after allocation.
>
> Signed-off-by: Jimmy Perchet <jimmy.perchet@parrot.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 170f043..0015175 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -998,6 +998,9 @@ static int init_dma_desc_rings(struct net_device *dev)
> if (bfsize < BUF_SIZE_16KiB)
> bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz);
>
> + priv->dma_buf_sz = bfsize;
> + buf_sz = bfsize;
> +
> if (netif_msg_probe(priv))
> pr_debug("%s: txsize %d, rxsize %d, bfsize %d\n", __func__,
> txsize, rxsize, bfsize);
> @@ -1087,8 +1090,6 @@ static int init_dma_desc_rings(struct net_device *dev)
> }
> priv->cur_rx = 0;
> priv->dirty_rx = (unsigned int)(i - rxsize);
> - priv->dma_buf_sz = bfsize;
> - buf_sz = bfsize;
>
> /* Setup the chained descriptor addresses */
> if (priv->mode == STMMAC_CHAIN_MODE) {
>
^ permalink raw reply
* [PATCH net-next 0/5] bonding: patchset for rcu use in bonding
From: Ding Tianhong @ 2013-10-21 8:58 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev
Hi:
The Patch Set will remove the invalid lock for bond work queue and replace it
with rtnl lock, as read lock for bond could not protect slave list any more.
Ding Tianhong (5):
bonding: remove bond read lock for bond_mii_monitor()
bonding: remove bond read lock for bond_alb_monitor()
bonding: remove bond read lock for bond_loadbalance_arp_mon()
bonding: remove bond read lock for bond_activebackup_arp_mon()
bonding: remove bond read lock for bond_3ad_state_machine_handler()
drivers/net/bonding/bond_3ad.c | 9 ++--
drivers/net/bonding/bond_alb.c | 20 ++------
drivers/net/bonding/bond_main.c | 100 +++++++++++++---------------------------
3 files changed, 40 insertions(+), 89 deletions(-)
--
1.8.2.1
^ permalink raw reply
* [PATCH net-next 2/5] bonding: remove bond read lock for bond_alb_monitor()
From: Ding Tianhong @ 2013-10-21 8:58 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev
the bond now only attach and detach slave in rtnl lock,
so read_lock for bond could not protect slave list,
replace bond read lock with rtnl lock for bond_alb_monitor().
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/net/bonding/bond_alb.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 0287240..5d79f5e 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1495,11 +1495,13 @@ void bond_alb_monitor(struct work_struct *work)
struct list_head *iter;
struct slave *slave;
- read_lock(&bond->lock);
+ if (!rtnl_trylock())
+ goto re_arm;
if (!bond_has_slaves(bond)) {
bond_info->tx_rebalance_counter = 0;
bond_info->lp_counter = 0;
+ rtnl_unlock();
goto re_arm;
}
@@ -1548,16 +1550,6 @@ void bond_alb_monitor(struct work_struct *work)
if (bond_info->primary_is_promisc &&
(++bond_info->rlb_promisc_timeout_counter >= RLB_PROMISC_TIMEOUT)) {
- /*
- * dev_set_promiscuity requires rtnl and
- * nothing else. Avoid race with bond_close.
- */
- read_unlock(&bond->lock);
- if (!rtnl_trylock()) {
- read_lock(&bond->lock);
- goto re_arm;
- }
-
bond_info->rlb_promisc_timeout_counter = 0;
/* If the primary was set to promiscuous mode
@@ -1566,9 +1558,6 @@ void bond_alb_monitor(struct work_struct *work)
*/
dev_set_promiscuity(bond->curr_active_slave->dev, -1);
bond_info->primary_is_promisc = 0;
-
- rtnl_unlock();
- read_lock(&bond->lock);
}
if (bond_info->rlb_rebalance) {
@@ -1591,10 +1580,9 @@ void bond_alb_monitor(struct work_struct *work)
}
}
+ rtnl_unlock();
re_arm:
queue_delayed_work(bond->wq, &bond->alb_work, alb_delta_in_ticks);
-
- read_unlock(&bond->lock);
}
/* assumption: called before the slave is attached to the bond
--
1.8.2.1
^ permalink raw reply related
* [PATCH net-next 1/5] bonding: remove bond read lock for bond_mii_monitor()
From: Ding Tianhong @ 2013-10-21 8:58 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev
the bond now only attach and detach slave in rtnl lock,
so read_lock for bond could not protect slave list,
replace bond read lock with rtnl lock for bond_mii_monitor().
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/net/bonding/bond_main.c | 44 +++++++++++------------------------------
1 file changed, 12 insertions(+), 32 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d90734f..ba90f45 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2155,49 +2155,29 @@ void bond_mii_monitor(struct work_struct *work)
struct bonding *bond = container_of(work, struct bonding,
mii_work.work);
bool should_notify_peers = false;
- unsigned long delay;
- read_lock(&bond->lock);
-
- delay = msecs_to_jiffies(bond->params.miimon);
+ if (!rtnl_trylock())
+ goto re_arm;
- if (!bond_has_slaves(bond))
+ if (!bond_has_slaves(bond)) {
+ rtnl_unlock();
goto re_arm;
+ }
should_notify_peers = bond_should_notify_peers(bond);
- if (bond_miimon_inspect(bond)) {
- read_unlock(&bond->lock);
-
- /* Race avoidance with bond_close cancel of workqueue */
- if (!rtnl_trylock()) {
- read_lock(&bond->lock);
- delay = 1;
- should_notify_peers = false;
- goto re_arm;
- }
-
- read_lock(&bond->lock);
-
+ if (bond_miimon_inspect(bond))
bond_miimon_commit(bond);
- read_unlock(&bond->lock);
- rtnl_unlock(); /* might sleep, hold no other locks */
- read_lock(&bond->lock);
- }
+ if (should_notify_peers)
+ call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
+
+ rtnl_unlock();
re_arm:
if (bond->params.miimon)
- queue_delayed_work(bond->wq, &bond->mii_work, delay);
-
- read_unlock(&bond->lock);
-
- if (should_notify_peers) {
- if (!rtnl_trylock())
- return;
- call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
- rtnl_unlock();
- }
+ queue_delayed_work(bond->wq, &bond->mii_work,
+ msecs_to_jiffies(bond->params.miimon));
}
static bool bond_has_this_ip(struct bonding *bond, __be32 ip)
--
1.8.2.1
^ permalink raw reply related
* [PATCH net-next 3/5] bonding: remove bond read lock for bond_loadbalance_arp_mon()
From: Ding Tianhong @ 2013-10-21 8:58 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev
The bond now only attach and detach slave in rtnl lock,
so read_lock for bond could not protect slave list,
replace bond read lock with rtnl lock for bond_loadbalance_arp_mon().
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/net/bonding/bond_main.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ba90f45..149f4b9 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2433,10 +2433,13 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
struct list_head *iter;
int do_failover = 0;
- read_lock(&bond->lock);
+ if (!rtnl_trylock())
+ goto re_arm;
- if (!bond_has_slaves(bond))
+ if (!bond_has_slaves(bond)) {
+ rtnl_unlock();
goto re_arm;
+ }
oldcurrent = bond->curr_active_slave;
/* see if any of the previous devices are up now (i.e. they have
@@ -2518,13 +2521,12 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
write_unlock_bh(&bond->curr_slave_lock);
unblock_netpoll_tx();
}
+ rtnl_unlock();
re_arm:
if (bond->params.arp_interval)
queue_delayed_work(bond->wq, &bond->arp_work,
msecs_to_jiffies(bond->params.arp_interval));
-
- read_unlock(&bond->lock);
}
/*
--
1.8.2.1
^ permalink raw reply related
* [PATCH net-next 4/5] bonding: remove bond read lock for bond_activebackup_arp_mon()
From: Ding Tianhong @ 2013-10-21 8:59 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev
The bond now only attach and detach slave in rtnl lock,
so read_lock for bond could not protect slave list,
replace bond read lock with rtnl lock for bond_activebackup_arp_mon().
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/net/bonding/bond_main.c | 46 ++++++++++++-----------------------------
1 file changed, 13 insertions(+), 33 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 149f4b9..f3df532 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2763,51 +2763,31 @@ void bond_activebackup_arp_mon(struct work_struct *work)
struct bonding *bond = container_of(work, struct bonding,
arp_work.work);
bool should_notify_peers = false;
- int delta_in_ticks;
- read_lock(&bond->lock);
-
- delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval);
+ if (!rtnl_trylock())
+ goto re_arm;
- if (!bond_has_slaves(bond))
+ if (!bond_has_slaves(bond)) {
+ rtnl_unlock();
goto re_arm;
+ }
should_notify_peers = bond_should_notify_peers(bond);
- if (bond_ab_arp_inspect(bond)) {
- read_unlock(&bond->lock);
-
- /* Race avoidance with bond_close flush of workqueue */
- if (!rtnl_trylock()) {
- read_lock(&bond->lock);
- delta_in_ticks = 1;
- should_notify_peers = false;
- goto re_arm;
- }
-
- read_lock(&bond->lock);
-
+ if (bond_ab_arp_inspect(bond))
bond_ab_arp_commit(bond);
- read_unlock(&bond->lock);
- rtnl_unlock();
- read_lock(&bond->lock);
- }
-
bond_ab_arp_probe(bond);
-re_arm:
- if (bond->params.arp_interval)
- queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks);
+ if (should_notify_peers)
+ call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
- read_unlock(&bond->lock);
+ rtnl_unlock();
- if (should_notify_peers) {
- if (!rtnl_trylock())
- return;
- call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
- rtnl_unlock();
- }
+re_arm:
+ if (bond->params.arp_interval)
+ queue_delayed_work(bond->wq, &bond->arp_work,
+ msecs_to_jiffies(bond->params.arp_interval));
}
/*-------------------------- netdev event handling --------------------------*/
--
1.8.2.1
^ permalink raw reply related
* Re: [PATCH RFC 3/5] net:stmmac: ensure we reclaim all dirty descriptors.
From: Giuseppe CAVALLARO @ 2013-10-21 9:07 UTC (permalink / raw)
To: Jimmy Perchet; +Cc: netdev
In-Reply-To: <1381937052-8999-4-git-send-email-jimmy.perchet@parrot.com>
Hello Jimmy
On 10/16/2013 5:24 PM, Jimmy Perchet wrote:
> On low speed link (10MBit/s), some TX descriptors can remain dirty
> if the tx coalescence timer expires before they were treated. Re-arm timer
> in this case.
>
> Signed-off-by: Jimmy Perchet <jimmy.perchet@parrot.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 0015175..af04b5d 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1284,8 +1284,12 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
> p = priv->dma_tx + entry;
>
> /* Check if the descriptor is owned by the DMA. */
> - if (priv->hw->desc->get_tx_owner(p))
> + if (priv->hw->desc->get_tx_owner(p)) {
> + /* Be sure to harvest remaining descriptor. */
> + mod_timer(&priv->txtimer,
> + STMMAC_COAL_TIMER(priv->tx_coal_timer));
> break;
> + }
why should we reload the timer when clean the tx resource?
This is done in the xmit where as soon as a frame has to be
transmitted it makes sense to reload the timer.
Also I have not clear why the problem happens on 10MBit/s speed
Maybe there is an hidden problem (lock protection)
that should be fixed.
How did you get this problem? Just on low speed and stress the net?
I have never seen it.
peppe
>
> /* Verify tx error by looking at the last segment. */
> last = priv->hw->desc->get_tx_ls(p);
>
^ permalink raw reply
* [PATCH net-next 5/5] bonding: remove bond read lock for bond_3ad_state_machine_handler()
From: Ding Tianhong @ 2013-10-21 8:59 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev
The bond now only attach and detach slave in rtnl lock,
so read_lock for bond could not protect slave list,
replace bond read lock with rtnl lock for bond_3ad_state_machine_handler().
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/net/bonding/bond_3ad.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 187b1b7..d6fe00b 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2068,8 +2068,10 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
struct slave *slave;
struct port *port;
- read_lock(&bond->lock);
-
+ if (!rtnl_trylock()) {
+ queue_delayed_work(bond->wq, &bond->ad_work, ad_delta_in_ticks);
+ return;
+ }
//check if there are any slaves
if (!bond_has_slaves(bond))
goto re_arm;
@@ -2122,9 +2124,8 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
}
re_arm:
+ rtnl_unlock();
queue_delayed_work(bond->wq, &bond->ad_work, ad_delta_in_ticks);
-
- read_unlock(&bond->lock);
}
/**
--
1.8.2.1
^ permalink raw reply related
* Re: [PATCH RFC 1/5] net:stmmac: set threshold/store and forward mode according to mtu size.
From: Giuseppe CAVALLARO @ 2013-10-21 8:47 UTC (permalink / raw)
To: Jimmy Perchet; +Cc: netdev
In-Reply-To: <1381937052-8999-2-git-send-email-jimmy.perchet@parrot.com>
On 10/16/2013 5:24 PM, Jimmy Perchet wrote:
> Threshold mode dma is needed on rx path if jumbo frames are expected.
I think we should not force the threshold mode depending on the mtu.
For example, I worked on hw with rx buffers ~16KiB so able to SF
an oversized frame.
Maybe we could solve this configuration problem at platform time.
We added the fields: force_thresh_dma_mode, force_sf_dma_mode
to cover this scenarios. If these need to be enforced so we can
prepare a patch.
let me know
peppe
>
>
> Signed-off-by: Jimmy Perchet <jimmy.perchet@parrot.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 48 ++++++++++++++++-------
> 1 file changed, 33 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 8d4ccd3..170f043 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1222,22 +1222,40 @@ static void free_dma_desc_resources(struct stmmac_priv *priv)
> * Description: it sets the DMA operation mode: tx/rx DMA thresholds
> * or Store-And-Forward capability.
> */
> -static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
> -{
> - if (priv->plat->force_thresh_dma_mode)
> - priv->hw->dma->dma_mode(priv->ioaddr, tc, tc);
> - else if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) {
> - /*
> - * In case of GMAC, SF mode can be enabled
> - * to perform the TX COE in HW. This depends on:
> - * 1) TX COE if actually supported
> - * 2) There is no bugged Jumbo frame support
> - * that needs to not insert csum in the TDES.
> - */
> - priv->hw->dma->dma_mode(priv->ioaddr, SF_DMA_MODE, SF_DMA_MODE);
> +static void stmmac_dma_operation_mode(int mtu, struct stmmac_priv *priv)
> +{
> + int rx_tc, tx_tc;
> +
> + /*
> + * In case of GMAC, SF mode can be enabled
> + * to perform the TX COE in HW. This depends on:
> + * 1) TX COE if actually supported
> + * 2) There is no bugged Jumbo frame support
> + * that needs to not insert csum in the TDES.
> + */
> + if (priv->plat->tx_coe &&
> + !(priv->plat->bugged_jumbo && (mtu > ETH_DATA_LEN))) {
> tc = SF_DMA_MODE;
> + tx_tc = SF_DMA_MODE;
> } else
> - priv->hw->dma->dma_mode(priv->ioaddr, tc, SF_DMA_MODE);
> + tx_tc = tc;
> +
> + if (mtu > ETH_DATA_LEN && priv->hw_cap_support
> + && !priv->dma_cap.rxfifo_over_2048)
> + rx_tc = tc;
> + else
> + rx_tc = SF_DMA_MODE;
> +
> + if (priv->plat->force_sf_dma_mode) {
> + tc = SF_DMA_MODE;
> + tx_tc = SF_DMA_MODE;
> + rx_tc = SF_DMA_MODE;
> + } else if (priv->plat->force_thresh_dma_mode) {
> + tx_tc = tc;
> + rx_tc = tc;
> + }
> +
> + priv->hw->dma->dma_mode(priv->ioaddr, tx_tc, rx_tc);
> }
>
> /**
> @@ -1687,7 +1705,7 @@ static int stmmac_open(struct net_device *dev)
> stmmac_set_mac(priv->ioaddr, true);
>
> /* Set the HW DMA mode and the COE */
> - stmmac_dma_operation_mode(priv);
> + stmmac_dma_operation_mode(dev->mtu, priv);
>
> /* Extra statistics */
> memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats));
>
^ permalink raw reply
* Re: [PATCH net-next 0/5] bonding: patchset for rcu use in bonding
From: Veaceslav Falico @ 2013-10-21 9:13 UTC (permalink / raw)
To: Ding Tianhong
Cc: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Netdev
In-Reply-To: <5264ECBC.2090208@huawei.com>
On Mon, Oct 21, 2013 at 04:58:36PM +0800, Ding Tianhong wrote:
>Hi:
>
>The Patch Set will remove the invalid lock for bond work queue and replace it
>with rtnl lock, as read lock for bond could not protect slave list any more.
rtnl lock is a lot more expensive than bond lock, and not only for bond,
but for all the networking stack.
Why is the bond->lock invalid? It correctly protects slaves from being
modified concurrently.
I don't see the point in this patchset.
>
>Ding Tianhong (5):
> bonding: remove bond read lock for bond_mii_monitor()
> bonding: remove bond read lock for bond_alb_monitor()
> bonding: remove bond read lock for bond_loadbalance_arp_mon()
> bonding: remove bond read lock for bond_activebackup_arp_mon()
> bonding: remove bond read lock for bond_3ad_state_machine_handler()
>
> drivers/net/bonding/bond_3ad.c | 9 ++--
> drivers/net/bonding/bond_alb.c | 20 ++------
> drivers/net/bonding/bond_main.c | 100 +++++++++++++---------------------------
> 3 files changed, 40 insertions(+), 89 deletions(-)
>
>--
>1.8.2.1
>
>
>
^ permalink raw reply
* Re: [PATCH] packet: Deliver VLAN TPID to userspace
From: Ben Hutchings @ 2013-10-21 9:24 UTC (permalink / raw)
To: Atzm Watanabe; +Cc: Stephen Hemminger, netdev
In-Reply-To: <87k3h9hjen.wl%atzm@stratosphere.co.jp>
On Sat, 2013-10-19 at 15:19 +0900, Atzm Watanabe wrote:
> At Fri, 18 Oct 2013 10:56:55 -0700,
> Stephen Hemminger wrote:
> >
> > On Sat, 19 Oct 2013 02:08:11 +0900
> > Atzm Watanabe <atzm@stratosphere.co.jp> wrote:
> >
> > > diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h
> > > index dbf0666..6e36e0a 100644
> > > --- a/include/uapi/linux/if_packet.h
> > > +++ b/include/uapi/linux/if_packet.h
> > > @@ -83,7 +83,7 @@ struct tpacket_auxdata {
> > > __u16 tp_mac;
> > > __u16 tp_net;
> > > __u16 tp_vlan_tci;
> > > - __u16 tp_padding;
> > > + __u16 tp_vlan_tpid;
> > > };
> > >
> > > /* Rx ring - header status */
> > > @@ -132,12 +132,13 @@ struct tpacket2_hdr {
> > > __u32 tp_sec;
> > > __u32 tp_nsec;
> > > __u16 tp_vlan_tci;
> > > - __u16 tp_padding;
> > > + __u16 tp_vlan_tpid;
> > > };
> > >
> > > struct tpacket_hdr_variant1 {
> > > __u32 tp_rxhash;
> > > __u32 tp_vlan_tci;
> > > + __u32 tp_vlan_tpid;
> > > };
> >
> > The last change will break ABI to userspace applications.
> > You can reuse padding elements; but you can't increase (or shrink)
> > an existing structure.
>
> Thank you for pointing.
> But I have two questions:
>
> - The patch that increases existing structures was posted and
> accepted in the past (e.g 393e52e33c6c26ec7db290dab803bac1bed962d4
> "packet: deliver VLAN TCI to userspace").
> What is the difference between them and my patch?
struct tpacket_auxdata is allowed to grow as it will be written/read
using the cmsg API where the length of each structure is explicit at
run-time.
> - I tested using tools/testing/selftests/net/psock_tpacket.c built
> before applying my patch, and all test cases were passed.
> Also I tested by the code that was listed in
> Documentation/networking/packet_mmap.txt "AF_PACKET TPACKET_V3
> example". It seems that problem was not caused.
> What situation causes the problem that you assumed?
Yes, it looks like it would be safe to grow struct tpacket3_hdr too, as
the length is also explicit at run-time.
(And TPACKET{1,2,3}_HDRLEN should be removed from
include/uapi/linux/if_packet.h, as they are not relevant to userland.)
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH net-next 0/5] bonding: patchset for rcu use in bonding
From: Ding Tianhong @ 2013-10-21 9:27 UTC (permalink / raw)
To: Veaceslav Falico
Cc: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Netdev
In-Reply-To: <20131021091336.GB692@redhat.com>
On 2013/10/21 17:13, Veaceslav Falico wrote:
> On Mon, Oct 21, 2013 at 04:58:36PM +0800, Ding Tianhong wrote:
>> Hi:
>>
>> The Patch Set will remove the invalid lock for bond work queue and replace it
>> with rtnl lock, as read lock for bond could not protect slave list any more.
>
> rtnl lock is a lot more expensive than bond lock, and not only for bond,
> but for all the networking stack.
>
> Why is the bond->lock invalid? It correctly protects slaves from being
> modified concurrently.
>
> I don't see the point in this patchset.
>
yes, rtnl lock is a big lock, but I think bond->lock could not protect
bond_for_each_slave any more, am I miss something?
Ding
>>
>> Ding Tianhong (5):
>> bonding: remove bond read lock for bond_mii_monitor()
>> bonding: remove bond read lock for bond_alb_monitor()
>> bonding: remove bond read lock for bond_loadbalance_arp_mon()
>> bonding: remove bond read lock for bond_activebackup_arp_mon()
>> bonding: remove bond read lock for bond_3ad_state_machine_handler()
>>
>> drivers/net/bonding/bond_3ad.c | 9 ++--
>> drivers/net/bonding/bond_alb.c | 20 ++------
>> drivers/net/bonding/bond_main.c | 100 +++++++++++++---------------------------
>> 3 files changed, 40 insertions(+), 89 deletions(-)
>>
>> --
>> 1.8.2.1
>>
>>
>>
>
>
^ permalink raw reply
* Re: [PATCH net 0/3] ipv6: use rt6i_gateway as nexthop
From: Hannes Frederic Sowa @ 2013-10-21 9:35 UTC (permalink / raw)
To: Julian Anastasov
Cc: David Miller, netdev, netfilter-devel, lvs-devel,
Hideaki YOSHIFUJI
In-Reply-To: <1382272985-1528-1-git-send-email-ja@ssi.bg>
On Sun, Oct 20, 2013 at 03:43:02PM +0300, Julian Anastasov wrote:
> The second patch is an optimization that makes sure
> all resulting routes have rt6i_gateway filled, so that we
> can avoid the complex ipv6_addr_any() call added to rt6_nexthop()
> by patch 1. And it sets rt6i_gateway for local routes, a case
> not handled by patch 1.
Not related to the patch:
That reminds me that Yoshifuji had the idea to cache the results for
ipv6_addr_type in IP6CB to avoid calling this function over and over again.
Maybe we can do the same for rt6_infos to save some cycles here and there.
Also, what do you think about this site:
net/ipv6/ip6_output.c:
411
412 rt = (struct rt6_info *) dst;
413 if (rt->rt6i_flags & RTF_GATEWAY)
414 target = &rt->rt6i_gateway;
415 else
416 target = &hdr->daddr;
417
Our provided skb_dst should come from ip6_route_input, thus ip6_pol_route. So
I assume we have rt6i_gateway == hdr->daddr there, too. It is a bit more
complicated because of possible routing extension headers. Maybe you already
looked at this already?
I just found it while searching which other code paths do emit packets
while xt_TEE is processing (generation of redirects) and could also lead
to stack exhaustion. But the path in ip6_forward seems fine.
Greetings,
Hannes
^ permalink raw reply
* Re: [PATCH net-next 0/5] bonding: patchset for rcu use in bonding
From: Veaceslav Falico @ 2013-10-21 9:35 UTC (permalink / raw)
To: Ding Tianhong
Cc: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Netdev
In-Reply-To: <5264F397.50608@huawei.com>
On Mon, Oct 21, 2013 at 05:27:51PM +0800, Ding Tianhong wrote:
>On 2013/10/21 17:13, Veaceslav Falico wrote:
>> On Mon, Oct 21, 2013 at 04:58:36PM +0800, Ding Tianhong wrote:
>>> Hi:
>>>
>>> The Patch Set will remove the invalid lock for bond work queue and replace it
>>> with rtnl lock, as read lock for bond could not protect slave list any more.
>>
>> rtnl lock is a lot more expensive than bond lock, and not only for bond,
>> but for all the networking stack.
>>
>> Why is the bond->lock invalid? It correctly protects slaves from being
>> modified concurrently.
>>
>> I don't see the point in this patchset.
>>
>
>yes, rtnl lock is a big lock, but I think bond->lock could not protect
>bond_for_each_slave any more, am I miss something?
Why can't it protect bond_for_each_slave()?
>
>Ding
>
>>>
>>> Ding Tianhong (5):
>>> bonding: remove bond read lock for bond_mii_monitor()
>>> bonding: remove bond read lock for bond_alb_monitor()
>>> bonding: remove bond read lock for bond_loadbalance_arp_mon()
>>> bonding: remove bond read lock for bond_activebackup_arp_mon()
>>> bonding: remove bond read lock for bond_3ad_state_machine_handler()
>>>
>>> drivers/net/bonding/bond_3ad.c | 9 ++--
>>> drivers/net/bonding/bond_alb.c | 20 ++------
>>> drivers/net/bonding/bond_main.c | 100 +++++++++++++---------------------------
>>> 3 files changed, 40 insertions(+), 89 deletions(-)
>>>
>>> --
>>> 1.8.2.1
>>>
>>>
>>>
>>
>>
>
>
^ permalink raw reply
* [PATCH net-next v2] bonding: move bond-specific init after enslave happens
From: Veaceslav Falico @ 2013-10-21 9:48 UTC (permalink / raw)
To: netdev; +Cc: jiri, dingtianhong, Veaceslav Falico, Jay Vosburgh,
Andy Gospodarek
As Jiri noted, currently we first do all bonding-specific initialization
(specifically - bond_select_active_slave(bond)) before we actually attach
the slave (so that it becomes visible through bond_for_each_slave() and
friends). This might result in bond_select_active_slave() not seeing the
first/new slave and, thus, not actually selecting an active slave.
Fix this by moving all the bond-related init part after we've actually
completely initialized and linked (via bond_master_upper_dev_link()) the
new slave.
Also, remove the bond_(de/a)ttach_slave(), it's useless to have functions
to ++/-- one int.
After this we have all the initialization of the new slave *before*
linking, and all the stuff that needs to be done on bonding *after* it. It
has also a bonus effect - we can remove the locking on the new slave init
completely, and only use it for bond_select_active_slave().
Reported-by: Jiri Pirko <jiri@resnulli.us>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
Notes:
v1 -> v2:
Move the bond_(de/a)ttach_slave() functionality, and remove these
functions.
drivers/net/bonding/bond_main.c | 65 +++++++++--------------------------------
1 file changed, 14 insertions(+), 51 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d90734f..2daa066 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -967,33 +967,6 @@ void bond_select_active_slave(struct bonding *bond)
}
}
-/*--------------------------- slave list handling ---------------------------*/
-
-/*
- * This function attaches the slave to the end of list.
- *
- * bond->lock held for writing by caller.
- */
-static void bond_attach_slave(struct bonding *bond, struct slave *new_slave)
-{
- bond->slave_cnt++;
-}
-
-/*
- * This function detaches the slave from the list.
- * WARNING: no check is made to verify if the slave effectively
- * belongs to <bond>.
- * Nothing is freed on return, structures are just unchained.
- * If any slave pointer in bond was pointing to <slave>,
- * it should be changed by the calling function.
- *
- * bond->lock held for writing by caller.
- */
-static void bond_detach_slave(struct bonding *bond, struct slave *slave)
-{
- bond->slave_cnt--;
-}
-
#ifdef CONFIG_NET_POLL_CONTROLLER
static inline int slave_enable_netpoll(struct slave *slave)
{
@@ -1471,22 +1444,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
goto err_close;
}
- write_lock_bh(&bond->lock);
-
prev_slave = bond_last_slave(bond);
- bond_attach_slave(bond, new_slave);
new_slave->delay = 0;
new_slave->link_failure_count = 0;
- write_unlock_bh(&bond->lock);
-
- bond_compute_features(bond);
-
bond_update_speed_duplex(new_slave);
- read_lock(&bond->lock);
-
new_slave->last_arp_rx = jiffies -
(msecs_to_jiffies(bond->params.arp_interval) + 1);
for (i = 0; i < BOND_MAX_ARP_TARGETS; i++)
@@ -1547,12 +1511,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
}
}
- write_lock_bh(&bond->curr_slave_lock);
-
switch (bond->params.mode) {
case BOND_MODE_ACTIVEBACKUP:
bond_set_slave_inactive_flags(new_slave);
- bond_select_active_slave(bond);
break;
case BOND_MODE_8023AD:
/* in 802.3ad mode, the internal mechanism
@@ -1578,7 +1539,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
case BOND_MODE_ALB:
bond_set_active_slave(new_slave);
bond_set_slave_inactive_flags(new_slave);
- bond_select_active_slave(bond);
break;
default:
pr_debug("This slave is always active in trunk mode\n");
@@ -1596,10 +1556,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
break;
} /* switch(bond_mode) */
- write_unlock_bh(&bond->curr_slave_lock);
-
- bond_set_carrier(bond);
-
#ifdef CONFIG_NET_POLL_CONTROLLER
slave_dev->npinfo = bond->dev->npinfo;
if (slave_dev->npinfo) {
@@ -1614,8 +1570,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
}
#endif
- read_unlock(&bond->lock);
-
res = netdev_rx_handler_register(slave_dev, bond_handle_frame,
new_slave);
if (res) {
@@ -1629,6 +1583,17 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
goto err_unregister;
}
+ bond->slave_cnt++;
+ bond_compute_features(bond);
+ bond_set_carrier(bond);
+
+ if (USES_PRIMARY(bond->params.mode)) {
+ read_lock(&bond->lock);
+ write_lock_bh(&bond->curr_slave_lock);
+ bond_select_active_slave(bond);
+ write_unlock_bh(&bond->curr_slave_lock);
+ read_unlock(&bond->lock);
+ }
pr_info("%s: enslaving %s as a%s interface with a%s link.\n",
bond_dev->name, slave_dev->name,
@@ -1648,7 +1613,6 @@ err_detach:
vlan_vids_del_by_dev(slave_dev, bond_dev);
write_lock_bh(&bond->lock);
- bond_detach_slave(bond, new_slave);
if (bond->primary_slave == new_slave)
bond->primary_slave = NULL;
if (bond->curr_active_slave == new_slave) {
@@ -1686,7 +1650,6 @@ err_free:
kfree(new_slave);
err_undo_flags:
- bond_compute_features(bond);
/* Enslave of first slave has failed and we need to fix master's mac */
if (!bond_has_slaves(bond) &&
ether_addr_equal(bond_dev->dev_addr, slave_dev->dev_addr))
@@ -1740,6 +1703,9 @@ static int __bond_release_one(struct net_device *bond_dev,
write_unlock_bh(&bond->lock);
+ /* release the slave from its bond */
+ bond->slave_cnt--;
+
bond_upper_dev_unlink(bond_dev, slave_dev);
/* unregister rx_handler early so bond_handle_frame wouldn't be called
* for this slave anymore.
@@ -1764,9 +1730,6 @@ static int __bond_release_one(struct net_device *bond_dev,
bond->current_arp_slave = NULL;
- /* release the slave from its bond */
- bond_detach_slave(bond, slave);
-
if (!all && !bond->params.fail_over_mac) {
if (ether_addr_equal(bond_dev->dev_addr, slave->perm_hwaddr) &&
bond_has_slaves(bond))
--
1.8.4
^ permalink raw reply related
* Re: [PATCHSET net-next v3 00/07] Support for byte queue limits on various drivers
From: Ben Hutchings @ 2013-10-21 9:53 UTC (permalink / raw)
To: Andi Kleen; +Cc: Tino Reichardt, netdev, David S. Miller
In-Reply-To: <87iowrtzlz.fsf@tassilo.jf.intel.com>
On Sun, 2013-10-20 at 14:13 -0700, Andi Kleen wrote:
> Tino Reichardt <milky-kernel@mcmilk.de> writes:
> >
> > Since not all of them are fully tested by now, I added an bql_disable
> > module parameter, which can be used to disable the BQL code.
> >
> > "if (likely(bql_disable == false))" was replaced by
> > "if (unlikely(bql_disable))" ...
>
> If it's untested it should probably be disabled by default,
> until someone tests it.
Right, and module parameters are a pretty poor way to control this.
(It should already be possible to disable BQL through sysfs, anyway.
But there is a distinct lack of documentation in the kernel tree.)
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ 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