* [patch] netfilter: information leaks building packet message
From: Dan Carpenter @ 2013-08-01 9:36 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller,
netfilter-devel, netfilter, coreteam, netdev, kernel-janitors
These structs have a "_pad" member. Also the "phw" structs have an 8
byte "hw_addr[]" array but sometimes only the first 6 bytes are
initialized.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Applies to -next and -mainline.
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 962e979..d92cc31 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -419,6 +419,7 @@ __build_packet_message(struct nfnl_log_net *log,
nfmsg->version = NFNETLINK_V0;
nfmsg->res_id = htons(inst->group_num);
+ memset(&pmsg, 0, sizeof(pmsg));
pmsg.hw_protocol = skb->protocol;
pmsg.hook = hooknum;
@@ -498,7 +499,10 @@ __build_packet_message(struct nfnl_log_net *log,
if (indev && skb->dev &&
skb->mac_header != skb->network_header) {
struct nfulnl_msg_packet_hw phw;
- int len = dev_parse_header(skb, phw.hw_addr);
+ int len;
+
+ memset(&phw, 0, sizeof(phw));
+ len = dev_parse_header(skb, phw.hw_addr);
if (len > 0) {
phw.hw_addrlen = htons(len);
if (nla_put(inst->skb, NFULA_HWADDR, sizeof(phw), &phw))
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index 971ea14..8a703c3 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -463,7 +463,10 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
if (indev && entskb->dev &&
entskb->mac_header != entskb->network_header) {
struct nfqnl_msg_packet_hw phw;
- int len = dev_parse_header(entskb, phw.hw_addr);
+ int len;
+
+ memset(&phw, 0, sizeof(phw));
+ len = dev_parse_header(entskb, phw.hw_addr);
if (len) {
phw.hw_addrlen = htons(len);
if (nla_put(skb, NFQA_HWADDR, sizeof(phw), &phw))
^ permalink raw reply related
* [PATCH v3] net/phy: micrel: Add OF configuration support for ksz9021
From: Sean Cross @ 2013-08-01 9:19 UTC (permalink / raw)
To: Sascha Hauer, Duan Fugang-B38611, netdev@vger.kernel.org,
devicetree@vger.kernel.org
Cc: David Miller, stephen@networkplumber.org, Steven Rostedt,
Sean Cross
In-Reply-To: <1375348757-12856-1-git-send-email-xobs@kosagi.com>
Some boards require custom PHY configuration, for example due to trace
length differences. Add the ability to configure these registers in
order to get the PHY to function on boards that need it.
Because PHYs are auto-detected based on MDIO device IDs, allow PHY
configuration to be specified in the parent Ethernet device node if no
PHY device node is present.
Signed-off-by: Sean Cross <xobs@kosagi.com>
---
.../devicetree/bindings/net/micrel-ksz9021.txt | 19 +++++++
drivers/net/phy/micrel.c | 57 +++++++++++++++++++-
2 files changed, 75 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/net/micrel-ksz9021.txt
diff --git a/Documentation/devicetree/bindings/net/micrel-ksz9021.txt b/Documentation/devicetree/bindings/net/micrel-ksz9021.txt
new file mode 100644
index 0000000..b3e5cd2
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/micrel-ksz9021.txt
@@ -0,0 +1,19 @@
+Micrel KSZ9021 Gigabit Ethernet PHY
+
+Some boards require special tuning values, particularly when it comes to
+clock delays. You can specify clock delay values by adding
+micrel-specific properties to an Ethernet OF device node.
+
+Optional properties:
+- micrel,clk-control-pad-skew : Timing offset for the MII clock line
+- micrel,rx-data-pad-skew : Timing offset for the RX MII pad
+- micrel,tx-data-pad-skew : Timing offset for the TX MII pad
+
+Example:
+ &enet {
+ micrel,clk-control-pad-skew = <0xf0f0>;
+ micrel,rx-data-pad-skew = <0x0000>;
+ micrel,tx-data-pad-skew = <0xffff>;
+ status = "okay";
+ };
+
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 2510435..376d63a 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -25,6 +25,7 @@
#include <linux/module.h>
#include <linux/phy.h>
#include <linux/micrel_phy.h>
+#include <linux/of.h>
/* Operation Mode Strap Override */
#define MII_KSZPHY_OMSO 0x16
@@ -53,6 +54,18 @@
#define KS8737_CTRL_INT_ACTIVE_HIGH (1 << 14)
#define KSZ8051_RMII_50MHZ_CLK (1 << 7)
+/* Write/read to/from extended registers */
+#define MII_KSZPHY_EXTREG 0x0b
+#define KSZPHY_EXTREG_WRITE 0x8000
+
+#define MII_KSZPHY_EXTREG_WRITE 0x0c
+#define MII_KSZPHY_EXTREG_READ 0x0d
+
+/* Extended registers */
+#define MII_KSZPHY_CLK_CONTROL_PAD_SKEW 0x104
+#define MII_KSZPHY_RX_DATA_PAD_SKEW 0x105
+#define MII_KSZPHY_TX_DATA_PAD_SKEW 0x106
+
static int ksz_config_flags(struct phy_device *phydev)
{
int regval;
@@ -65,6 +78,13 @@ static int ksz_config_flags(struct phy_device *phydev)
return 0;
}
+static int kszphy_extended_write(struct phy_device *phydev,
+ u32 regnum, u16 val)
+{
+ phy_write(phydev, MII_KSZPHY_EXTREG, KSZPHY_EXTREG_WRITE | regnum);
+ return phy_write(phydev, MII_KSZPHY_EXTREG_WRITE, val);
+}
+
static int kszphy_ack_interrupt(struct phy_device *phydev)
{
/* bit[7..0] int status, which is a read and clear register. */
@@ -141,6 +161,41 @@ static int ks8051_config_init(struct phy_device *phydev)
return rc < 0 ? rc : 0;
}
+static int ksz9021_config_init(struct phy_device *phydev)
+{
+ struct device *dev = &phydev->dev;
+ struct device_node *of_node = dev->of_node;
+
+ if (!of_node && dev->parent->of_node)
+ of_node = dev->parent->of_node;
+
+ if (of_node) {
+ u32 val;
+
+ if (!of_property_read_u32(of_node,
+ "micrel,clk-control-pad-skew",
+ &val))
+ kszphy_extended_write(phydev,
+ MII_KSZPHY_CLK_CONTROL_PAD_SKEW,
+ val);
+
+ if (!of_property_read_u32(of_node,
+ "micrel,rx-data-pad-skew",
+ &val))
+ kszphy_extended_write(phydev,
+ MII_KSZPHY_RX_DATA_PAD_SKEW,
+ val);
+
+ if (!of_property_read_u32(of_node,
+ "micrel,tx-data-pad-skew",
+ &val))
+ kszphy_extended_write(phydev,
+ MII_KSZPHY_TX_DATA_PAD_SKEW,
+ val);
+ }
+ return 0;
+}
+
#define KSZ8873MLL_GLOBAL_CONTROL_4 0x06
#define KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX (1 << 6)
#define KSZ8873MLL_GLOBAL_CONTROL_4_SPEED (1 << 4)
@@ -281,7 +336,7 @@ static struct phy_driver ksphy_driver[] = {
.name = "Micrel KSZ9021 Gigabit PHY",
.features = (PHY_GBIT_FEATURES | SUPPORTED_Pause),
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
- .config_init = kszphy_config_init,
+ .config_init = ksz9021_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
.ack_interrupt = kszphy_ack_interrupt,
--
1.7.9.5
^ permalink raw reply related
* [PATCH v3] Add OF bindings to Micrel ksz9021 PHY
From: Sean Cross @ 2013-08-01 9:19 UTC (permalink / raw)
To: Sascha Hauer, Duan Fugang-B38611, netdev@vger.kernel.org,
devicetree@vger.kernel.org
Cc: David Miller, stephen@networkplumber.org, Steven Rostedt,
Sean Cross
Some boards require custom parameters be passed to the Micrel PHY.
Allow these boards to specify custom timing parameters in the device
tree node.
Changes since v2:
- limited the scope to just ksz9021 rather than all PHYs
Changes since v1:
- removed redefinition of registers and addresses
Sean Cross (1):
net/phy: micrel: Add OF configuration support for ksz9021
.../devicetree/bindings/net/micrel-ksz9021.txt | 19 +++++++
drivers/net/phy/micrel.c | 57 +++++++++++++++++++-
2 files changed, 75 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/net/micrel-ksz9021.txt
--
1.7.9.5
^ permalink raw reply
* Re: How do I receive vlan tags on an AF_PACKET socket in 3.4 kernel?
From: Ronny Meeus @ 2013-08-01 9:24 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Daniel Borkmann, netdev
In-Reply-To: <1375303651.10515.110.camel@edumazet-glaptop>
On Wed, Jul 31, 2013 at 10:47 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Wed, 2013-07-31 at 22:01 +0200, Ronny Meeus wrote:
>> On Wed, Jul 31, 2013 at 5:09 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> > On Wed, 2013-07-31 at 16:42 +0200, Daniel Borkmann wrote:
>> >
>> >> You can use bpfc (git://github.com/borkmann/netsniff-ng.git), it also has
>> >> an extensive man page. That should probably do it:
>> >>
>> >> $ cat foo
>> >> ld vlant
>> >> jneq #4094, drop
>> >> ret #-1
>> >> drop: ret #0
>> >>
>> >> $ bpfc foo
>> >> { 0x20, 0, 0, 0xfffff02c },
>> >> { 0x15, 0, 1, 0x00000ffe },
>> >> { 0x6, 0, 0, 0xffffffff },
>> >> { 0x6, 0, 0, 0x00000000 },
>> >
>>
>> Thanks Daniel, this is very useful information.
>> I have cloned the repo and compiled the tool myself. It will be very
>> useful in the future.
>>
>> > Thanks Daniel.
>> >
>> > If the load of this BPF fails (because its an old kernel), then load
>> > your old filter.
>> >
>>
>> I created a small test application after I backported the filter code
>> to the 3.4 kernel.
>> I instrumented the kernel with a printk at the moment the
>> vlan_tx_tag_get call is done to see the actual value of the vlan tag
>> since it did not work initially.
>>
>> These are the packets displayed by tcpdump:
>>
>> tcpdump: WARNING: eth-ntb: no IPv4 address assigned
>> tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
>> listening on eth-ntb, link-type EN10MB (Ethernet), capture size 65535 bytes
>> 00:18:49.233283 06:00:00:00:00:80 > f7:00:00:00:ff:ff, ethertype
>> 802.1Q (0x8100), length 64:
>> 0x0000: f700 0000 ffff 0600 0000 0080 8100 affe
>> 0x0010: 08ab 0014 0000 0000 0f00 0001 0096 6000
>> 0x0020: 0096 0000 0001 0000 000d 0000 0000 0000
>> 0x0030: 0000 0000 0000 0000 0000 0000 0000 0000
>>
>> So the Vlan is 0xffe and the priority/CFI field is 0xA.
>> Apparently the value I need to use in the filter is 0xaffe to make it
>> work. Is this normal or is this a bug in the kernel?
>>
>> This is the filter I used:
>> { 0x20, 0, 0, 0xfffff02c }
>> { 0x15, 0, 1, 0x0000affe }
>> { 0x06, 0, 0, 0x00000800 }
>> { 0x06, 0, 0, 0x00000000 }
>>
>> And this is the trace of the kernel and my application:
>>
>> [12529.357172] BPF_S_ANC_VLAN_TAG: affe
>> packets received: 1
>> [12533.020743] BPF_S_ANC_VLAN_TAG: affe
>> packets received: 2
>> [12536.667159] BPF_S_ANC_VLAN_TAG: affe
>> packets received: 3
>> [12540.343857] BPF_S_ANC_VLAN_TAG: affe
>> packets received: 4
>
> Right, vlan_tx_tag_get() gets the whole tag, so you want to mask A with
> 0xfff before the compare (to strip the prio)
>
> ld vlant
> and #4095
> jneq #4094, drop
> ret #-1
> drop: ret #0
>
> or something like that.
>
>
>
OK the receiving side is clear now. Thanks.
Now the sending side.
I created an application that sends packets using libpcap. These
packets are full Ethernet packets, including VLAN tags etc.
If I connect a PC running Wireshark to the Ethernet port I'm sending
on I receive the packets, no issues.
If a start on the device that is sending the packets also the receive
application I created before I do not receive anything.
This is because the filter attached to the kernel by this application
is checking the VLAN tag in metadata of the buffer, which is in this
case not filled in.
If I do not attach a filter to the receiving application all packets I
send are also received by the receiving application, which is what I
expect since all packets sent on a raw socket are received by all
other sockets listening on the same interface.
I have the feeling that there is something wrong with the current
implementation.
In my opinion, the same VLAN processing as done for packets received
from the network (strip vlan and put it in the meta data) should be
done on packets that are sent by an application just before passing
them to other sockets listening on the same interface.
Right?
^ permalink raw reply
* Re: [PATCH v2] net/phy: micrel: Add OF configuration support
From: Sean Cross @ 2013-08-01 9:06 UTC (permalink / raw)
To: Sascha Hauer
Cc: Duan Fugang-B38611, netdev@vger.kernel.org,
devicetree@vger.kernel.org, David Miller,
stephen@networkplumber.org, Steven Rostedt
In-Reply-To: <20130801084728.GE26614@pengutronix.de>
--
Sean Cross
On Thursday, August 1, 2013 at 4:47 PM, Sascha Hauer wrote:
> On Thu, Aug 01, 2013 at 06:53:54AM +0000, Sean Cross wrote:
> > Some boards require custom PHY configuration, for example due to trace
> > length differences. Add the ability to configure these registers in
> > order to get the PHY to function on boards that need it.
> >
> > Because PHYs are auto-detected based on MDIO device IDs, allow PHY
> > configuration to be specified in the parent Ethernet device node if no
> > PHY device node is present.
> >
> > Signed-off-by: Sean Cross <xobs@kosagi.com (mailto:xobs@kosagi.com)>
> > ---
> > .../devicetree/bindings/net/micrel-phy.txt | 20 ++++++++
> > drivers/net/phy/micrel.c | 50 ++++++++++++++++++++
> > 2 files changed, 70 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/net/micrel-phy.txt
> >
> > diff --git a/Documentation/devicetree/bindings/net/micrel-phy.txt b/Documentation/devicetree/bindings/net/micrel-phy.txt
> > new file mode 100644
> > index 0000000..97c1ef2
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/micrel-phy.txt
> > @@ -0,0 +1,20 @@
> > +Micrel KS8737, KSZ8041, KSZ8001, KS8721, KSZ8081, KSZ8091, KSZ8061, KSZ9021,
> > +KSZ9031, Ethernet PHYs, and KSZ8873MLL and KSZ886X Ethernet switches.
> > +
> > +Some boards require special tuning values, particularly when it comes to
> > +clock delays. You can specify clock delay values by adding
> > +micrel-specific properties to an Ethernet OF device node.
> > +
> > +Optional properties:
> > +- micrel,clk-control-pad-skew : Timing offset for the MII clock line
> > +- micrel,rx-data-pad-skew : Timing offset for the RX MII pad
> > +- micrel,tx-data-pad-skew : Timing offset for the TX MII pad
> > +
> > +Example:
> > + &enet {
> > + micrel,clk-control-pad-skew = <0xf0f0>;
> > + micrel,rx-data-pad-skew = <0x0000>;
> > + micrel,tx-data-pad-skew = <0xffff>;
> > + status = "okay";
> > + };
>
>
>
> Given that this patch adds a devicetree binding which I think we now
> agree that this introduces an ABI I think this needs more thought. Some
> questions:
>
> - Does binding this also work for MII controllers external to the MAC?
> Several Marvell SoCs have this situation. MDIO is a bus. With the
> binding above you assume that all devices on the bus use the same
> settings
I'm not quite sure what you mean here. The board I'm testing on is based on an i.MX6q, which has a gigabit MAC and uses a Micrel PHY connected via MDIO. I assumed (perhaps inaccurately) that phy_write() would pick the correct PHY. The example binding is for a single Ethernet device, named "enet". If a board had two Ethernet devices, enet1 and enet2, each could have its own micrel definitions. For example:
&enet1 {
micrel,clk-control-pad-skew = <0xf0f0>;
micrel,rx-data-pad-skew = <0x0000>;
micrel,tx-data-pad-skew = <0xffff>;
status = "okay";
};
&enet2 {
micrel,clk-control-pad-skew = <0x0000>;
micrel,rx-data-pad-skew = <0x0000>;
micrel,tx-data-pad-skew = <0x0000>;
status = "okay";
};
> - You directly put the register contents into dt. This assumes that all
> micrel phys have a compatible register layout. This may be the case
> now, but what's with future phys?
This is a very valid point. I assumed that most Micrel PHYs had similar register sets, but upon closer inspection it seems as though the KSZ9021RN is unique in this regard. I should come up with a new function ksz9021_config_init that does this only for that one PHY, and rename the devicetree doc to reflect that.
> - The pad skew settings are needed for other phys aswell. It might be
> worth introducing a binding which could work for say Artheros phys
> aswell.
I can't comment on other phys, as I'm not familiar with them. How would such a system work? This certainly seems like the most open-ended of the questions.
I'll limit the scope of the patch to the KSZ9021 family of parts, and submit a v3 patch.
^ permalink raw reply
* Re: [PATCH] net: check net.core.somaxconn sysctl values
From: Roman Gushchin @ 2013-08-01 9:04 UTC (permalink / raw)
To: David Miller; +Cc: eric.dumazet, raise.sail, ebiederm, netdev, linux-kernel
In-Reply-To: <20130731.171019.1991802407661623893.davem@davemloft.net>
On 01.08.2013 04:10, David Miller wrote:
> From: Roman Gushchin <klamm@yandex-team.ru>
> Date: Wed, 31 Jul 2013 17:57:35 +0400
>
>> ---
>> net/core/sysctl_net_core.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
>> index cfdb46a..2ff093b 100644
>> --- a/net/core/sysctl_net_core.c
>> +++ b/net/core/sysctl_net_core.c
>> @@ -20,7 +20,9 @@
>
> This patch is against old sources, please respin it against the current
> tree.
>
> Thanks.
>
net: check net.core.somaxconn sysctl values
It's possible to assign an invalid value to the net.core.somaxconn
sysctl variable, because there is no checks at all.
The sk_max_ack_backlog field of the sock structure is defined as
unsigned short. Therefore, the backlog argument in inet_listen()
shouldn't exceed USHRT_MAX. The backlog argument in the listen() syscall
is truncated to the somaxconn value. So, the somaxconn value shouldn't
exceed 65535 (USHRT_MAX).
Also, negative values of somaxconn are meaningless.
before:
$ sysctl -w net.core.somaxconn=256
net.core.somaxconn = 256
$ sysctl -w net.core.somaxconn=65536
net.core.somaxconn = 65536
$ sysctl -w net.core.somaxconn=-100
net.core.somaxconn = -100
after:
$ sysctl -w net.core.somaxconn=256
net.core.somaxconn = 256
$ sysctl -w net.core.somaxconn=65536
error: "Invalid argument" setting key "net.core.somaxconn"
$ sysctl -w net.core.somaxconn=-100
error: "Invalid argument" setting key "net.core.somaxconn"
Based on a prior patch from Changli Gao.
Signed-off-by: Roman Gushchin <klamm@yandex-team.ru>
Reported-by: Changli Gao <xiaosuo@gmail.com>
Suggested-by: Eric Dumazet <edumazet@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
---
net/core/sysctl_net_core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 6609686..7c37dcd 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -21,7 +21,9 @@
#include <net/net_ratelimit.h>
#include <net/busy_poll.h>
+static int zero = 0;
static int one = 1;
+static int ushort_max = USHRT_MAX;
#ifdef CONFIG_RPS
static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
@@ -339,7 +341,9 @@ static struct ctl_table netns_core_table[] = {
.data = &init_net.core.sysctl_somaxconn,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .extra1 = &zero,
+ .extra2 = &ushort_max,
+ .proc_handler = proc_dointvec_minmax
},
{ }
};
--
1.8.1.2
^ permalink raw reply related
* Re: [PATCH v2] net/phy: micrel: Add OF configuration support
From: Sascha Hauer @ 2013-08-01 8:47 UTC (permalink / raw)
To: Sean Cross
Cc: Duan Fugang-B38611, netdev@vger.kernel.org,
devicetree@vger.kernel.org, David Miller,
stephen@networkplumber.org, Steven Rostedt
In-Reply-To: <1375340034-23846-2-git-send-email-xobs@kosagi.com>
On Thu, Aug 01, 2013 at 06:53:54AM +0000, Sean Cross wrote:
> Some boards require custom PHY configuration, for example due to trace
> length differences. Add the ability to configure these registers in
> order to get the PHY to function on boards that need it.
>
> Because PHYs are auto-detected based on MDIO device IDs, allow PHY
> configuration to be specified in the parent Ethernet device node if no
> PHY device node is present.
>
> Signed-off-by: Sean Cross <xobs@kosagi.com>
> ---
> .../devicetree/bindings/net/micrel-phy.txt | 20 ++++++++
> drivers/net/phy/micrel.c | 50 ++++++++++++++++++++
> 2 files changed, 70 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/net/micrel-phy.txt
>
> diff --git a/Documentation/devicetree/bindings/net/micrel-phy.txt b/Documentation/devicetree/bindings/net/micrel-phy.txt
> new file mode 100644
> index 0000000..97c1ef2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/micrel-phy.txt
> @@ -0,0 +1,20 @@
> +Micrel KS8737, KSZ8041, KSZ8001, KS8721, KSZ8081, KSZ8091, KSZ8061, KSZ9021,
> +KSZ9031, Ethernet PHYs, and KSZ8873MLL and KSZ886X Ethernet switches.
> +
> +Some boards require special tuning values, particularly when it comes to
> +clock delays. You can specify clock delay values by adding
> +micrel-specific properties to an Ethernet OF device node.
> +
> +Optional properties:
> +- micrel,clk-control-pad-skew : Timing offset for the MII clock line
> +- micrel,rx-data-pad-skew : Timing offset for the RX MII pad
> +- micrel,tx-data-pad-skew : Timing offset for the TX MII pad
> +
> +Example:
> + &enet {
> + micrel,clk-control-pad-skew = <0xf0f0>;
> + micrel,rx-data-pad-skew = <0x0000>;
> + micrel,tx-data-pad-skew = <0xffff>;
> + status = "okay";
> + };
Given that this patch adds a devicetree binding which I think we now
agree that this introduces an ABI I think this needs more thought. Some
questions:
- Does binding this also work for MII controllers external to the MAC?
Several Marvell SoCs have this situation. MDIO is a bus. With the
binding above you assume that all devices on the bus use the same
settings
- You directly put the register contents into dt. This assumes that all
micrel phys have a compatible register layout. This may be the case
now, but what's with future phys?
- The pad skew settings are needed for other phys aswell. It might be
worth introducing a binding which could work for say Artheros phys
aswell.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply
* [patch net 1/2] ipv6: move peer_addr init into ipv6_add_addr()
From: Jiri Pirko @ 2013-08-01 8:41 UTC (permalink / raw)
To: netdev; +Cc: davem, jbenc, kuznet, jmorris, yoshfuji, kaber
In-Reply-To: <1375346488-1001-1-git-send-email-jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
net/ipv6/addrconf.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index cfdcf7b..a0ce957 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -813,7 +813,8 @@ static u32 inet6_addr_hash(const struct in6_addr *addr)
/* On success it returns ifp with increased reference count */
static struct inet6_ifaddr *
-ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
+ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
+ const struct in6_addr *peer_addr, int pfxlen,
int scope, u32 flags)
{
struct inet6_ifaddr *ifa = NULL;
@@ -863,6 +864,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
}
ifa->addr = *addr;
+ if (peer_addr)
+ ifa->peer_addr = *peer_addr;
spin_lock_init(&ifa->lock);
spin_lock_init(&ifa->state_lock);
@@ -1123,8 +1126,8 @@ retry:
ift = !max_addresses ||
ipv6_count_addresses(idev) < max_addresses ?
- ipv6_add_addr(idev, &addr, tmp_plen, ipv6_addr_scope(&addr),
- addr_flags) : NULL;
+ ipv6_add_addr(idev, &addr, NULL, tmp_plen,
+ ipv6_addr_scope(&addr), addr_flags) : NULL;
if (IS_ERR_OR_NULL(ift)) {
in6_ifa_put(ifp);
in6_dev_put(idev);
@@ -2179,7 +2182,8 @@ ok:
*/
if (!max_addresses ||
ipv6_count_addresses(in6_dev) < max_addresses)
- ifp = ipv6_add_addr(in6_dev, &addr, pinfo->prefix_len,
+ ifp = ipv6_add_addr(in6_dev, &addr, NULL,
+ pinfo->prefix_len,
addr_type&IPV6_ADDR_SCOPE_MASK,
addr_flags);
@@ -2455,15 +2459,13 @@ static int inet6_addr_add(struct net *net, int ifindex, const struct in6_addr *p
prefered_lft = timeout;
}
- ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags);
+ ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags);
if (!IS_ERR(ifp)) {
spin_lock_bh(&ifp->lock);
ifp->valid_lft = valid_lft;
ifp->prefered_lft = prefered_lft;
ifp->tstamp = jiffies;
- if (peer_pfx)
- ifp->peer_addr = *peer_pfx;
spin_unlock_bh(&ifp->lock);
addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev,
@@ -2557,7 +2559,7 @@ static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
{
struct inet6_ifaddr *ifp;
- ifp = ipv6_add_addr(idev, addr, plen, scope, IFA_F_PERMANENT);
+ ifp = ipv6_add_addr(idev, addr, NULL, plen, scope, IFA_F_PERMANENT);
if (!IS_ERR(ifp)) {
spin_lock_bh(&ifp->lock);
ifp->flags &= ~IFA_F_TENTATIVE;
@@ -2683,7 +2685,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr
#endif
- ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, addr_flags);
+ ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags);
if (!IS_ERR(ifp)) {
addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0);
addrconf_dad_start(ifp);
--
1.7.11.7
^ permalink raw reply related
* [patch net 2/2] ipv6: prevent race between address creation and removal
From: Jiri Pirko @ 2013-08-01 8:41 UTC (permalink / raw)
To: netdev; +Cc: davem, jbenc, kuznet, jmorris, yoshfuji, kaber
In-Reply-To: <1375346488-1001-1-git-send-email-jiri@resnulli.us>
From: Jiri Benc <jbenc@redhat.com>
There's a race in IPv6 automatic addess assingment. The address is created
with zero lifetime when it's added to various address lists. Before it gets
assigned the correct lifetime, there's a window where a new address may be
configured. This causes the semi-initiated address to be deleted in
addrconf_verify.
This was discovered as a reference leak caused by concurrent run of
__ipv6_ifa_notify for both RTM_NEWADDR and RTM_DELADDR with the same
address.
Fix this by setting the lifetime before the address is added to
inet6_addr_lst.
A few notes:
1. In addrconf_prefix_rcv, by setting update_lft to zero, the
if (update_lft) { ... } condition is no longer executed for newly
created addresses. This is okay, as the ifp fields are set in
ipv6_add_addr now and ipv6_ifa_notify is called (and has been called)
through addrconf_dad_start.
2. The removal of the whole block under ifp->lock in inet6_addr_add is okay,
too, as tstamp is initialized to jiffies in ipv6_add_addr.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
net/ipv6/addrconf.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index a0ce957..da4241c 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -815,7 +815,7 @@ static u32 inet6_addr_hash(const struct in6_addr *addr)
static struct inet6_ifaddr *
ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
const struct in6_addr *peer_addr, int pfxlen,
- int scope, u32 flags)
+ int scope, u32 flags, u32 valid_lft, u32 prefered_lft)
{
struct inet6_ifaddr *ifa = NULL;
struct rt6_info *rt;
@@ -875,6 +875,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
ifa->scope = scope;
ifa->prefix_len = pfxlen;
ifa->flags = flags | IFA_F_TENTATIVE;
+ ifa->valid_lft = valid_lft;
+ ifa->prefered_lft = prefered_lft;
ifa->cstamp = ifa->tstamp = jiffies;
ifa->tokenized = false;
@@ -1127,7 +1129,8 @@ retry:
ift = !max_addresses ||
ipv6_count_addresses(idev) < max_addresses ?
ipv6_add_addr(idev, &addr, NULL, tmp_plen,
- ipv6_addr_scope(&addr), addr_flags) : NULL;
+ ipv6_addr_scope(&addr), addr_flags,
+ tmp_valid_lft, tmp_prefered_lft) : NULL;
if (IS_ERR_OR_NULL(ift)) {
in6_ifa_put(ifp);
in6_dev_put(idev);
@@ -1139,8 +1142,6 @@ retry:
spin_lock_bh(&ift->lock);
ift->ifpub = ifp;
- ift->valid_lft = tmp_valid_lft;
- ift->prefered_lft = tmp_prefered_lft;
ift->cstamp = now;
ift->tstamp = tmp_tstamp;
spin_unlock_bh(&ift->lock);
@@ -2185,14 +2186,16 @@ ok:
ifp = ipv6_add_addr(in6_dev, &addr, NULL,
pinfo->prefix_len,
addr_type&IPV6_ADDR_SCOPE_MASK,
- addr_flags);
+ addr_flags, valid_lft,
+ prefered_lft);
if (IS_ERR_OR_NULL(ifp)) {
in6_dev_put(in6_dev);
return;
}
- update_lft = create = 1;
+ update_lft = 0;
+ create = 1;
ifp->cstamp = jiffies;
ifp->tokenized = tokenized;
addrconf_dad_start(ifp);
@@ -2213,7 +2216,7 @@ ok:
stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ;
else
stored_lft = 0;
- if (!update_lft && stored_lft) {
+ if (!update_lft && !create && stored_lft) {
if (valid_lft > MIN_VALID_LIFETIME ||
valid_lft > stored_lft)
update_lft = 1;
@@ -2459,15 +2462,10 @@ static int inet6_addr_add(struct net *net, int ifindex, const struct in6_addr *p
prefered_lft = timeout;
}
- ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags);
+ ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags,
+ valid_lft, prefered_lft);
if (!IS_ERR(ifp)) {
- spin_lock_bh(&ifp->lock);
- ifp->valid_lft = valid_lft;
- ifp->prefered_lft = prefered_lft;
- ifp->tstamp = jiffies;
- spin_unlock_bh(&ifp->lock);
-
addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev,
expires, flags);
/*
@@ -2559,7 +2557,8 @@ static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
{
struct inet6_ifaddr *ifp;
- ifp = ipv6_add_addr(idev, addr, NULL, plen, scope, IFA_F_PERMANENT);
+ ifp = ipv6_add_addr(idev, addr, NULL, plen,
+ scope, IFA_F_PERMANENT, 0, 0);
if (!IS_ERR(ifp)) {
spin_lock_bh(&ifp->lock);
ifp->flags &= ~IFA_F_TENTATIVE;
@@ -2685,7 +2684,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr
#endif
- ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags);
+ ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags, 0, 0);
if (!IS_ERR(ifp)) {
addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0);
addrconf_dad_start(ifp);
--
1.7.11.7
^ permalink raw reply related
* [patch net 0/2] ipv6: prevent race between address creation and removal
From: Jiri Pirko @ 2013-08-01 8:41 UTC (permalink / raw)
To: netdev; +Cc: davem, jbenc, kuznet, jmorris, yoshfuji, kaber
Jiri Benc (1):
ipv6: prevent race between address creation and removal
Jiri Pirko (1):
ipv6: move peer_addr init into ipv6_add_addr()
net/ipv6/addrconf.c | 43 ++++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 21 deletions(-)
--
1.7.11.7
^ permalink raw reply
* [PATCH v2] add prefixlength option to "ip rule"
From: Stefan Tomanek @ 2013-08-01 8:32 UTC (permalink / raw)
To: netdev
When configuring a system with multiple network uplinks and default routes, it
is often convenient to reference the main routing table multiple times - but
omitting the default route. Using this modified "ip" utility and the
corresponding kernel patch, this can be achieved by using the following command
sequence:
$ ip route add table secuplink default via 10.42.23.1
$ ip rule add pref 100 table main prefixlength 1
$ ip rule add pref 150 fwmark 0xA table secuplink
With this setup, packets marked 0xA will be processed by the additional routing
table "secuplink", but only if no suitable route in the main routing table can
be found. By using a minimum prefixlength of 1, the default route (/0) of the
table "main" is hidden to packets processed by rule 100; packets traveling to
destinations via more specific routes are processed as usual.
Signed-off-by: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
---
include/linux/fib_rules.h | 2 +-
ip/iprule.c | 19 +++++++++++++++++--
man/man8/ip-rule.8 | 12 ++++++++++++
3 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index 51da65b..59cd31b 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -45,7 +45,7 @@ enum {
FRA_FLOW, /* flow/class id */
FRA_UNUSED6,
FRA_UNUSED7,
- FRA_UNUSED8,
+ FRA_TABLE_PREFIXLEN_MIN,
FRA_TABLE, /* Extended table id */
FRA_FWMASK, /* mask for netfilter mark */
FRA_OIFNAME,
diff --git a/ip/iprule.c b/ip/iprule.c
index a5fcd43..a789863 100644
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -39,6 +39,8 @@ static void usage(void)
fprintf(stderr, " [ prohibit | reject | unreachable ]\n");
fprintf(stderr, " [ realms [SRCREALM/]DSTREALM ]\n");
fprintf(stderr, " [ goto NUMBER ]\n");
+ fprintf(stderr, " SUPPRESSOR\n");
+ fprintf(stderr, "SUPPRESSOR := [ prefixlength NUMBER ]\n");
fprintf(stderr, "TABLE_ID := [ local | main | default | NUMBER ]\n");
exit(-1);
}
@@ -153,9 +155,15 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
}
table = rtm_get_table(r, tb);
- if (table)
+ if (table) {
fprintf(fp, "lookup %s ", rtnl_rttable_n2a(table, b1, sizeof(b1)));
-
+ if (tb[FRA_TABLE_PREFIXLEN_MIN]) {
+ __u8 pl = rta_getattr_u8(tb[FRA_TABLE_PREFIXLEN_MIN]);
+ if (pl) {
+ fprintf(fp, "prefixlength %u ", pl);
+ }
+ }
+ }
if (tb[FRA_FLOW]) {
__u32 to = rta_getattr_u32(tb[FRA_FLOW]);
__u32 from = to>>16;
@@ -310,6 +318,13 @@ static int iprule_modify(int cmd, int argc, char **argv)
addattr32(&req.n, sizeof(req), FRA_TABLE, tid);
}
table_ok = 1;
+ } else if (matches(*argv, "prefixlength") == 0 ||
+ strcmp(*argv, "pl") == 0) {
+ __u8 pl;
+ NEXT_ARG();
+ if (get_u8(&pl, *argv, 0))
+ invarg("prefixlength value is invalid\n", *argv);
+ addattr8(&req.n, sizeof(req), FRA_TABLE_PREFIXLEN_MIN, pl);
} else if (strcmp(*argv, "dev") == 0 ||
strcmp(*argv, "iif") == 0) {
NEXT_ARG();
diff --git a/man/man8/ip-rule.8 b/man/man8/ip-rule.8
index 36e46f1..ad48f6e 100644
--- a/man/man8/ip-rule.8
+++ b/man/man8/ip-rule.8
@@ -43,6 +43,12 @@ ip-rule \- routing policy database management
.IR ADDRESS " ] [ "
.BR prohibit " | " reject " | " unreachable " ] [ " realms
.RI "[" SRCREALM "/]" DSTREALM " ]"
+.I SUPPRESSOR
+
+.ti -8
+.IR SUPPRESSOR " := [ "
+.B prefixlength
+.IR NUMBER " ]"
.ti -8
.IR TABLE_ID " := [ "
@@ -217,6 +223,12 @@ the routing table identifier to lookup if the rule selector matches.
It is also possible to use lookup instead of table.
.TP
+.BI prefixlength " NUMBER"
+only consider routes that have a minimum prefix length of NUMBER.
+Entries inside the referenced table with a lower prefix length
+will be ignored.
+
+.TP
.BI realms " FROM/TO"
Realms to select if the rule matched and the routing table lookup
succeeded. Realm
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH 2/4] USB: XHCI: mark no_sg_limit
From: Oliver Neukum @ 2013-08-01 8:15 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Sarah Sharp, Ming Lei, David S. Miller, Freddy Xin, Eric Dumazet,
Ben Hutchings, Grant Grundler, netdev, linux-usb
In-Reply-To: <20130801073049.GB5026@kroah.com>
On Thu, 2013-08-01 at 15:30 +0800, Greg Kroah-Hartman wrote:
> On Wed, Jul 31, 2013 at 09:40:26AM -0700, Sarah Sharp wrote:
> > On Wed, Jul 31, 2013 at 06:51:47PM +0800, Ming Lei wrote:
> > > This patch marks all xHCI controllers as no_sg_limit since
> > > xHCI supports building packet from discontinuous buffers.
> > >
> > > Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
> > > Signed-off-by: Ming Lei <ming.lei@canonical.com>
> >
> > Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
>
> Is it a requirement that all xhci controllers support sg? I know we are
> starting to see other controllers (the platform code?) so would they
> need to support this as well?
The way XHCI describes transfers allows them to be arbitrary.
Regards
Oliver
^ permalink raw reply
* Re: [Patch net-next] tcp_metrics: rearrange fields to avoid holes
From: Cong Wang @ 2013-08-01 8:13 UTC (permalink / raw)
To: David Miller; +Cc: eric.dumazet, netdev, edumazet, ycheng, ncardwell
In-Reply-To: <20130801.001551.84126063849926109.davem@davemloft.net>
On Thu, 2013-08-01 at 00:15 -0700, David Miller wrote:
> From: Cong Wang <amwang@redhat.com>
> Date: Thu, 01 Aug 2013 10:48:31 +0800
>
> > Please teach me how to do that?
>
> struct inet_addr {
> union {
> u32 v4;
> u32 v6[4];
> };
> };
>
> ie. exactly what that code is using already.
>
> And it's called called inetpeer_addr, we have it already, there is no
> need to make something new.
>
> Making this code use a structure with completely unnecessary and
> unused members is pointless and a step backwards.
Ah, I was thinking to keep it compatible with sockaddr*, actually this
is indeed unnecessary. I am going to define something like:
struct inet_addr_base {
union {
struct in_addr sin_addr;
struct in6_addr sin6_addr;
};
unsigned short int sin_family;
};
which could used by bridge multicast code too.
Thanks for the hint.
^ permalink raw reply
* Re: [PATCH RFC] xfrm{4,6}: only report errors back to local sockets if we don't cross address family
From: Hannes Frederic Sowa @ 2013-08-01 8:11 UTC (permalink / raw)
To: Steffen Klassert; +Cc: netdev, vi0oss
In-Reply-To: <20130730102611.GB25511@secunet.com>
On Tue, Jul 30, 2013 at 12:26:11PM +0200, Steffen Klassert wrote:
> Lets see if anyone else has an opinion to that. I'll go
> and look what we can do if we have to fix it in the IPsec
> code in the meantime.
If you have not yet done so, I would try to find a solution over the weekend.
Thanks,
Hannes
^ permalink raw reply
* Re: [PATCH 4/4] USBNET: ax88179_178a: enable tso if host supports sg dma
From: Ming Lei @ 2013-08-01 8:10 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S. Miller, Greg Kroah-Hartman, Oliver Neukum, Freddy Xin,
Ben Hutchings, Grant Grundler, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1375333461.10515.133.camel@edumazet-glaptop>
On Thu, Aug 1, 2013 at 1:04 PM, Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Thu, 2013-08-01 at 12:41 +0800, Ming Lei wrote:
>
>> From my trace result, lots of linear SKBs are cloned or header-cloned, so
>> it needs skb copy too.
>>
>> Is it normal in xmit path to see cloned SKBs for driver? If not, I can add check
>> to avoid allocation of 8 bytes header for non-cloned skb.
>
> Existing code is not very friendly and very complex.
>
> Sure TCP stack does a clone for every skb from socket write queue,
> but header should be available for pushing 8 bytes.
>
> The !skb_cloned(skb) test should be removed if the memmove() is not
> needed.
>
> Could you try following patch ?
Tested-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
This patch does work, and it will make the patch 4/4 become very
simple, :-)
I will rewrite this one against your patch.
Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [Patch net-next 1/2] net: fix a compile error when CONFIG_NET_LL_RX_POLL is not set
From: Cong Wang @ 2013-08-01 8:08 UTC (permalink / raw)
To: Eliezer Tamir; +Cc: netdev, David S. Miller
In-Reply-To: <51FA060A.2060202@linux.intel.com>
On Thu, 2013-08-01 at 09:54 +0300, Eliezer Tamir wrote:
> On 01/08/2013 06:10, Cong Wang wrote:
> > From: Cong Wang <amwang@redhat.com>
> >
> > When CONFIG_NET_LL_RX_POLL is not set, I got:
> >
> > net/socket.c: In function ‘sock_poll’:
> > net/socket.c:1165:4: error: implicit declaration of function ‘sk_busy_loop’ [-Werror=implicit-function-declaration]
> >
> > Fix this by adding a nop when !CONFIG_NET_LL_RX_POLL.
> >
>
> Good catch!
>
> There is a placeholder function, but it has a typo in the name.
> With all the renaming I made a mistake and called the do-nothing
> function sk_busy_poll while the implemented function is called sk_busy_loop.
>
> so what we need is to rename sk_busy_loop() into sk_busy_poll.
>
Ok.
Thinking about it again, what is the point of your commit commit
89bf1b5a683df497c572c4d3bd3f9c9aa919d773 (net: remove NET_LL_RX_POLL
config menue)? After that commit, CONFIG_NET_LL_RX_POLL is not visible
by user and no other configs select it, also since it defaults to y, it
will be _always_ enabled. If this is really what you want, we can simply
remove all !CONFIG_NET_LL_RX_POLL code.
^ permalink raw reply
* [PATCH net v2 2/2] ipv6: update ip6_rt_last_gc every time GC is run
From: Michal Kubecek @ 2013-08-01 8:04 UTC (permalink / raw)
To: David S. Miller
Cc: Eric Dumazet, netdev, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy
In-Reply-To: <cover.1375343204.git.mkubecek@suse.cz>
As pointed out by Eric Dumazet, net->ipv6.ip6_rt_last_gc should
hold the last time garbage collector was run so that we should
update it whenever fib6_run_gc() calls fib6_clean_all(), not only
if we got there from ip6_dst_gc().
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
net/ipv6/ip6_fib.c | 6 +++++-
net/ipv6/route.c | 4 +---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index d872553..bff3d82 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1634,6 +1634,8 @@ static DEFINE_SPINLOCK(fib6_gc_lock);
void fib6_run_gc(unsigned long expires, struct net *net, bool force)
{
+ unsigned long now;
+
if (force) {
spin_lock_bh(&fib6_gc_lock);
} else if (!spin_trylock_bh(&fib6_gc_lock)) {
@@ -1646,10 +1648,12 @@ void fib6_run_gc(unsigned long expires, struct net *net, bool force)
gc_args.more = icmp6_dst_gc();
fib6_clean_all(net, fib6_age, 0, NULL);
+ now = jiffies;
+ net->ipv6.ip6_rt_last_gc = now;
if (gc_args.more)
mod_timer(&net->ipv6.ip6_fib_timer,
- round_jiffies(jiffies
+ round_jiffies(now
+ net->ipv6.sysctl.ip6_rt_gc_interval));
else
del_timer(&net->ipv6.ip6_fib_timer);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 824c424..b70f897 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1311,7 +1311,6 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg),
static int ip6_dst_gc(struct dst_ops *ops)
{
- unsigned long now = jiffies;
struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops);
int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size;
@@ -1321,13 +1320,12 @@ static int ip6_dst_gc(struct dst_ops *ops)
int entries;
entries = dst_entries_get_fast(ops);
- if (time_after(rt_last_gc + rt_min_interval, now) &&
+ if (time_after(rt_last_gc + rt_min_interval, jiffies) &&
entries <= rt_max_size)
goto out;
net->ipv6.ip6_rt_gc_expire++;
fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size);
- net->ipv6.ip6_rt_last_gc = now;
entries = dst_entries_get_slow(ops);
if (entries < ops->gc_thresh)
net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1;
--
1.8.1.4
^ permalink raw reply related
* [PATCH net v2 1/2] ipv6: prevent fib6_run_gc() contention
From: Michal Kubecek @ 2013-08-01 8:04 UTC (permalink / raw)
To: David S. Miller
Cc: Eric Dumazet, netdev, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy
In-Reply-To: <cover.1375343204.git.mkubecek@suse.cz>
On a high-traffic router with many processors and many IPv6 dst
entries, soft lockup in fib6_run_gc() can occur when number of
entries reaches gc_thresh.
This happens because fib6_run_gc() uses fib6_gc_lock to allow
only one thread to run the garbage collector but ip6_dst_gc()
doesn't update net->ipv6.ip6_rt_last_gc until fib6_run_gc()
returns. On a system with many entries, this can take some time
so that in the meantime, other threads pass the tests in
ip6_dst_gc() (ip6_rt_last_gc is still not updated) and wait for
the lock. They then have to run the garbage collector one after
another which blocks them for quite long.
Resolve this by replacing special value ~0UL of expire parameter
to fib6_run_gc() by explicit "force" parameter to choose between
spin_lock_bh() and spin_trylock_bh() and call fib6_run_gc() with
force=false if gc_thresh is reached but not max_size.
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
include/net/ip6_fib.h | 2 +-
net/ipv6/ip6_fib.c | 19 ++++++++-----------
net/ipv6/ndisc.c | 4 ++--
net/ipv6/route.c | 4 ++--
4 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 2a601e7..48ec25a 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -300,7 +300,7 @@ extern void inet6_rt_notify(int event, struct rt6_info *rt,
struct nl_info *info);
extern void fib6_run_gc(unsigned long expires,
- struct net *net);
+ struct net *net, bool force);
extern void fib6_gc_cleanup(void);
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 5fc9c7a..d872553 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1632,19 +1632,16 @@ static int fib6_age(struct rt6_info *rt, void *arg)
static DEFINE_SPINLOCK(fib6_gc_lock);
-void fib6_run_gc(unsigned long expires, struct net *net)
+void fib6_run_gc(unsigned long expires, struct net *net, bool force)
{
- if (expires != ~0UL) {
+ if (force) {
spin_lock_bh(&fib6_gc_lock);
- gc_args.timeout = expires ? (int)expires :
- net->ipv6.sysctl.ip6_rt_gc_interval;
- } else {
- if (!spin_trylock_bh(&fib6_gc_lock)) {
- mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ);
- return;
- }
- gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval;
+ } else if (!spin_trylock_bh(&fib6_gc_lock)) {
+ mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ);
+ return;
}
+ gc_args.timeout = expires ? (int)expires :
+ net->ipv6.sysctl.ip6_rt_gc_interval;
gc_args.more = icmp6_dst_gc();
@@ -1661,7 +1658,7 @@ void fib6_run_gc(unsigned long expires, struct net *net)
static void fib6_gc_timer_cb(unsigned long arg)
{
- fib6_run_gc(0, (struct net *)arg);
+ fib6_run_gc(0, (struct net *)arg, true);
}
static int __net_init fib6_net_init(struct net *net)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 24c03396..79aa965 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1576,7 +1576,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
switch (event) {
case NETDEV_CHANGEADDR:
neigh_changeaddr(&nd_tbl, dev);
- fib6_run_gc(~0UL, net);
+ fib6_run_gc(0, net, false);
idev = in6_dev_get(dev);
if (!idev)
break;
@@ -1586,7 +1586,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
break;
case NETDEV_DOWN:
neigh_ifdown(&nd_tbl, dev);
- fib6_run_gc(~0UL, net);
+ fib6_run_gc(0, net, false);
break;
case NETDEV_NOTIFY_PEERS:
ndisc_send_unsol_na(dev);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index a8c891a..824c424 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1326,7 +1326,7 @@ static int ip6_dst_gc(struct dst_ops *ops)
goto out;
net->ipv6.ip6_rt_gc_expire++;
- fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net);
+ fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size);
net->ipv6.ip6_rt_last_gc = now;
entries = dst_entries_get_slow(ops);
if (entries < ops->gc_thresh)
@@ -2827,7 +2827,7 @@ int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,
net = (struct net *)ctl->extra1;
delay = net->ipv6.sysctl.flush_delay;
proc_dointvec(ctl, write, buffer, lenp, ppos);
- fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net);
+ fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0);
return 0;
}
--
1.8.1.4
^ permalink raw reply related
* [PATCH net v2 0/2] ipv6: prevent fib6_run_gc() contention
From: Michal Kubecek @ 2013-08-01 8:04 UTC (permalink / raw)
To: David S. Miller
Cc: Eric Dumazet, netdev, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy
On a high-traffic router with many processors and many IPv6 dst entries,
soft lockup in fib6_run_gc() can occur when number of entries reaches
gc_thresh. Prevent this by not waiting for the lock if garbage collector
is already running as we would only run it again as soon as it finished.
v2: as suggested by Eric Dumazet, move update of ip6_rt_last_gc into
fib6_run_gc() so that it reflects every run of garbage collector
rather than only those via ip6_dst_gc()
Michal Kubecek (2):
ipv6: prevent fib6_run_gc() contention
ipv6: update ip6_rt_last_gc every time GC is run
include/net/ip6_fib.h | 2 +-
net/ipv6/ip6_fib.c | 25 +++++++++++++------------
net/ipv6/ndisc.c | 4 ++--
net/ipv6/route.c | 8 +++-----
4 files changed, 19 insertions(+), 20 deletions(-)
--
1.8.1.4
^ permalink raw reply
* RE: [PATCH v2] net/phy: micrel: Add OF configuration support
From: Duan Fugang-B38611 @ 2013-08-01 8:03 UTC (permalink / raw)
To: Sean Cross, netdev@vger.kernel.org, devicetree@vger.kernel.org
Cc: David Miller, stephen@networkplumber.org, Steven Rostedt
In-Reply-To: <1375340034-23846-2-git-send-email-xobs@kosagi.com>
On Thursday, August 1, 2013 at 2:54 PM, Sean Cross wrote:
> Some boards require custom PHY configuration, for example due to trace length differences.
> Add the ability to configure these registers in order to get the PHY to function on boards that need it.
>
> Because PHYs are auto-detected based on MDIO device IDs, allow PHY configuration to be specified in the parent Ethernet device node
> if no PHY device node is present.
>
> Signed-off-by: Sean Cross <xobs@kosagi.com>
Acked-by: Fugang Duan <B38611@freescale.com>
^ permalink raw reply
* Re: [PATCH net-next 5/5] bonding: initial RCU conversion
From: Nikolay Aleksandrov @ 2013-08-01 7:55 UTC (permalink / raw)
To: Ding Tianhong; +Cc: netdev, andy, davem, fubar
In-Reply-To: <51FA0453.5000902@huawei.com>
On 08/01/2013 08:46 AM, Ding Tianhong wrote:
> On 2013/7/31 23:12, Nikolay Aleksandrov wrote:
>> This patch does the initial bonding conversion to RCU. After it the
>> following modes are protected by RCU alone: roundrobin, active-backup,
>> broadcast and xor. Modes ALB/TLB and 3ad still acquire bond->lock for
>> reading, and will be dealt with later. curr_active_slave needs to be
>> dereferenced via rcu in the converted modes because the only thing
>> protecting the slave after this patch is rcu_read_lock, so we need the
>> proper barrier for weakly ordered archs and to make sure we don't have
>> stale pointer. It's not tagged with __rcu yet because there's still work
>> to be done to remove the curr_slave_lock, so sparse will complain when
>> rcu_assign_pointer and rcu_dereference are used, but the alternative to use
>> rcu_dereference_protected would've created much bigger code churn which is
>> more difficult to test and review. That will be converted in time.
>>
>> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
>
>
> great job! but I think you miss come place to replace by rcu protect.
> example: bonding_show_active_slave() still has curr = bond->curr_active_slave,
> so I think you could replace them all and send together.
>
Thanks, I'll fix this. In fact that code always looked racy to me :)
^ permalink raw reply
* Re: [PATCH net-next v2] bonding: fix system hang due to fast igmp timer rescheduling
From: Nikolay Aleksandrov @ 2013-08-01 7:45 UTC (permalink / raw)
To: David Miller; +Cc: netdev, andy, fubar
In-Reply-To: <20130731.170547.33285495878732634.davem@davemloft.net>
On 08/01/2013 02:05 AM, David Miller wrote:
> From: Nikolay Aleksandrov <nikolay@redhat.com>
> Date: Wed, 31 Jul 2013 01:44:06 +0200
>
>> From: "nikolay@redhat.com" <nikolay@redhat.com>
>
> I don't think that "nikolay@redhat.com" is your name. :-)
>
> Please fix this up and resubmit, thanks.
>
hehe nothing like a little git mess, will do. Thanks :-)
^ permalink raw reply
* [PATCH] xfrm: Refactor xfrm_state timer management
From: Fan Du @ 2013-08-01 7:39 UTC (permalink / raw)
To: steffen.klassert; +Cc: davem, herbert, netdev
Current xfrm_state timer management is vulnerable in below several ways:
- Use hrtimer for timer, the timer handler use wall clock checking expire events
commit e3c0d047 "Fix unexpected SA hard expiration after changing date" fix
the partial problem by notify IKED with soft -> expire sequence when user
changing system time forward. But it didn't fix the issue when use changing
system time backwards, which is most crucial as SAs lifetime will be a *bigger*
one when doing so, thus buy much time for cracker.
In short words, changing system time forward/backward can either result in
long long lifetime SAs or sudden SA hard expired first.
It actually can be fixed this by adding more flags, and with more complicated
checking whether system time is being turned forward or backward. I did it and
eventually works well. But it's only for "add time expire", taking care of
"use time expire" will add more logic into timer handler, and much more
complicated.
- When user give "use lifetime" by xfrm user configuration
interface, current xfrm_state timer management will actually turn the timer on
even when no IP packet hit policy, and the "use lifetime" eventually become
"add lifetime".
The culprit is: with one timer for both "add lifetime" and "use lifetime", at the
same time using wall clock to check two expire events. This patch tries to solve
it by:
- Switch real time timer with monotonic timer against any system time changing
- Use "add lifetime" to override "use lifetime" when both applied, as most popular
IKED like Racoon2/StrongSwan use "add lifetime" only.
- Start "add lifetime" timer only when xfrm_state is updated/added
- Start "use lifetime" timer when actually SAs is used.
- Start the timer with soft lifetime interval first, and then in timer handler
rearm timer with hard lifetime to get rid of using wall clock.
Signed-off-by: Fan Du <fan.du@windriver.com>
---
include/net/xfrm.h | 10 ++--
net/xfrm/xfrm_state.c | 140 ++++++++++++++++++++++++-------------------------
2 files changed, 76 insertions(+), 74 deletions(-)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 94ce082..0d76fa4 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -214,8 +214,8 @@ struct xfrm_state {
struct xfrm_lifetime_cur curlft;
struct tasklet_hrtimer mtimer;
- /* used to fix curlft->add_time when changing date */
- long saved_tmo;
+ /* how much seconds when hard expire happen after soft expire */
+ long tmo;
/* Last used time */
unsigned long lastused;
@@ -242,7 +242,11 @@ static inline struct net *xs_net(struct xfrm_state *x)
/* xflags - make enum if more show up */
#define XFRM_TIME_DEFER 1
-#define XFRM_SOFT_EXPIRE 2
+#define XFRM_SA_ADD_MODE 2
+#define XFRM_SA_USE_MODE 4
+#define XFRM_SA_ACQ_MODE 8
+#define XFRM_SA_SOFT_STAGE 16
+#define XFRM_SA_HARD_STAGE 32
enum {
XFRM_STATE_VOID,
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 78f66fa..fc578a3 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -393,10 +393,7 @@ static enum hrtimer_restart xfrm_timer_handler(struct hrtimer * me)
{
struct tasklet_hrtimer *thr = container_of(me, struct tasklet_hrtimer, timer);
struct xfrm_state *x = container_of(thr, struct xfrm_state, mtimer);
- struct net *net = xs_net(x);
- unsigned long now = get_seconds();
long next = LONG_MAX;
- int warn = 0;
int err = 0;
spin_lock(&x->lock);
@@ -404,72 +401,31 @@ static enum hrtimer_restart xfrm_timer_handler(struct hrtimer * me)
goto out;
if (x->km.state == XFRM_STATE_EXPIRED)
goto expired;
- if (x->lft.hard_add_expires_seconds) {
- long tmo = x->lft.hard_add_expires_seconds +
- x->curlft.add_time - now;
- if (tmo <= 0) {
- if (x->xflags & XFRM_SOFT_EXPIRE) {
- /* enter hard expire without soft expire first?!
- * setting a new date could trigger this.
- * workarbound: fix x->curflt.add_time by below:
- */
- x->curlft.add_time = now - x->saved_tmo - 1;
- tmo = x->lft.hard_add_expires_seconds - x->saved_tmo;
- } else
- goto expired;
- }
- if (tmo < next)
- next = tmo;
- }
- if (x->lft.hard_use_expires_seconds) {
- long tmo = x->lft.hard_use_expires_seconds +
- (x->curlft.use_time ? : now) - now;
- if (tmo <= 0)
- goto expired;
- if (tmo < next)
- next = tmo;
- }
- if (x->km.dying)
- goto resched;
- if (x->lft.soft_add_expires_seconds) {
- long tmo = x->lft.soft_add_expires_seconds +
- x->curlft.add_time - now;
- if (tmo <= 0) {
- warn = 1;
- x->xflags &= ~XFRM_SOFT_EXPIRE;
- } else if (tmo < next) {
- next = tmo;
- x->xflags |= XFRM_SOFT_EXPIRE;
- x->saved_tmo = tmo;
- }
- }
- if (x->lft.soft_use_expires_seconds) {
- long tmo = x->lft.soft_use_expires_seconds +
- (x->curlft.use_time ? : now) - now;
- if (tmo <= 0)
- warn = 1;
- else if (tmo < next)
- next = tmo;
- }
+ /* If we reach here from acquire process, we expired surely */
+ if (x->xflags & XFRM_SA_ACQ_MODE)
+ goto expired;
- x->km.dying = warn;
- if (warn)
+ if (x->xflags & XFRM_SA_SOFT_STAGE) {
+ x->xflags &= ~XFRM_SA_SOFT_STAGE;
+ x->xflags |= XFRM_SA_HARD_STAGE;
+ next = x->tmo;
+ x->km.dying = 1;
+ /* Notify AF_KEY listener about soft expire event */
km_state_expired(x, 0, 0);
-resched:
- if (next != LONG_MAX){
- tasklet_hrtimer_start(&x->mtimer, ktime_set(next, 0), HRTIMER_MODE_REL);
+ /* Arm the timer for hard expire event now. */
+ tasklet_hrtimer_start(&x->mtimer, ktime_set(next, 0),
+ HRTIMER_MODE_REL);
+ goto out;
+ } else if (x->xflags & XFRM_SA_HARD_STAGE) {
+ /* Notify AF_KEY listener about hard expire event */
+ goto expired;
+ } else {
+ /* Cann't be here, catch buggy code! */
+ printk(KERN_WARNING "Enter xfrm_state->mtimer handler with unkonw reason!\n");
+ goto out;
}
- goto out;
-
expired:
- if (x->km.state == XFRM_STATE_ACQ && x->id.spi == 0) {
- x->km.state = XFRM_STATE_EXPIRED;
- wake_up(&net->xfrm.km_waitq);
- next = 2;
- goto resched;
- }
-
err = __xfrm_state_delete(x);
if (!err && x->id.spi)
km_state_expired(x, 1, 0);
@@ -499,7 +455,8 @@ struct xfrm_state *xfrm_state_alloc(struct net *net)
INIT_HLIST_NODE(&x->bydst);
INIT_HLIST_NODE(&x->bysrc);
INIT_HLIST_NODE(&x->byspi);
- tasklet_hrtimer_init(&x->mtimer, xfrm_timer_handler, CLOCK_REALTIME, HRTIMER_MODE_ABS);
+ /* Using monotonic clock against any wall clock changing */
+ tasklet_hrtimer_init(&x->mtimer, xfrm_timer_handler, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
setup_timer(&x->rtimer, xfrm_replay_timer_handler,
(unsigned long)x);
x->curlft.add_time = get_seconds();
@@ -872,8 +829,11 @@ found:
h = xfrm_spi_hash(net, &x->id.daddr, x->id.spi, x->id.proto, encap_family);
hlist_add_head(&x->byspi, net->xfrm.state_byspi+h);
}
- x->lft.hard_add_expires_seconds = net->xfrm.sysctl_acq_expires;
- tasklet_hrtimer_start(&x->mtimer, ktime_set(net->xfrm.sysctl_acq_expires, 0), HRTIMER_MODE_REL);
+
+ /* Mark xfrm_state with acquire mode for IKED negotiation timeout */
+ x->xflags |= XFRM_SA_ACQ_MODE;
+ tasklet_hrtimer_start(&x->mtimer, ktime_set(net->xfrm.sysctl_acq_expires, 0),
+ HRTIMER_MODE_REL);
net->xfrm.state_num++;
xfrm_hash_grow_check(net, x->bydst.next != NULL);
} else {
@@ -948,7 +908,22 @@ static void __xfrm_state_insert(struct xfrm_state *x)
hlist_add_head(&x->byspi, net->xfrm.state_byspi+h);
}
- tasklet_hrtimer_start(&x->mtimer, ktime_set(1, 0), HRTIMER_MODE_REL);
+ /* Use "add expire" if user supply them, and start "use expire" later on */
+ x->xflags &= ~XFRM_SA_ACQ_MODE;
+ if (x->lft.soft_use_expires_seconds) {
+ x->xflags |= XFRM_SA_USE_MODE;
+ x->tmo = x->lft.hard_use_expires_seconds - x->lft.soft_use_expires_seconds;
+ } else if (x->lft.soft_add_expires_seconds) {
+ x->xflags |= XFRM_SA_ADD_MODE;
+ x->xflags |= XFRM_SA_SOFT_STAGE;
+ x->tmo = x->lft.hard_add_expires_seconds - x->lft.soft_add_expires_seconds;
+ tasklet_hrtimer_start(&x->mtimer, ktime_set(x->lft.soft_add_expires_seconds, 0), HRTIMER_MODE_REL);
+ } else {
+ /* Cann't be here, catch buggy code */
+ printk("========ERROR: no use time and add time set by user!\n");
+ }
+
+
if (x->replay_maxage)
mod_timer(&x->rtimer, jiffies + x->replay_maxage);
@@ -1048,8 +1023,10 @@ static struct xfrm_state *__find_acq_core(struct net *net, struct xfrm_mark *m,
x->props.reqid = reqid;
x->mark.v = m->v;
x->mark.m = m->m;
- x->lft.hard_add_expires_seconds = net->xfrm.sysctl_acq_expires;
xfrm_state_hold(x);
+
+ /* Mark xfrm_state with acquire mode for IKED negotiation timeout */
+ x->xflags |= XFRM_SA_ACQ_MODE;
tasklet_hrtimer_start(&x->mtimer, ktime_set(net->xfrm.sysctl_acq_expires, 0), HRTIMER_MODE_REL);
list_add(&x->km.all, &net->xfrm.state_all);
hlist_add_head(&x->bydst, net->xfrm.state_bydst+h);
@@ -1333,7 +1310,21 @@ out:
memcpy(&x1->lft, &x->lft, sizeof(x1->lft));
x1->km.dying = 0;
- tasklet_hrtimer_start(&x1->mtimer, ktime_set(1, 0), HRTIMER_MODE_REL);
+
+ x1->xflags &= ~(XFRM_SA_ACQ_MODE | XFRM_SA_USE_MODE | XFRM_SA_ADD_MODE);
+ /* Use "add expire" if user supply them, and we start "use expire" later on */
+ if (x1->lft.soft_use_expires_seconds) {
+ x1->xflags |= XFRM_SA_USE_MODE;
+ x1->tmo = x1->lft.hard_use_expires_seconds - x1->lft.soft_use_expires_seconds;
+ } else if (x1->lft.soft_add_expires_seconds) {
+ x1->xflags |= XFRM_SA_ADD_MODE;
+ x1->xflags |= XFRM_SA_SOFT_STAGE;
+ x1->tmo = x1->lft.hard_add_expires_seconds - x1->lft.soft_add_expires_seconds;
+ tasklet_hrtimer_start(&x1->mtimer, ktime_set(x1->lft.soft_add_expires_seconds, 0), HRTIMER_MODE_REL);
+ } else {
+ /* Cann't be here, catch buggy code */
+ printk("========ERROR: no use time and add time set by user!\n");
+ }
if (x1->curlft.use_time)
xfrm_state_check_expire(x1);
@@ -1351,8 +1342,15 @@ EXPORT_SYMBOL(xfrm_state_update);
int xfrm_state_check_expire(struct xfrm_state *x)
{
- if (!x->curlft.use_time)
+ if (!x->curlft.use_time) {
x->curlft.use_time = get_seconds();
+ if (x->xflags & XFRM_SA_USE_MODE) {
+ /* We turn on xfrm_state timer for "use expire" at this right place */
+ x->xflags |= XFRM_SA_SOFT_STAGE;
+ tasklet_hrtimer_start(&x->mtimer, ktime_set(x->lft.soft_use_expires_seconds, 0),
+ HRTIMER_MODE_REL);
+ }
+ }
if (x->curlft.bytes >= x->lft.hard_byte_limit ||
x->curlft.packets >= x->lft.hard_packet_limit) {
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 2/4] USB: XHCI: mark no_sg_limit
From: Greg Kroah-Hartman @ 2013-08-01 7:30 UTC (permalink / raw)
To: Sarah Sharp
Cc: Ming Lei, David S. Miller, Oliver Neukum, Freddy Xin,
Eric Dumazet, Ben Hutchings, Grant Grundler,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20130731164026.GB5714@xanatos>
On Wed, Jul 31, 2013 at 09:40:26AM -0700, Sarah Sharp wrote:
> On Wed, Jul 31, 2013 at 06:51:47PM +0800, Ming Lei wrote:
> > This patch marks all xHCI controllers as no_sg_limit since
> > xHCI supports building packet from discontinuous buffers.
> >
> > Cc: Sarah Sharp <sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> > Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
>
> Acked-by: Sarah Sharp <sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Is it a requirement that all xhci controllers support sg? I know we are
starting to see other controllers (the platform code?) so would they
need to support this as well?
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [Patch net-next 1/2] net: fix a compile error when CONFIG_NET_LL_RX_POLL is not set
From: Eliezer Tamir @ 2013-08-01 7:29 UTC (permalink / raw)
To: David Miller; +Cc: amwang, netdev
In-Reply-To: <20130801.001803.72283212544630263.davem@davemloft.net>
On 01/08/2013 10:18, David Miller wrote:
>> net/socket.c: In function ‘sock_poll’:
>> net/socket.c:1165:4: error: implicit declaration of function ‘sk_busy_loop’ [-Werror=implicit-function-declaration]
>>
>> Fix this by adding a nop when !CONFIG_NET_LL_RX_POLL.
>>
>> Cc: Eliezer Tamir <eliezer.tamir@linux.intel.com>
>> Cc: David S. Miller <davem@davemloft.net>
>> Signed-off-by: Cong Wang <amwang@redhat.com>
>
> Is this really a net-next specific problem? Doesn't it happen in
> 'net' too?
>
> If so, it should be fixed in 'net', not just 'net-next'.
Both issues are present in net.
And since these are bug fixes, IMHO both patches should go to net.
^ 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