* [PATCH] rndis_host: do not use stack as URB transfer_buffer
From: Jussi Kivilinna @ 2013-08-06 11:42 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA; +Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA
Patch fixes rndis_host not to use stack as URB transfer_buffer. URB buffers need
to be DMA-able, which stack is not.
Patch is only compile tested.
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Jussi Kivilinna <jussi.kivilinna-X3B1VOXEql0@public.gmane.org>
---
drivers/net/usb/rndis_host.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index cc49aac..2f232c3 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -105,7 +105,6 @@ static void rndis_msg_indicate(struct usbnet *dev, struct rndis_indicate *msg,
int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen)
{
struct cdc_state *info = (void *) &dev->data;
- struct usb_cdc_notification notification;
int master_ifnum;
int retval;
int partial;
@@ -140,12 +139,17 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen)
/* Some devices don't respond on the control channel until
* polled on the status channel, so do that first. */
if (dev->driver_info->data & RNDIS_DRIVER_DATA_POLL_STATUS) {
+ struct usb_cdc_notification *notification;
+ notification = kmalloc(sizeof(*notification), GFP_KERNEL);
+ if (!notification)
+ return -ENOMEM;
retval = usb_interrupt_msg(
dev->udev,
usb_rcvintpipe(dev->udev,
dev->status->desc.bEndpointAddress),
- ¬ification, sizeof(notification), &partial,
+ notification, sizeof(*notification), &partial,
RNDIS_CONTROL_TIMEOUT_MS);
+ kfree(notification);
if (unlikely(retval < 0))
return retval;
}
--
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 related
* Re: [PATCH net] ip_gre: fix ipgre_header to return correct offset
From: Eric Dumazet @ 2013-08-06 11:37 UTC (permalink / raw)
To: Timo Teräs; +Cc: netdev, Pravin B Shelar
In-Reply-To: <1375785943-23908-1-git-send-email-timo.teras@iki.fi>
On Tue, 2013-08-06 at 13:45 +0300, Timo Teräs wrote:
> Fix ipgre_header() (header_ops->create) to return the correct
> amount of bytes pushed. Most callers of dev_hard_header() seem
> to care only if it was success, but af_packet.c uses it as
> offset to the skb to copy from userspace only once. In practice
> this fixes packet socket sendto()/sendmsg() to gre tunnels.
>
> Regression introduced in c54419321455631079c7d6e60bc732dd0c5914c5
> ("GRE: Refactor GRE tunneling code.")
>
> Cc: Pravin B Shelar <pshelar@nicira.com>
> Signed-off-by: Timo Teräs <timo.teras@iki.fi>
> ---
> Should go to 3.10-stable too. Without this dmvpn setup does not work
> at all, as opennhrp uses packet sockets to send the nhrp packets.
>
> net/ipv4/ip_gre.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply
* [PATCH] net: flow_dissector: add 802.1ad support
From: Eric Dumazet @ 2013-08-06 11:35 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
Same behavior than 802.1q : finds the encapsulated protocol and
skip 32bit header.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/core/flow_dissector.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index ade9ff1..159737c 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -65,6 +65,7 @@ ipv6:
nhoff += sizeof(struct ipv6hdr);
break;
}
+ case __constant_htons(ETH_P_8021AD):
case __constant_htons(ETH_P_8021Q): {
const struct vlan_hdr *vlan;
struct vlan_hdr _vlan;
^ permalink raw reply related
* Re: Bug: alx: Atheros AR8131/AR8151/AR8152/AR8161 Ethernet driver
From: Johannes Berg @ 2013-08-06 11:32 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Kinley Dorji, Stephen Hemminger, netdev
In-Reply-To: <1375785799.4457.81.camel@edumazet-glaptop>
On Tue, 2013-08-06 at 03:43 -0700, Eric Dumazet wrote:
> > $ ethtool -S eth0
> > no stats available
>
> It seems alx driver does not support stats.
>
> (No ndo_get_stats() and no changes on netdev->stats embedded stats)
>
>
> drivers/net/ethernet/atheros/atl1c/atl1c_main.c provides
> atl1c_get_stats() gathering hardware counters
>
> CC Johannes Berg, let see if he has plan to add them on alx
I don't. There are some stats in the original code at
https://github.com/erikarn/alx, but I removed them because I didn't
really understand what was going on and don't really care much for the
stats in the system I'm using this device on - and based on the driver
I'm not sure I'd use the chip for 'serious' work anyway :)
FWIW, it had ndo_get_stats() but was updating the netdev->stats from
that handler and then returning them, which seemed a bit questionable.
johannes
^ permalink raw reply
* [PATCH] zd1201: do not use stack as URB transfer_buffer
From: Jussi Kivilinna @ 2013-08-06 11:28 UTC (permalink / raw)
To: John W. Linville
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA
Patch fixes zd1201 not to use stack as URB transfer_buffer. URB buffers need
to be DMA-able, which stack is not.
Patch is only compile tested.
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Jussi Kivilinna <jussi.kivilinna-X3B1VOXEql0@public.gmane.org>
---
drivers/net/wireless/zd1201.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index 4941f20..b8ba1f9 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -98,10 +98,12 @@ static int zd1201_fw_upload(struct usb_device *dev, int apfw)
goto exit;
err = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 0x4,
- USB_DIR_IN | 0x40, 0,0, &ret, sizeof(ret), ZD1201_FW_TIMEOUT);
+ USB_DIR_IN | 0x40, 0, 0, buf, sizeof(ret), ZD1201_FW_TIMEOUT);
if (err < 0)
goto exit;
+ memcpy(&ret, buf, sizeof(ret));
+
if (ret & 0x80) {
err = -EIO;
goto exit;
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: [PATCH V2 3/4] bnx2x: Use pci_wait_for_pending_transaction instead of for loop
From: Eilon Greenstein @ 2013-08-06 11:12 UTC (permalink / raw)
To: Vipul Pandya
Cc: linux-pci, bhelgaas, leedom, tomreu, divy, dm, nirranjan, netdev
In-Reply-To: <1375784319-25760-4-git-send-email-vipul@chelsio.com>
On Tue, 2013-08-06 at 15:48 +0530, Vipul Pandya wrote:
> From: Casey Leedom <leedom@chelsio.com>
>
> New routine has been added to avoid duplication of waiting for pending pci
> transaction code. This patch makes use of that routine.
>
> Signed-off-by: Casey Leedom <leedom@chelsio.com>
> Signed-off-by: Vipul Pandya <vipul@chelsio.com>
Thanks Casey!
Acked-by: Eilon Greenstein <eilong@broadcom.com>
^ permalink raw reply
* [PATCH net] ip_gre: fix ipgre_header to return correct offset
From: Timo Teräs @ 2013-08-06 10:45 UTC (permalink / raw)
To: netdev; +Cc: Timo Teräs, Pravin B Shelar
Fix ipgre_header() (header_ops->create) to return the correct
amount of bytes pushed. Most callers of dev_hard_header() seem
to care only if it was success, but af_packet.c uses it as
offset to the skb to copy from userspace only once. In practice
this fixes packet socket sendto()/sendmsg() to gre tunnels.
Regression introduced in c54419321455631079c7d6e60bc732dd0c5914c5
("GRE: Refactor GRE tunneling code.")
Cc: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
---
Should go to 3.10-stable too. Without this dmvpn setup does not work
at all, as opennhrp uses packet sockets to send the nhrp packets.
net/ipv4/ip_gre.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 855004f..c52fee0 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -572,7 +572,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev,
if (daddr)
memcpy(&iph->daddr, daddr, 4);
if (iph->daddr)
- return t->hlen;
+ return t->hlen + sizeof(*iph);
return -(t->hlen + sizeof(*iph));
}
--
1.8.3.4
^ permalink raw reply related
* [PATCH net-next v2 2/2] bonding: unwind on bond_add_vlan failure
From: Nikolay Aleksandrov @ 2013-08-06 10:40 UTC (permalink / raw)
To: netdev; +Cc: andy, fubar, davem
In-Reply-To: <1375785616-5349-1-git-send-email-nikolay@redhat.com>
From: Nikolay Aleksandrov <Nikolay Aleksandrov nikolay@redhat.com>
In case of bond_add_vlan() failure currently we'll have the vlan's
refcnt bumped up in all slaves, but it will never go down because it
failed to get added to the bond, so properly unwind the added vlan if
bond_add_vlan fails.
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
---
v2: no changes
drivers/net/bonding/bond_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 78b0aeb..4264a76 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -455,13 +455,13 @@ static int bond_vlan_rx_add_vid(struct net_device *bond_dev,
if (res) {
pr_err("%s: Error: Failed to add vlan id %d\n",
bond_dev->name, vid);
- return res;
+ goto unwind;
}
return 0;
unwind:
- /* unwind from head to the slave that failed */
+ /* unwind from the slave that failed */
bond_for_each_slave_continue_reverse(bond, slave)
vlan_vid_del(slave->dev, proto, vid);
--
1.8.1.4
^ permalink raw reply related
* [PATCH net-next v2 1/2] bonding: change the bond's vlan syncing functions with the standard ones
From: Nikolay Aleksandrov @ 2013-08-06 10:40 UTC (permalink / raw)
To: netdev; +Cc: andy, fubar, davem
In-Reply-To: <1375785616-5349-1-git-send-email-nikolay@redhat.com>
From: Nikolay Aleksandrov <Nikolay Aleksandrov nikolay@redhat.com>
Now we have vlan_vids_add/del_by_dev() which serve the same purpose as
bond's bond_add/del_vlans_on_slave() with the good side effect of
reverting the changes if one of the additions fails.
There's only 1 change in the behaviour of enslave: if adding of the
vlans to the slave fails, we'll fail the enslaving because otherwise we
might delete some vlan that wasn't added by the bonding.
The only way this may happen is with ENOMEM currently, so we're in trouble
anyway.
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
---
v2: Fail enslavement with an error message if syncing of vlans fails
because otherwise we might delete vlans that weren't added by us.
drivers/net/bonding/bond_main.c | 37 +++++++------------------------------
1 file changed, 7 insertions(+), 30 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 5697043..78b0aeb 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -493,33 +493,6 @@ static int bond_vlan_rx_kill_vid(struct net_device *bond_dev,
return 0;
}
-static void bond_add_vlans_on_slave(struct bonding *bond, struct net_device *slave_dev)
-{
- struct vlan_entry *vlan;
- int res;
-
- list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
- res = vlan_vid_add(slave_dev, htons(ETH_P_8021Q),
- vlan->vlan_id);
- if (res)
- pr_warning("%s: Failed to add vlan id %d to device %s\n",
- bond->dev->name, vlan->vlan_id,
- slave_dev->name);
- }
-}
-
-static void bond_del_vlans_from_slave(struct bonding *bond,
- struct net_device *slave_dev)
-{
- struct vlan_entry *vlan;
-
- list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
- if (!vlan->vlan_id)
- continue;
- vlan_vid_del(slave_dev, htons(ETH_P_8021Q), vlan->vlan_id);
- }
-}
-
/*------------------------------- Link status -------------------------------*/
/*
@@ -1630,7 +1603,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
dev_mc_add(slave_dev, lacpdu_multicast);
}
- bond_add_vlans_on_slave(bond, slave_dev);
+ if (vlan_vids_add_by_dev(slave_dev, bond_dev)) {
+ pr_err("%s: Error: Couldn't add bond vlan ids to %s\n",
+ bond_dev->name, slave_dev->name);
+ goto err_close;
+ }
write_lock_bh(&bond->lock);
@@ -1806,7 +1783,7 @@ err_detach:
if (!USES_PRIMARY(bond->params.mode))
bond_hw_addr_flush(bond_dev, slave_dev);
- bond_del_vlans_from_slave(bond, slave_dev);
+ 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)
@@ -2002,7 +1979,7 @@ static int __bond_release_one(struct net_device *bond_dev,
/* must do this from outside any spinlocks */
bond_destroy_slave_symlinks(bond_dev, slave_dev);
- bond_del_vlans_from_slave(bond, slave_dev);
+ vlan_vids_del_by_dev(slave_dev, bond_dev);
/* If the mode USES_PRIMARY, then this cases was handled above by
* bond_change_active_slave(..., NULL)
--
1.8.1.4
^ permalink raw reply related
* [PATCH net-next v2 0/2] bonding: vlan handling changes
From: Nikolay Aleksandrov @ 2013-08-06 10:40 UTC (permalink / raw)
To: netdev; +Cc: andy, fubar, davem
From: Nikolay Aleksandrov <Nikolay Aleksandrov nikolay@redhat.com>
Hi,
In v2 of these patchset I've dropped the previous patch 01 (vlan 0 fix)
because it'll be taken care of later and these two patches are not
dependent on it.
Patch 01 - switches the bonding to the now standard vlan syncing functions
vlan_vids_add/del_by_dev() and removes the bonding specific ones. In v2
upon vlan addition failure we fail the enslavement with an error message
because otherwise we might delete vlans that weren't added by the bonding.
The only way this may happen is with ENOMEM currently, so we're in trouble
anyway.
Patch 02 - reverts vlan addition in case of bond_add_vlan failure because
otherwise we may get bad vlan refcounts in the slaves.
This patch is queued for net-next because a fix for -net without the list
conversion would mean taking care of special cases and would be really
ugly. Since this bug is not critical, I'd rather have the fix for net-next.
It can happen only with ENOMEM, so again we're already in trouble.
Patches 01 and 02 are not connected and if you decide to drop patch 02
please leave 01 (if accepted).
v2: See the notes, I've explained the changes together and by patch.
Nikolay Aleksandrov (2):
bonding: change the bond's vlan syncing functions with the standard
ones
bonding: unwind on bond_add_vlan failure
drivers/net/bonding/bond_main.c | 41 +++++++++--------------------------------
1 file changed, 9 insertions(+), 32 deletions(-)
--
1.8.1.4
^ permalink raw reply
* Re: Bug: alx: Atheros AR8131/AR8151/AR8152/AR8161 Ethernet driver
From: Eric Dumazet @ 2013-08-06 10:43 UTC (permalink / raw)
To: Kinley Dorji; +Cc: Stephen Hemminger, netdev, Johannes Berg
In-Reply-To: <CACtZaF+nTHiZ03uebya92b=UVLBXAk9jnM-=Pp3GQ6oSNv8ndA@mail.gmail.com>
On Tue, 2013-08-06 at 12:05 +0600, Kinley Dorji wrote:
> No sure what conky is using to read them. This is what I get
>
> $ ip -s -d li show dev eth0
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
> state UP mode DEFAULT qlen 1000
> link/ether 90:2b:34:da:42:fd brd ff:ff:ff:ff:ff:ff promiscuity 0
> RX: bytes packets errors dropped overrun mcast
> 0 0 0 62 0 0
> TX: bytes packets errors dropped carrier collsns
> 0 0 0 0 0 0
>
> $ ethtool -S eth0
> no stats available
It seems alx driver does not support stats.
(No ndo_get_stats() and no changes on netdev->stats embedded stats)
drivers/net/ethernet/atheros/atl1c/atl1c_main.c provides
atl1c_get_stats() gathering hardware counters
CC Johannes Berg, let see if he has plan to add them on alx
^ permalink raw reply
* Re: [PATCH net] net: rename and move busy poll mib counter
From: Eric Dumazet @ 2013-08-06 10:33 UTC (permalink / raw)
To: Eliezer Tamir
Cc: David Miller, Shawn Bohrer, linux-kernel, netdev, Eliezer Tamir
In-Reply-To: <5200CE8A.1090707@linux.intel.com>
On Tue, 2013-08-06 at 13:23 +0300, Eliezer Tamir wrote:
> So, just rename it to busy poll?
> Or maybe just drop the whole patch?
I guess a rename would be fine.
^ permalink raw reply
* [PATCH v2 net-next] net: add SNMP counters tracking incoming ECN bits
From: Eric Dumazet @ 2013-08-06 10:32 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <1375370791.10515.154.camel@edumazet-glaptop>
From: Eric Dumazet <edumazet@google.com>
With GRO/LRO processing, there is a problem because Ip[6]InReceives SNMP
counters do not count the number of frames, but number of aggregated
segments.
Its probably too late to change this now.
This patch adds four new counters, tracking number of frames, regardless
of LRO/GRO, and on a per ECN status basis, for IPv4 and IPv6.
Ip[6]NoECTPkts : Number of packets received with NOECT
Ip[6]ECT1Pkts : Number of packets received with ECT(1)
Ip[6]ECT0Pkts : Number of packets received with ECT(0)
Ip[6]CEPkts : Number of packets received with Congestion Experienced
lph37:~# nstat | egrep "Pkts|InReceive"
IpInReceives 1634137 0.0
Ip6InReceives 3714107 0.0
Ip6InNoECTPkts 19205 0.0
Ip6InECT0Pkts 52651828 0.0
IpExtInNoECTPkts 33630 0.0
IpExtInECT0Pkts 15581379 0.0
IpExtInCEPkts 6 0.0
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
v2: fix a typo in changelog
include/uapi/linux/snmp.h | 4 ++++
net/ipv4/ip_input.c | 8 ++++++++
net/ipv4/proc.c | 7 ++++++-
net/ipv6/ip6_input.c | 6 +++++-
net/ipv6/proc.c | 4 ++++
5 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
index af0a674..60601d2 100644
--- a/include/uapi/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
@@ -51,6 +51,10 @@ enum
IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */
IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */
IPSTATS_MIB_CSUMERRORS, /* InCsumErrors */
+ IPSTATS_MIB_NOECTPKTS, /* InNoECTPkts */
+ IPSTATS_MIB_ECT1PKTS, /* InECT1Pkts */
+ IPSTATS_MIB_ECT0PKTS, /* InECT0Pkts */
+ IPSTATS_MIB_CEPKTS, /* InCEPkts */
__IPSTATS_MIB_MAX
};
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 15e3e68..054a3e9 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -141,6 +141,7 @@
#include <net/icmp.h>
#include <net/raw.h>
#include <net/checksum.h>
+#include <net/inet_ecn.h>
#include <linux/netfilter_ipv4.h>
#include <net/xfrm.h>
#include <linux/mroute.h>
@@ -410,6 +411,13 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
if (iph->ihl < 5 || iph->version != 4)
goto inhdr_error;
+ BUILD_BUG_ON(IPSTATS_MIB_ECT1PKTS != IPSTATS_MIB_NOECTPKTS + INET_ECN_ECT_1);
+ BUILD_BUG_ON(IPSTATS_MIB_ECT0PKTS != IPSTATS_MIB_NOECTPKTS + INET_ECN_ECT_0);
+ BUILD_BUG_ON(IPSTATS_MIB_CEPKTS != IPSTATS_MIB_NOECTPKTS + INET_ECN_CE);
+ IP_ADD_STATS_BH(dev_net(dev),
+ IPSTATS_MIB_NOECTPKTS + (iph->tos & INET_ECN_MASK),
+ max_t(unsigned short, 1, skb_shinfo(skb)->gso_segs));
+
if (!pskb_may_pull(skb, iph->ihl*4))
goto inhdr_error;
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 6577a11..5f5fa61 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -111,7 +111,7 @@ static const struct snmp_mib snmp4_ipstats_list[] = {
SNMP_MIB_SENTINEL
};
-/* Following RFC4293 items are displayed in /proc/net/netstat */
+/* Following items are displayed in /proc/net/netstat */
static const struct snmp_mib snmp4_ipextstats_list[] = {
SNMP_MIB_ITEM("InNoRoutes", IPSTATS_MIB_INNOROUTES),
SNMP_MIB_ITEM("InTruncatedPkts", IPSTATS_MIB_INTRUNCATEDPKTS),
@@ -125,7 +125,12 @@ static const struct snmp_mib snmp4_ipextstats_list[] = {
SNMP_MIB_ITEM("OutMcastOctets", IPSTATS_MIB_OUTMCASTOCTETS),
SNMP_MIB_ITEM("InBcastOctets", IPSTATS_MIB_INBCASTOCTETS),
SNMP_MIB_ITEM("OutBcastOctets", IPSTATS_MIB_OUTBCASTOCTETS),
+ /* Non RFC4293 fields */
SNMP_MIB_ITEM("InCsumErrors", IPSTATS_MIB_CSUMERRORS),
+ SNMP_MIB_ITEM("InNoECTPkts", IPSTATS_MIB_NOECTPKTS),
+ SNMP_MIB_ITEM("InECT1Pkts", IPSTATS_MIB_ECT1PKTS),
+ SNMP_MIB_ITEM("InECT0Pkts", IPSTATS_MIB_ECT0PKTS),
+ SNMP_MIB_ITEM("InCEPkts", IPSTATS_MIB_CEPKTS),
SNMP_MIB_SENTINEL
};
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 2bab2aa..302d6fb 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -44,7 +44,7 @@
#include <net/ip6_route.h>
#include <net/addrconf.h>
#include <net/xfrm.h>
-
+#include <net/inet_ecn.h>
int ip6_rcv_finish(struct sk_buff *skb)
@@ -109,6 +109,10 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
if (hdr->version != 6)
goto err;
+ IP6_ADD_STATS_BH(dev_net(dev), idev,
+ IPSTATS_MIB_NOECTPKTS +
+ (ipv6_get_dsfield(hdr) & INET_ECN_MASK),
+ max_t(unsigned short, 1, skb_shinfo(skb)->gso_segs));
/*
* RFC4291 2.5.3
* A packet received on an interface with a destination address
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 51c3285..091d066 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -91,6 +91,10 @@ static const struct snmp_mib snmp6_ipstats_list[] = {
SNMP_MIB_ITEM("Ip6InBcastOctets", IPSTATS_MIB_INBCASTOCTETS),
SNMP_MIB_ITEM("Ip6OutBcastOctets", IPSTATS_MIB_OUTBCASTOCTETS),
/* IPSTATS_MIB_CSUMERRORS is not relevant in IPv6 (no checksum) */
+ SNMP_MIB_ITEM("Ip6InNoECTPkts", IPSTATS_MIB_NOECTPKTS),
+ SNMP_MIB_ITEM("Ip6InECT1Pkts", IPSTATS_MIB_ECT1PKTS),
+ SNMP_MIB_ITEM("Ip6InECT0Pkts", IPSTATS_MIB_ECT0PKTS),
+ SNMP_MIB_ITEM("Ip6InCEPkts", IPSTATS_MIB_CEPKTS),
SNMP_MIB_SENTINEL
};
^ permalink raw reply related
* Re: [Patch net-next v2 5/8] sunrpc: use generic union inet_addr
From: Jeff Layton @ 2013-08-06 10:28 UTC (permalink / raw)
To: Cong Wang
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, David S. Miller, Trond Myklebust,
J. Bruce Fields, linux-nfs-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1375672445.32485.8.camel@cr0>
On Mon, 05 Aug 2013 11:14:05 +0800
Cong Wang <amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> On Fri, 2013-08-02 at 09:36 -0400, Jeff Layton wrote:
> > On Fri, 2 Aug 2013 15:14:31 +0800
> > Cong Wang <amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> >
> > > From: Cong Wang <amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > >
> > > sunrpc defines some helper functions for sockaddr, actually they
> > > can re-use the generic functions for union inet_addr too.
> >
> > Only some of these patches in this series have made it to lists to
> > which I'm subscribed, so I may be missing some context here...
> >
> > I'm not sure I really understand the value of "union inet_addr". Why
> > not just use the conventional method of passing around "struct sockaddr"
> > pointers, and then casting them to struct sockaddr_in/sockaddr_in6
> > depending on what the sa_family is set to?
>
> Yes.
>
> >
> > With that you wouldn't need to leave the (now pointless) rpc_* wrappers
> > in place and could just call your new helpers directly.
> >
>
> J. Bruce asked the same question, see:
> http://marc.info/?l=linux-nfs&m=137475685903460&w=2
>
Not exactly...
He asked why you were keeping the wrappers and you replied that it was
because you didn't want to change all of the callers of rpc_get_port.
That's a fair enough answer to his question.
My question is a bit more fundamental: Why are you using this new union
in your patches instead of simply passing around "struct sockaddr"
pointers? If you did that, then you could simply replace all of the
rpc_* wrappers with your generic ones, since you wouldn't need to do
the cast to this (seemingly unnecessary) union.
FWIW, I too am happy to see these routines moved to common code. I just
wonder whether it might make more sense to use the existing convention
instead of this new union.
--
Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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 3/3] net: wireless: rt2x00: Staticize rt2x00queue_pause_queue_nocheck()
From: Gertjan van Wingerde @ 2013-08-06 10:27 UTC (permalink / raw)
To: Jingoo Han
Cc: David S. Miller, netdev, linux-wireless@vger.kernel.org,
Ivo van Doorn, Helmut Schaa
In-Reply-To: <000801ce927f$fc7549d0$f55fdd70$@samsung.com>
On Tue, Aug 6, 2013 at 10:36 AM, Jingoo Han <jg1.han@samsung.com> wrote:
> rt2x00queue_pause_queue_nocheck()is used only in this file.
> Fix the following sparse warning:
>
> drivers/net/wireless/rt2x00/rt2x00queue.c:939:6: warning: symbol 'rt2x00queue_pause_queue_nocheck' was not declared. Should it be
> static?
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
> ---
> drivers/net/wireless/rt2x00/rt2x00queue.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
> index aa95c6c..6c8a33b 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
> +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
> @@ -936,7 +936,7 @@ void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index)
> spin_unlock_irqrestore(&queue->index_lock, irqflags);
> }
>
> -void rt2x00queue_pause_queue_nocheck(struct data_queue *queue)
> +static void rt2x00queue_pause_queue_nocheck(struct data_queue *queue)
> {
> switch (queue->qid) {
> case QID_AC_VO:
> --
> 1.7.10.4
>
>
--
---
Gertjan
^ permalink raw reply
* [PATCH V2 4/4] pci: Use pci_wait_for_pending_transaction instead of for loop
From: Vipul Pandya @ 2013-08-06 10:18 UTC (permalink / raw)
To: linux-pci
Cc: bhelgaas, leedom, tomreu, vipul, divy, dm, nirranjan, eilong,
netdev
In-Reply-To: <1375784319-25760-1-git-send-email-vipul@chelsio.com>
From: Casey Leedom <leedom@chelsio.com>
New routine has been added to avoid duplication of waiting for pending pci
transaction code. This patch makes use of that function.
Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
---
V2: Added pci_wait_for_pending_transaction routine and replaced it at respective
places. Made the patch series for the same.
V2: Used dev->msix_cap directly for capability offset
V2: Removed use of 'rc' variable.
drivers/pci/quirks.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 4a64fc4..ea9108d 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3126,9 +3126,6 @@ static int reset_intel_generic_dev(struct pci_dev *dev, int probe)
static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe)
{
- int i;
- u16 status;
-
/*
* http://www.intel.com/content/dam/doc/datasheet/82599-10-gbe-controller-datasheet.pdf
*
@@ -3140,20 +3137,9 @@ static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe)
if (probe)
return 0;
- /* Wait for Transaction Pending bit clean */
- for (i = 0; i < 4; i++) {
- if (i)
- msleep((1 << (i - 1)) * 100);
-
- pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &status);
- if (!(status & PCI_EXP_DEVSTA_TRPND))
- goto clear;
- }
-
- dev_err(&dev->dev, "transaction is not cleared; "
- "proceeding with reset anyway\n");
+ if (!pci_wait_for_pending_transaction(dev))
+ dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n");
-clear:
pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
msleep(100);
--
1.8.0
^ permalink raw reply related
* [PATCH V2 1/4] pci: Add pci_wait_for_pending_transaction to wait for pending pci transaction
From: Vipul Pandya @ 2013-08-06 10:18 UTC (permalink / raw)
To: linux-pci
Cc: bhelgaas, leedom, tomreu, vipul, divy, dm, nirranjan, eilong,
netdev
In-Reply-To: <1375784319-25760-1-git-send-email-vipul@chelsio.com>
From: Casey Leedom <leedom@chelsio.com>
New routine to avoid duplication of waiting for pending pci transaction code.
Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
---
V2: Added pci_wait_for_pending_transaction routine and replaced it at respective
places. Made the patch series for the same.
V2: Used dev->msix_cap directly for capability offset
V2: Removed use of 'rc' variable.
drivers/pci/pci.c | 38 +++++++++++++++++++++++++-------------
include/linux/pci.h | 1 +
2 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a8d5fd0..7d6ce2e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3159,19 +3159,17 @@ int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask)
}
EXPORT_SYMBOL(pci_set_dma_seg_boundary);
-static int pcie_flr(struct pci_dev *dev, int probe)
+/**
+ * pci_wait_for_pending_transaction - waits for pending transaction
+ * @dev: the PCI device to operate on
+ *
+ * Return 0 if transaction is pending 1 otherwise.
+ */
+int pci_wait_for_pending_transaction(struct pci_dev *dev)
{
int i;
- u32 cap;
u16 status;
- pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &cap);
- if (!(cap & PCI_EXP_DEVCAP_FLR))
- return -ENOTTY;
-
- if (probe)
- return 0;
-
/* Wait for Transaction Pending bit clean */
for (i = 0; i < 4; i++) {
if (i)
@@ -3179,13 +3177,27 @@ static int pcie_flr(struct pci_dev *dev, int probe)
pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &status);
if (!(status & PCI_EXP_DEVSTA_TRPND))
- goto clear;
+ return 1;
}
- dev_err(&dev->dev, "transaction is not cleared; "
- "proceeding with reset anyway\n");
+ return 0;
+}
+EXPORT_SYMBOL(pci_wait_for_pending_transaction);
+
+static int pcie_flr(struct pci_dev *dev, int probe)
+{
+ u32 cap;
+
+ pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &cap);
+ if (!(cap & PCI_EXP_DEVCAP_FLR))
+ return -ENOTTY;
+
+ if (probe)
+ return 0;
+
+ if (!pci_wait_for_pending_transaction(dev))
+ dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n");
-clear:
pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
msleep(100);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0fd1f15..e647001 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -914,6 +914,7 @@ bool pci_check_and_unmask_intx(struct pci_dev *dev);
void pci_msi_off(struct pci_dev *dev);
int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
+int pci_wait_for_pending_transaction(struct pci_dev *dev);
int pcix_get_max_mmrbc(struct pci_dev *dev);
int pcix_get_mmrbc(struct pci_dev *dev);
int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
--
1.8.0
^ permalink raw reply related
* Re: [PATCH net] net: rename and move busy poll mib counter
From: Eliezer Tamir @ 2013-08-06 10:23 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, Shawn Bohrer, linux-kernel, netdev, Eliezer Tamir
In-Reply-To: <1375784088.4457.74.camel@edumazet-glaptop>
On 06/08/2013 13:14, Eric Dumazet wrote:
> On Tue, 2013-08-06 at 12:52 +0300, Eliezer Tamir wrote:
>> Move the low latency mib counter to the ip section.
>> Rename it from low latency to busy poll.
>>
>> Reported-by: Shawn Bohrer <sbohrer@rgmadvisors.com>
>> Signed-off-by: Eliezer Tamir <eliezer.tamir@linux.intel.com>
>> ---
>
> Well, it should not be part of IP mib, but a socket one (not existing so
> far)
>
> Linux MIB already contains few non TCP counters :
>
> LINUX_MIB_ARPFILTER
> LINUX_MIB_IPRPFILTER
>
> Its mostly populated by TCP counters, sure.
So, just rename it to busy poll?
Or maybe just drop the whole patch?
^ permalink raw reply
* [PATCH V2 3/4] bnx2x: Use pci_wait_for_pending_transaction instead of for loop
From: Vipul Pandya @ 2013-08-06 10:18 UTC (permalink / raw)
To: linux-pci
Cc: bhelgaas, leedom, tomreu, vipul, divy, dm, nirranjan, eilong,
netdev
In-Reply-To: <1375784319-25760-1-git-send-email-vipul@chelsio.com>
From: Casey Leedom <leedom@chelsio.com>
New routine has been added to avoid duplication of waiting for pending pci
transaction code. This patch makes use of that routine.
Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
---
V2: Added pci_wait_for_pending_transaction routine and replaced it at respective
places. Made the patch series for the same.
V2: Used dev->msix_cap directly for capability offset
V2: Removed use of 'rc' variable.
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index e5da078..c51d2f8 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9935,8 +9935,6 @@ static int bnx2x_prev_mark_path(struct bnx2x *bp, bool after_undi)
static int bnx2x_do_flr(struct bnx2x *bp)
{
- int i;
- u16 status;
struct pci_dev *dev = bp->pdev;
if (CHIP_IS_E1x(bp)) {
@@ -9951,20 +9949,8 @@ static int bnx2x_do_flr(struct bnx2x *bp)
return -EINVAL;
}
- /* Wait for Transaction Pending bit clean */
- for (i = 0; i < 4; i++) {
- if (i)
- msleep((1 << (i - 1)) * 100);
-
- pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &status);
- if (!(status & PCI_EXP_DEVSTA_TRPND))
- goto clear;
- }
-
- dev_err(&dev->dev,
- "transaction is not cleared; proceeding with reset anyway\n");
-
-clear:
+ if (!pci_wait_for_pending_transaction(dev))
+ dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n");
BNX2X_DEV_INFO("Initiating FLR\n");
bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0);
--
1.8.0
^ permalink raw reply related
* [PATCH V2 2/4] pci: Enable bus master till the FLR completes
From: Vipul Pandya @ 2013-08-06 10:18 UTC (permalink / raw)
To: linux-pci
Cc: bhelgaas, leedom, tomreu, vipul, divy, dm, nirranjan, eilong,
netdev
In-Reply-To: <1375784319-25760-1-git-send-email-vipul@chelsio.com>
From: Casey Leedom <leedom@chelsio.com>
T4 can wedge if there are DMAs in flight within the chip and Bus master has
been disabled. We need to have it on till the Function Level Reset completes.
T4 can also suffer a Head Of Line blocking problem if MSI-X interrupts are
disabled before the FLR has completed.
Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
---
V2: Added pci_wait_for_pending_transaction routine and replaced it at respective
places. Made the patch series for the same.
V2: Used dev->msix_cap directly for capability offset
V2: Removed use of 'rc' variable.
drivers/pci/quirks.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 2e2ea22..4a64fc4 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3208,6 +3208,83 @@ reset_complete:
return 0;
}
+/*
+ * Device-specific reset method for Chelsio T4-based adapters.
+ */
+static int reset_chelsio_generic_dev(struct pci_dev *dev, int probe)
+{
+ u16 old_command;
+ u16 msix_flags;
+
+ /*
+ * If this isn't a Chelsio T4-based device, return -ENOTTY indicating
+ * that we have no device-specific reset method.
+ */
+ if ((dev->device & 0xf000) != 0x4000)
+ return -ENOTTY;
+
+ /*
+ * If this is the "probe" phase, return 0 indicating that we can
+ * reset this device.
+ */
+ if (probe)
+ return 0;
+
+ /*
+ * T4 can wedge if their are DMAs in flight within the chip and Bus
+ * master has been disabled. We need to have it on till the Function
+ * Level Reset completes. (BUS_MASTER is disabled in
+ * pci_reset_function()).
+ */
+ pci_read_config_word(dev, PCI_COMMAND, &old_command);
+ pci_write_config_word(dev, PCI_COMMAND,
+ old_command | PCI_COMMAND_MASTER);
+
+ /*
+ * Perform the actual device function reset, saving and restoring
+ * configuration information around the reset.
+ */
+ pci_save_state(dev);
+
+ /*
+ * T4 also suffers a Head-Of-Line blocking problem if MSI-X interrupts
+ * are disabled when an MSI-X interrupt message needs to be delivered.
+ * So we briefly re-enable MSI-X interrupts for the duration of the
+ * FLR. The pci_restore_state() below will restore the original
+ * MSI-X state.
+ */
+ pci_read_config_word(dev, dev->msix_cap+PCI_MSIX_FLAGS, &msix_flags);
+ if ((msix_flags & PCI_MSIX_FLAGS_ENABLE) == 0)
+ pci_write_config_word(dev, dev->msix_cap+PCI_MSIX_FLAGS,
+ msix_flags |
+ PCI_MSIX_FLAGS_ENABLE |
+ PCI_MSIX_FLAGS_MASKALL);
+
+ /*
+ * Start of pcie_flr() code sequence. This reset code is a copy of
+ * the guts of pcie_flr() because that's not an exported function.
+ */
+
+ if (!pci_wait_for_pending_transaction(dev))
+ dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n");
+
+ pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
+ msleep(100);
+
+ /*
+ * End of pcie_flr() code sequence.
+ */
+
+ /*
+ * Restore the configuration information (BAR values, etc.) including
+ * the original PCI Configuration Space Command word, and return
+ * success.
+ */
+ pci_restore_state(dev);
+ pci_write_config_word(dev, PCI_COMMAND, old_command);
+ return 0;
+}
+
#define PCI_DEVICE_ID_INTEL_82599_SFP_VF 0x10ed
#define PCI_DEVICE_ID_INTEL_IVB_M_VGA 0x0156
#define PCI_DEVICE_ID_INTEL_IVB_M2_VGA 0x0166
@@ -3221,6 +3298,8 @@ static const struct pci_dev_reset_methods pci_dev_reset_methods[] = {
reset_ivb_igd },
{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
reset_intel_generic_dev },
+ { PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
+ reset_chelsio_generic_dev },
{ 0 }
};
--
1.8.0
^ permalink raw reply related
* [PATCH V2 0/4] Enable bus master till the FLR completes for Chelsio T4
From: Vipul Pandya @ 2013-08-06 10:18 UTC (permalink / raw)
To: linux-pci
Cc: bhelgaas, leedom, tomreu, vipul, divy, dm, nirranjan, eilong,
netdev
This patch series adds device specific reset method for Chelsio T4 adapters.
The series also adds new routine, pci_wait_for_pending_transaction, to wait for
pending pci transaction. There are few places where waiting for pending pci
transaction code was duplicated. This patch series also replaces occurances of
duplicate code.
This patch series is built against Bjorn Helgaas pci tree next branch. We would
like to merge this series via the same.
I have Cced respective maintainers of the modified drivers. Kindly review and
let us know in case of any review comments.
Thanks,
Vipul Pandya
V2: Added pci_wait_for_pending_transaction routine and replaced it at respective
places. Made the patch series for the same.
V2: Used dev->msix_cap directly for capability offset
V2: Removed use of 'rc' variable.
Casey Leedom (4):
pci: Add pci_wait_for_pending_transaction to wait for pending pci
transaction
pci: Enable bus master till the FLR completes
bnx2x: Use pci_wait_for_pending_transaction instead of for loop
pci: Use pci_wait_for_pending_transaction instead of for loop
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 18 +----
drivers/pci/pci.c | 38 ++++++----
drivers/pci/quirks.c | 97 ++++++++++++++++++++----
include/linux/pci.h | 1 +
4 files changed, 109 insertions(+), 45 deletions(-)
--
1.8.0
^ permalink raw reply
* Re: [PATCH net] net: rename and move busy poll mib counter
From: Eric Dumazet @ 2013-08-06 10:14 UTC (permalink / raw)
To: Eliezer Tamir
Cc: David Miller, Shawn Bohrer, linux-kernel, netdev, Eliezer Tamir
In-Reply-To: <20130806095207.5887.2196.stgit@ladj378.jer.intel.com>
On Tue, 2013-08-06 at 12:52 +0300, Eliezer Tamir wrote:
> Move the low latency mib counter to the ip section.
> Rename it from low latency to busy poll.
>
> Reported-by: Shawn Bohrer <sbohrer@rgmadvisors.com>
> Signed-off-by: Eliezer Tamir <eliezer.tamir@linux.intel.com>
> ---
Well, it should not be part of IP mib, but a socket one (not existing so
far)
Linux MIB already contains few non TCP counters :
LINUX_MIB_ARPFILTER
LINUX_MIB_IPRPFILTER
Its mostly populated by TCP counters, sure.
^ permalink raw reply
* Re: [PATCH for 3.4 2/2] macvtap: do not zerocopy if iov needs more pages than MAX_SKB_FRAGS
From: Michael S. Tsirkin @ 2013-08-06 10:04 UTC (permalink / raw)
To: Jason Wang; +Cc: netdev, davem
In-Reply-To: <1375781359-5764-2-git-send-email-jasowang@redhat.com>
On Tue, Aug 06, 2013 at 05:29:19PM +0800, Jason Wang wrote:
> commit ece793fcfc417b3925844be88a6a6dc82ae8f7c6 upstream.
>
> We try to linearize part of the skb when the number of iov is greater than
> MAX_SKB_FRAGS. This is not enough since each single vector may occupy more than
> one pages, so zerocopy_sg_fromiovec() may still fail and may break the guest
> network.
>
> Solve this problem by calculate the pages needed for iov before trying to do
> zerocopy and switch to use copy instead of zerocopy if it needs more than
> MAX_SKB_FRAGS.
>
> This is done through introducing a new helper to count the pages for iov, and
> call uarg->callback() manually when switching from zerocopy to copy to notify
> vhost.
>
> We can do further optimization on top.
>
> This bug were introduced from b92946e2919134ebe2a4083e4302236295ea2a73
> (macvtap: zerocopy: validate vectors before building skb).
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/net/macvtap.c | 62 +++++++++++++++++++++++++++++-------------------
> 1 files changed, 37 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index 5151f06..77ce8b2 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -642,6 +642,28 @@ static int macvtap_skb_to_vnet_hdr(const struct sk_buff *skb,
> return 0;
> }
>
> +static unsigned long iov_pages(const struct iovec *iv, int offset,
> + unsigned long nr_segs)
> +{
> + unsigned long seg, base;
> + int pages = 0, len, size;
> +
> + while (nr_segs && (offset >= iv->iov_len)) {
> + offset -= iv->iov_len;
> + ++iv;
> + --nr_segs;
> + }
> +
> + for (seg = 0; seg < nr_segs; seg++) {
> + base = (unsigned long)iv[seg].iov_base + offset;
> + len = iv[seg].iov_len - offset;
> + size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT;
> + pages += size;
> + offset = 0;
> + }
> +
> + return pages;
> +}
>
> /* Get packet from user space buffer */
> static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
> @@ -688,31 +710,15 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
> if (unlikely(count > UIO_MAXIOV))
> goto err;
>
> - if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY))
> - zerocopy = true;
> -
> - if (zerocopy) {
> - /* Userspace may produce vectors with count greater than
> - * MAX_SKB_FRAGS, so we need to linearize parts of the skb
> - * to let the rest of data to be fit in the frags.
> - */
> - if (count > MAX_SKB_FRAGS) {
> - copylen = iov_length(iv, count - MAX_SKB_FRAGS);
> - if (copylen < vnet_hdr_len)
> - copylen = 0;
> - else
> - copylen -= vnet_hdr_len;
> - }
> - /* There are 256 bytes to be copied in skb, so there is enough
> - * room for skb expand head in case it is used.
> - * The rest buffer is mapped from userspace.
> - */
> - if (copylen < vnet_hdr.hdr_len)
> - copylen = vnet_hdr.hdr_len;
> - if (!copylen)
> - copylen = GOODCOPY_LEN;
> + if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY)) {
> + copylen = vnet_hdr.hdr_len ? vnet_hdr.hdr_len : GOODCOPY_LEN;
> linear = copylen;
> - } else {
> + if (iov_pages(iv, vnet_hdr_len + copylen, count)
> + <= MAX_SKB_FRAGS)
> + zerocopy = true;
> + }
> +
> + if (!zerocopy) {
> copylen = len;
> linear = vnet_hdr.hdr_len;
> }
> @@ -724,9 +730,15 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
>
> if (zerocopy)
> err = zerocopy_sg_from_iovec(skb, iv, vnet_hdr_len, count);
> - else
> + else {
> err = skb_copy_datagram_from_iovec(skb, 0, iv, vnet_hdr_len,
> len);
> + if (!err && m && m->msg_control) {
> + struct ubuf_info *uarg = m->msg_control;
> + uarg->callback(uarg);
> + }
> + }
> +
> if (err)
> goto err_kfree;
>
> --
> 1.7.1
^ permalink raw reply
* Re: [PATCH for 3.4 1/2] vhost: zerocopy: poll vq in zerocopy callback
From: Michael S. Tsirkin @ 2013-08-06 10:04 UTC (permalink / raw)
To: Jason Wang; +Cc: netdev, davem
In-Reply-To: <1375781359-5764-1-git-send-email-jasowang@redhat.com>
On Tue, Aug 06, 2013 at 05:29:18PM +0800, Jason Wang wrote:
> commit c70aa540c7a9f67add11ad3161096fb95233aa2e upstream.
>
> We add used and signal guest in worker thread but did not poll the virtqueue
> during the zero copy callback. This may lead the missing of adding and
> signalling during zerocopy. Solve this by polling the virtqueue and let it
> wakeup the worker during callback.
>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/vhost/vhost.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 1a9e2a9..a50cb9c 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -1603,6 +1603,7 @@ void vhost_zerocopy_callback(struct ubuf_info *ubuf)
> struct vhost_ubuf_ref *ubufs = ubuf->ctx;
> struct vhost_virtqueue *vq = ubufs->vq;
>
> + vhost_poll_queue(&vq->poll);
> /* set len = 1 to mark this desc buffers done DMA */
> vq->heads[ubuf->desc].len = VHOST_DMA_DONE_LEN;
> kref_put(&ubufs->kref, vhost_zerocopy_done_signal);
> --
> 1.7.1
^ permalink raw reply
* [net-next 6/6] net: use skb_copy_datagram_from_iovec() in zerocopy_sg_from_iovec()
From: Jason Wang @ 2013-08-06 9:45 UTC (permalink / raw)
To: davem, mst, netdev, linux-kernel; +Cc: Jason Wang
In-Reply-To: <1375782308-10565-1-git-send-email-jasowang@redhat.com>
Use skb_copy_datagram_from_iovec() to avoid code duplication and make it easy to
be read. Also we can do the skipping inside the zero-copy loop.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
net/core/datagram.c | 37 ++++++++++---------------------------
1 files changed, 10 insertions(+), 27 deletions(-)
diff --git a/net/core/datagram.c b/net/core/datagram.c
index badcd93..af814e7 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -591,48 +591,31 @@ int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
int offset, size_t count)
{
int len = iov_length(from, count) - offset;
- int copy = skb_headlen(skb);
- int size, offset1 = 0;
+ int copy = min_t(int, skb_headlen(skb), len);
+ int size;
int i = 0;
- /* Skip over from offset */
- while (count && (offset >= from->iov_len)) {
- offset -= from->iov_len;
- ++from;
- --count;
- }
-
/* copy up to skb headlen */
- while (count && (copy > 0)) {
- size = min_t(unsigned int, copy, from->iov_len - offset);
- if (copy_from_user(skb->data + offset1, from->iov_base + offset,
- size))
- return -EFAULT;
- if (copy > size) {
- ++from;
- --count;
- offset = 0;
- } else
- offset += size;
- copy -= size;
- offset1 += size;
- }
+ if (skb_copy_datagram_from_iovec(skb, 0, from, offset, copy))
+ return -EFAULT;
- if (len == offset1)
+ if (len == copy)
return 0;
+ offset += copy;
while (count--) {
struct page *page[MAX_SKB_FRAGS];
int num_pages;
unsigned long base;
unsigned long truesize;
- len = from->iov_len - offset;
- if (!len) {
- offset = 0;
+ /* Skip over from offset and copied */
+ if (offset >= from->iov_len) {
+ offset -= from->iov_len;
++from;
continue;
}
+ len = from->iov_len - offset;
base = (unsigned long)from->iov_base + offset;
size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT;
if (i + size > MAX_SKB_FRAGS)
--
1.7.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox