* Re: [PATCH 17/11]Optimize the upload speed for PPP connection.
From: Alexander Clouter @ 2009-11-17 17:37 UTC (permalink / raw)
To: linux-kernel; +Cc: netdev
In-Reply-To: <4B0278D9.6030806@gmail.com>
William Allen Simpson <william.allen.simpson@gmail.com> wrote:
>
> And your trailer boilerplate badly breaks the system, because it's
> missing the SMTP email standard "--" line in front of it.
>
*ahem* s/^--$/^-- $/ *ahem*
Two hyphens followed by a space.
Cheers
--
Alexander Clouter
.sigmonster says: Everything you know is wrong!
^ permalink raw reply
* Re: [PATCH 1/5]net: PPP buffer too small for higher speed connections
From: Lennart Sorensen @ 2009-11-17 17:21 UTC (permalink / raw)
To: fangxiaozhi 00110321
Cc: davem, netdev, linux-kernel, william.allen.simpson, jarkao2
In-Reply-To: <fb8cc3511cffa.1cffafb8cc351@huawei.com>
On Tue, Nov 17, 2009 at 07:59:05PM +0800, fangxiaozhi 00110321 wrote:
> From: fangxiaozhi <huananhu@huawei.com>
> 1. This patch is based on the kernel of 2.6.32-rc7
> 2. In this patch, we enlarge the out buffer size to optimize the upload speed for the ppp connection. Then it can support the upload of HSUPA data cards.
> Signed-off-by: fangxiaozhi <huananhu@huawei.com>
> -----------------------------------------------------------------------------------------
> --- a/drivers/net/ppp_async.c 2009-10-12 05:43:56.000000000 +0800
> +++ b/drivers/net/ppp_async.c 2009-10-15 16:29:56.000000000 +0800
> @@ -36,7 +36,7 @@
>
> #define PPP_VERSION "2.4.2"
>
> -#define OBUFSIZE 256
> +#define OBUFSIZE 4096
>
> /* Structure for storing local state. */
> struct asyncppp {
I don't know what an HSUPA connection is, so what kind of speed is that?
I am just wondering if this would affect ppp on other connections that
are async (in a positive manner that is).
--
Len Sorensen
^ permalink raw reply
* Re: [net-next-2.6 PATCH 1/2] ethtool: Add PHY type to ethtool get_drvinfo
From: Stephen Hemminger @ 2009-11-17 17:07 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: davem, netdev, gospo, Peter P Waskiewicz Jr, Jeff Kirsher
In-Reply-To: <20091117161309.11341.9165.stgit@localhost.localdomain>
On Tue, 17 Nov 2009 08:13:24 -0800
Jeff Kirsher <jeffrey.t.kirsher@intel.com> wrote:
> From: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
>
> Allow the PHY type to be passed from a driver to ethtool when
> ethtool -i ethX is called. With newer network cards having SFP
> and SFP+ PHY cages, this information can be useful, especially
> if the NIC supports hot-swapping of the PHY modules.
>
> Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
Maybe revive usage of connector port in ethtool rather than adding new API?
It is already there but values are out of date with current hardware.
^ permalink raw reply
* Re: [RFC] mac80211: disallow bridging managed/adhoc interfaces
From: Johannes Berg @ 2009-11-17 17:05 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Michael Buesch, netdev, linux-wireless, Felix Fietkau
In-Reply-To: <20091117090420.0434edc3@nehalam>
[-- Attachment #1: Type: text/plain, Size: 444 bytes --]
On Tue, 2009-11-17 at 09:04 -0800, Stephen Hemminger wrote:
> Then how does this work now? And will your change break it?
>
> kvm1
> /
> ====> wlan0 --- bridge-- kvm2
> \
> kvm3
What's the type of wlan0? If it's managed, i.e. connected to an AP,
it /doesn't/ actually work now, which is my point.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [RFC] mac80211: disallow bridging managed/adhoc interfaces
From: Stephen Hemminger @ 2009-11-17 17:04 UTC (permalink / raw)
To: Johannes Berg; +Cc: Michael Buesch, netdev, linux-wireless, Felix Fietkau
In-Reply-To: <1258476223.21197.0.camel-YfaajirXv2244ywRPIzf9A@public.gmane.org>
On Tue, 17 Nov 2009 17:43:43 +0100
Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org> wrote:
> On Tue, 2009-11-17 at 08:37 -0800, Stephen Hemminger wrote:
>
> > But there are people bridging wireless, and hostap even has a mode for
> > that.
>
> But that's the AP side, which this patch doesn't attempt to prevent. It
> just makes no sense to bridge when connected to an AP or part of an
> IBSS.
>
Then how does this work now? And will your change break it?
kvm1
/
====> wlan0 --- bridge-- kvm2
\
kvm3
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [net-next-2.6 PATCH] net: device name allocation cleanups
From: Stephen Hemminger @ 2009-11-17 17:01 UTC (permalink / raw)
To: Octavian Purdila; +Cc: netdev
In-Reply-To: <200911171849.03870.opurdila@ixiacom.com>
On Tue, 17 Nov 2009 18:49:03 +0200
Octavian Purdila <opurdila@ixiacom.com> wrote:
> Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
> ---
You have merged the dev_alloc_name into all the registration paths.
Before it was possible for device to call register_netdevice with a name
with a % in it. Only if it did dev_alloc_name or register_netdev would
the %d be interpreted.
So this patch causes a change which may be visible in user space.
--
^ permalink raw reply
* [net-next-2.6 PATCH] net: device name allocation cleanups
From: Octavian Purdila @ 2009-11-17 16:49 UTC (permalink / raw)
To: netdev
Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
---
net/core/dev.c | 58 +++++++++++++------------------------------------------
1 files changed, 14 insertions(+), 44 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 4b24d79..6226960 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -862,6 +862,9 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)
unsigned long *inuse;
struct net_device *d;
+ if (!dev_valid_name(name))
+ return -EINVAL;
+
p = strnchr(name, IFNAMSIZ-1, '%');
if (p) {
/*
@@ -901,7 +904,9 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)
* when the name is long and there isn't enough space left
* for the digits, or if all bits are used.
*/
- return -ENFILE;
+ if (p)
+ return -ENFILE;
+ return -EEXIST;
}
/**
@@ -956,22 +961,14 @@ int dev_change_name(struct net_device *dev, const char *newname)
if (dev->flags & IFF_UP)
return -EBUSY;
- if (!dev_valid_name(newname))
- return -EINVAL;
-
if (strncmp(newname, dev->name, IFNAMSIZ) == 0)
return 0;
memcpy(oldname, dev->name, IFNAMSIZ);
- if (strchr(newname, '%')) {
- err = dev_alloc_name(dev, newname);
- if (err < 0)
- return err;
- } else if (__dev_get_by_name(net, newname))
- return -EEXIST;
- else
- strlcpy(dev->name, newname, IFNAMSIZ);
+ err = dev_alloc_name(dev, newname);
+ if (err < 0)
+ return err;
rollback:
/* For now only devices in the initial network namespace
@@ -4864,8 +4861,6 @@ EXPORT_SYMBOL(netdev_fix_features);
int register_netdevice(struct net_device *dev)
{
- struct hlist_head *head;
- struct hlist_node *p;
int ret;
struct net *net = dev_net(dev);
@@ -4894,26 +4889,10 @@ int register_netdevice(struct net_device *dev)
}
}
- if (!dev_valid_name(dev->name)) {
- ret = -EINVAL;
- goto err_uninit;
- }
-
dev->ifindex = dev_new_index(net);
if (dev->iflink == -1)
dev->iflink = dev->ifindex;
- /* Check for existence of name */
- head = dev_name_hash(net, dev->name);
- hlist_for_each(p, head) {
- struct net_device *d
- = hlist_entry(p, struct net_device, name_hlist);
- if (!strncmp(d->name, dev->name, IFNAMSIZ)) {
- ret = -EEXIST;
- goto err_uninit;
- }
- }
-
/* Fix illegal checksum combinations */
if ((dev->features & NETIF_F_HW_CSUM) &&
(dev->features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
@@ -5038,11 +5017,9 @@ int register_netdev(struct net_device *dev)
* If the name is a format string the caller wants us to do a
* name allocation.
*/
- if (strchr(dev->name, '%')) {
- err = dev_alloc_name(dev, dev->name);
- if (err < 0)
- goto out;
- }
+ err = dev_alloc_name(dev, dev->name);
+ if (err < 0)
+ goto out;
err = register_netdevice(dev);
out:
@@ -5461,16 +5438,9 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
/* We get here if we can't use the current device name */
if (!pat)
goto out;
- if (!dev_valid_name(pat))
- goto out;
- if (strchr(pat, '%')) {
- if (__dev_alloc_name(net, pat, buf) < 0)
- goto out;
- destname = buf;
- } else
- destname = pat;
- if (__dev_get_by_name(net, destname))
+ if (__dev_alloc_name(net, pat, buf) < 0)
goto out;
+ destname = buf;
}
/*
--
1.5.6.5
^ permalink raw reply related
* Re: [RFC] mac80211: disallow bridging managed/adhoc interfaces
From: Johannes Berg @ 2009-11-17 16:43 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Michael Buesch, netdev, linux-wireless, Felix Fietkau
In-Reply-To: <20091117083741.1b165274@nehalam>
[-- Attachment #1: Type: text/plain, Size: 310 bytes --]
On Tue, 2009-11-17 at 08:37 -0800, Stephen Hemminger wrote:
> But there are people bridging wireless, and hostap even has a mode for
> that.
But that's the AP side, which this patch doesn't attempt to prevent. It
just makes no sense to bridge when connected to an AP or part of an
IBSS.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [RFC] mac80211: disallow bridging managed/adhoc interfaces
From: Stephen Hemminger @ 2009-11-17 16:37 UTC (permalink / raw)
To: Johannes Berg; +Cc: Michael Buesch, netdev, linux-wireless, Felix Fietkau
In-Reply-To: <1258466868.3682.13.camel-YfaajirXv2244ywRPIzf9A@public.gmane.org>
On Tue, 17 Nov 2009 15:07:48 +0100
Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org> wrote:
> On Tue, 2009-11-17 at 15:04 +0100, Michael Buesch wrote:
> > On Tuesday 17 November 2009 14:46:25 Johannes Berg wrote:
> > > --- wireless-testing.orig/net/bridge/br_if.c 2009-11-17 14:19:17.000000000 +0100
> > > +++ wireless-testing/net/bridge/br_if.c 2009-11-17 14:20:03.000000000 +0100
> > > @@ -390,6 +390,10 @@ int br_add_if(struct net_bridge *br, str
> > > if (dev->br_port != NULL)
> > > return -EBUSY;
> > >
> > > + /* No bridging devices that dislike that (e.g. wireless) */
> > > + if (dev->priv_flags & IFF_DONT_BRIDGE)
> > > + return -EINVAL;
> >
> > -EOPNOTSUPP?
> > That would probably produce a better error message in userspace.
But there are people bridging wireless, and hostap even has a mode for
that. Especially people are bridging to wireless when the other interfaces
are VMs.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: Subject: [PATCH 5/6] bna: Brocade 10Gb Ethernet device driver
From: Stephen Hemminger @ 2009-11-17 16:35 UTC (permalink / raw)
To: Rasesh Mody; +Cc: netdev@vger.kernel.org, Adapter Linux Open SRC Team
In-Reply-To: <CBE1CC7A31453F4CA63C13EFCE6A0F6C05BAD1DD1B@HQ-EXCH-7.corp.brocade.com>
On Tue, 17 Nov 2009 00:32:45 -0800
Rasesh Mody <rmody@brocade.com> wrote:
> > +
> > +#define wwn_t u64
> > +#define lun_t u64
>
> "No need for obfuscation, at least use a typedef."
>
> Hi Stephen,
>
> When using a typedef in place of #define for wwn_t we are getting check-patch warning. Is it advisable to use a typedef?
>
> - Rasesh
People disagree but my opinion on typedef's is they are ok as long as:
* a structure or integral type (ie not a pointer)
* encapsulates some semantic meaning (be32, spin_lock, irq_return)
* used in several places
* not just a data structure
The other option is just do a global replace.
What you were doing with #define is a weaker form of typedef. Which
is worse.
--
^ permalink raw reply
* Re: [net-next-2.6 PATCH 1/2] ethtool: Add PHY type to ethtool get_drvinfo
From: Ben Hutchings @ 2009-11-17 16:33 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: davem, netdev, gospo, Peter P Waskiewicz Jr
In-Reply-To: <20091117161309.11341.9165.stgit@localhost.localdomain>
On Tue, 2009-11-17 at 08:13 -0800, Jeff Kirsher wrote:
> From: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
>
> Allow the PHY type to be passed from a driver to ethtool when
> ethtool -i ethX is called. With newer network cards having SFP
> and SFP+ PHY cages, this information can be useful, especially
> if the NIC supports hot-swapping of the PHY modules.
[...]
I think this information belongs in ethtool_cmd, in the port and/or
transceiver fields.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [net-next] bnx2x: Don't set netdev->trans_start
From: Vladislav Zolotarov @ 2009-11-17 16:16 UTC (permalink / raw)
To: davem; +Cc: netdev
Setting dev->trans_start caused spurious watchdog warnings.
Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
drivers/net/bnx2x_main.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index bdecd42..77ba135 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -2557,7 +2557,6 @@ static void bnx2x_e1h_disable(struct bnx2x *bp)
int port = BP_PORT(bp);
netif_tx_disable(bp->dev);
- bp->dev->trans_start = jiffies; /* prevent tx timeout */
REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 0);
@@ -7098,7 +7097,6 @@ static void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw)
bnx2x_int_disable_sync(bp, disable_hw);
bnx2x_napi_disable(bp);
netif_tx_disable(bp->dev);
- bp->dev->trans_start = jiffies; /* prevent tx timeout */
}
/*
@@ -10282,7 +10280,6 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
num_pkts++;
fp_tx->tx_bd_prod += 2; /* start + pbd */
- bp->dev->trans_start = jiffies;
udelay(100);
--
1.6.3.3
^ permalink raw reply related
* Re: [PATCH net-next-2.6] can: fix setting mcp251x bit timing on open
From: Wolfgang Grandegger @ 2009-11-17 16:23 UTC (permalink / raw)
To: Christian Pellegrin
Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1258474844-10239-1-git-send-email-chripell-VaTbYqLCNhc@public.gmane.org>
Christian Pellegrin wrote:
> Signed-off-by: Christian Pellegrin <chripell-VaTbYqLCNhc@public.gmane.org>
Signed-off-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
^ permalink raw reply
* Re: [net-next-2.6 PATCH v2] allow access to sysfs_groups member
From: Kurt Van Dijck @ 2009-11-17 16:21 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20091116084612.3654bdd1@nehalam>
On Mon, Nov 16, 2009 at 08:46:12AM -0800, Stephen Hemminger wrote:
>
[...]
>
Stephen,
Thanks for your review.
Kurt
^ permalink raw reply
* [PATCH net-next-2.6] can: fix setting mcp251x bit timing on open
From: Christian Pellegrin @ 2009-11-17 16:20 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
netdev-u79uwXL29TY76Z2rM5mHXA, wg-5Yr1BZd7O62+XT7JhA+gdA,
pthomas8589-Re5JQEeQqe8AvxtiuMwx3w
Cc: Christian Pellegrin
Signed-off-by: Christian Pellegrin <chripell-VaTbYqLCNhc@public.gmane.org>
---
drivers/net/can/mcp251x.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 8f48f4b..78b1b69 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -594,13 +594,7 @@ static int mcp251x_do_set_bittiming(struct net_device *net)
static int mcp251x_setup(struct net_device *net, struct mcp251x_priv *priv,
struct spi_device *spi)
{
- int ret;
-
- ret = open_candev(net);
- if (ret) {
- dev_err(&spi->dev, "unable to set initial baudrate!\n");
- return ret;
- }
+ mcp251x_do_set_bittiming(net);
/* Enable RX0->RX1 buffer roll over and disable filters */
mcp251x_write_bits(spi, RXBCTRL(0),
@@ -671,6 +665,12 @@ static int mcp251x_open(struct net_device *net)
struct mcp251x_platform_data *pdata = spi->dev.platform_data;
int ret;
+ ret = open_candev(net);
+ if (ret) {
+ dev_err(&spi->dev, "unable to set initial baudrate!\n");
+ return ret;
+ }
+
if (pdata->transceiver_enable)
pdata->transceiver_enable(1);
@@ -684,6 +684,7 @@ static int mcp251x_open(struct net_device *net)
dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq);
if (pdata->transceiver_enable)
pdata->transceiver_enable(0);
+ close_candev(net);
return ret;
}
@@ -692,8 +693,10 @@ static int mcp251x_open(struct net_device *net)
ret = mcp251x_setup(net, priv, spi);
if (ret) {
free_irq(spi->irq, net);
+ mcp251x_hw_sleep(spi);
if (pdata->transceiver_enable)
pdata->transceiver_enable(0);
+ close_candev(net);
return ret;
}
mcp251x_set_normal_mode(spi);
@@ -956,7 +959,6 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi)
priv->can.bittiming_const = &mcp251x_bittiming_const;
priv->can.do_set_mode = mcp251x_do_set_mode;
priv->can.clock.freq = pdata->oscillator_frequency / 2;
- priv->can.do_set_bittiming = mcp251x_do_set_bittiming;
priv->net = net;
dev_set_drvdata(&spi->dev, priv);
--
1.5.6.5
^ permalink raw reply related
* [PATCH] ethtool: Support passing the PHY info through get_drvinfo
From: Jeff Kirsher @ 2009-11-17 16:17 UTC (permalink / raw)
To: jeff, davem, shemminger
Cc: netdev, gospo, Peter P Waskiewicz Jr, Jeff Kirsher
From: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
This allows drivers to provide a PHY type to dump_drvinfo when
ethtool -i ethX is executed.
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
ethtool-copy.h | 25 ++++++++++++++++++++++++-
ethtool.c | 30 ++++++++++++++++++++++++++++--
2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/ethtool-copy.h b/ethtool-copy.h
index 3ca4e2c..db29c5a 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -53,7 +53,8 @@ struct ethtool_drvinfo {
char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */
/* For PCI devices, use pci_name(pci_dev). */
char reserved1[32];
- char reserved2[12];
+ char reserved2[11];
+ __u8 phy_type; /* PHY type present on the NIC */
__u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
__u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
__u32 testinfo_len;
@@ -285,6 +286,28 @@ enum ethtool_flags {
ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
};
+/*
+ * PHY types supported
+ *
+ * 0 - No PHY specified
+ * 1 - SFP/SFP+ Fiber (SR and LR)
+ * 2 - XFP Fiber (SR and LR)
+ * 3 - SFP+ Direct Attach (TwinAX)
+ * 4 - BASE-T (RJ-45)
+ * MAX - PHY not present
+ */
+enum ethtool_phy_type {
+ ETH_PHY_UNSPECIFIED = 0,
+ ETH_PHY_SFP_FIBER,
+ ETH_PHY_XFP_FIBER,
+ ETH_PHY_DA_TWINAX,
+ ETH_PHY_BASE_T,
+
+ /* This must be the last entry */
+ ETH_PHY_NOT_PRESENT,
+};
+#define ETH_MAX_PHY_STR_LEN 32
+
struct ethtool_rxnfc {
__u32 cmd;
__u32 flow_type;
diff --git a/ethtool.c b/ethtool.c
index 0110682..8baa429 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -969,15 +969,41 @@ static int dump_ecmd(struct ethtool_cmd *ep)
static int dump_drvinfo(struct ethtool_drvinfo *info)
{
+ char phy_type[ETH_MAX_PHY_STR_LEN];
+
+ switch (info->phy_type) {
+ case ETH_PHY_NOT_PRESENT:
+ sprintf(phy_type, "PHY not present");
+ break;
+ case ETH_PHY_SFP_FIBER:
+ sprintf(phy_type, "SFP/SFP+ Fiber (SR/LR)");
+ break;
+ case ETH_PHY_XFP_FIBER:
+ sprintf(phy_type, "XFP Fiber (SR/LR)");
+ break;
+ case ETH_PHY_DA_TWINAX:
+ sprintf(phy_type, "SFP+ DA TwinAX");
+ break;
+ case ETH_PHY_BASE_T:
+ sprintf(phy_type, "BASE-T Copper");
+ break;
+ case ETH_PHY_UNSPECIFIED:
+ default:
+ sprintf(phy_type, "PHY unspecified");
+ break;
+ };
+
fprintf(stdout,
"driver: %s\n"
"version: %s\n"
"firmware-version: %s\n"
- "bus-info: %s\n",
+ "bus-info: %s\n"
+ "phy-type: %s\n",
info->driver,
info->version,
info->fw_version,
- info->bus_info);
+ info->bus_info,
+ phy_type);
return 0;
}
^ permalink raw reply related
* pull request: wireless-next-2.6 2009-11-17
From: John W. Linville @ 2009-11-17 16:10 UTC (permalink / raw)
To: davem; +Cc: linux-wireless, netdev
Dave,
Another round of wireless bits for -next...
Included are a bunch of rt2x00 updates (related to rt2800{usb,pci}), an
802.11s mesh support refresh to match current drafts of the spec, big
ath9k and iwlwifi drivers updates, new mac80211 support for using
4-address frames to talk to APs, a smattering of other driver and
infrastructure updates, and of course my fix for the zdnet build break.
Please let me know if there are problems!
Thanks,
John
---
Individual patches are available here:
http://www.kernel.org/pub/linux/kernel/people/linville/wireless-next-2.6/
---
The following changes since commit 2071a0084a0323697b7d6fd5a98982194bd6929f:
David S. Miller (1):
Merge branch 'master' of master.kernel.org:/.../davem/net-2.6
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6.git master
Bartlomiej Zolnierkiewicz (10):
rt2800: prepare for unification of EEPROM support code
rt2800: unify EEPROM support code
rt2800pci: add missing RF values to rf_vals table
rt2800usb: reorganize code in rt2800usb_probe_hw_mode()
rt2800: prepare for rt2800*_probe_hw_mode() unification
rt2800: unify rt2800*_probe_hw_mode()
rt2800usb: fix RX descriptor naming
rt2800: add eFuse EEPROM support code to rt2800lib
rt2800usb: add eFuse EEPROM support
rt2500usb: remove dead link tuning code
Ben Hutchings (13):
at76c50x-usb: declare MODULE_FIRMWARE
atmel: declare MODULE_FIRMWARE
ipw2100: declare MODULE_FIRMWARE
ipw2200: declare MODULE_FIRMWARE
iwmc3200wifi: declare MODULE_FIRMWARE
libertas: declare MODULE_FIRMWARE
libertas_tf_usb: declare MODULE_FIRMWARE
mwl8k: declare MODULE_FIRMWARE
orinoco: declare MODULE_FIRMWARE
prism54: declare MODULE_FIRMWARE
wl12xx: declare MODULE_FIRMWARE
zd1201: declare MODULE_FIRMWARE
zd1211rw: declare MODULE_FIRMWARE
Ben M Cahill (6):
iwlwifi: Limit size of Event Log dump
iwlwifi: speed up event log dumps
iwlwifi: Update comments for struct iwl_ssid_ie
iwlwifi: Add comments about MAC_ACCESS_REQ
iwlagn: update write pointers in iwl_irq_tasklet()
iwlwifi: MAC_ACCESS_REQ cleanup
Bob Copeland (1):
ath5k: allow setting txpower to 0
Felix Fietkau (5):
nl80211: add a parameter for using 4-address frames on virtual interfaces
mac80211: implement support for 4-address frames for AP and client mode
mac80211: fix broadcast frame handling for 4-addr AP VLANs
nl80211: only allow adding stations to running vlan interfaces
ath9k: fix massive rx packet loss issue
Gertjan van Wingerde (10):
rt2x00: Move interface type assignments to generic code.
rt2x00: Fix building of rt2800lib when rt2x00 driver is built-in.
rt2x00: Add dynamic detection of eFuse EEPROM in rt2800pci.
rt2x00: Update copyright statements.
rt2x00: Fix typo in rf programming of rt2800lib.
rt2x00: Properly detect Ralink RT3070 devices.
rt2x00: Fix rt2800lib RF chip programming selection.
rt2x00: Initialize rf302x RF values properly for rt2800pci.
rt2x00: Log RT/RF chipset information correctly.
rt2x00: Fix BUG on rt2800usb when trying to read eFuse EEPROM.
Holger Schurig (2):
cfg80211: introduce nl80211_get_ifidx()
cfg80211: return channel noise via survey API
Ivo van Doorn (1):
rt2x00: Remove deprecated ieee80211_rx_status->qual usage
Jason Andryuk (2):
at76c50x-usb: Remove mac2str and replace with %pM format specifier.
at76c50x-usb: Supply additional parameters to at76_start_monitor scan request
Johannes Berg (3):
iwlwifi: don't double-activate queue 4
iwlwifi: fix FIFO vs. queue confusion
iwlwifi: add FIFO usage for 5000
John W. Linville (1):
znet: fix build failure from i82593.h relocation
Josef Bacik (1):
rt2800: do not enable tbtt unless we are in a beacon mode
Jouni Malinen (1):
mac80211: Do not queue Probe Request frames for station MLME
Julia Lawall (1):
drivers/net/wireless: correct check on CCS_START_NETWORK
Jussi Kivilinna (1):
rndis_wlan: handle NL80211_AUTHTYPE_AUTOMATIC
Luis R. Rodriguez (30):
ath9k: fix listening to idle requests
ath9k: update hw configuration for virtual wiphys
ath9k: simpify RX by calling ath_get_virt_hw() once
ath9k: use the passed ieee80211_hw on ath_rx_prepare()
ath9k: pass the ieee80211_hw on radio enable/disable
ath9k: use correct hw for tx aggregation TX completion
ath9k: use the right hw on ath_tx_setup_buffer() for HT
ath9k: handle low buffer space for virtual wiphys
ath9k: do not pass the entire descriptor to ath_rx_prepare()
ath9k_hw: move ath_extend_tsf() to hw code to share as ath9k_hw_extend_tsf()
ath9k: move struct ath_ani to common area
ath9k: use the ieee80211_hw to get to an sband on ath_rx_prepare()
ath9k: move RX check code into helper ath9k_rx_accept()
ath9k: remove temp variable ratecode from ath_rx_prepare()
ath9k: move rate descriptor reading into a helper
ath9k: move qual processing into a helper
ath9k: move rssi processing into a helper
ath9k: avoid the copy skb->cb on every RX'd skb
ath9k: move the rx_stats->rs_datalen check to ath9k_rx_accept()
ath: move the rx bufsize to common to share with ath5k/ath9k
ath5k: remove double cache alignment, ath_rxbuf_alloc() already does it
ath9k: move the max rx buffer size check to ath9k_rx_accept()
ath9k: rename ath_rx_prepare() to ath9k_rx_skb_preprocess()
ath9k: move driver keymap, keymax and splitmic to common
ath5k: use the common->keymap
ath9k: move RX skb post processing to a helper
ath9k_common: add new module to share 802.11n driver helpers
ath9k_common: remove ath9k_compute_qual()
ath9k_common: clarify and correct jumbogram processing
mac80211: fix max HT rate processing on mac80211
Michael Buesch (2):
b43: Rewrite TX bounce buffer handling
b43-pio: Fix RX error path for rev>=8 devices
Randy Dunlap (1):
staging/wireless: don't build when NET etc. are not enabled
Reinette Chatre (1):
iwlwifi: change debug message to error in failure case
Rui Paulo (20):
mac80211: update meshconf IE
mac80211: set MESH_TTL to 31
mac80211: implement the meshconf formation info field
mac80211: fix typo in a comment
mac80211: update peer link management IE and action frames
mac80211: update the format of path selection frames
mac80211: add MAC80211_VERBOSE_MHWMP_DEBUG
mac80211: allow processing of more than one HWMP IE
mac80211: improve HWMP debugging
mac80211: improve peer link management debugging
mac80211: implement RANN processing and forwarding
mac80211: update PERR frame format
mac80211: properly forward the RANN IE
mac80211: set the AID field correctly for mesh peer frames
mac80211: fix BSSID setup for beacon frames
mac80211: add the DS params to the beacon
mac80211: replace "destination" with "target" to follow the spec
mac80211: implement a timer to send RANN action frames
mac80211: add nl80211/cfg80211 handling of the new mesh root mode option.
mac80211: update copyrights to 2009
Shanyu Zhao (2):
iwlwifi: use only one chain for scan in PS
iwlwifi: use configured valid rx chain for scan
Thadeu Lima de Souza Cascardo (2):
rt2x00: fix some typos and punctuation in comments
rt2800lib: fix some typos and punctuation in comments
Vasanthakumar Thiagarajan (2):
ath9k_hw: Fix possible OOB array indexing in gen_timer_index[] on 64-bit
ath9k_hw: Fix AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB and its shift value in 0x4054
Wey-Yi Guy (7):
iwlwifi: print rx_on config to help debug
iwlwifi: no periodic Tx/IQ calibration for 6x00/6x50 series
iwlwifi: remove un-used parameter
iwlwifi: fix for channel switch
iwlwifi: drop non-production PCI-IDs
iwlwifi: do not base station's sm_ps setting on AP
iwlwifi: Fix issue on file transfer stalled in HT mode
Zhu Yi (1):
iwlwifi: allocate 128 bytes linear buffer for rx skb
drivers/net/wireless/at76c50x-usb.c | 45 +-
drivers/net/wireless/ath/ath.h | 28 ++
drivers/net/wireless/ath/ath5k/base.c | 32 +-
drivers/net/wireless/ath/ath5k/base.h | 2 -
drivers/net/wireless/ath/ath5k/phy.c | 2 -
drivers/net/wireless/ath/ath9k/Kconfig | 3 +
drivers/net/wireless/ath/ath9k/Makefile | 3 +
drivers/net/wireless/ath/ath9k/ath9k.h | 130 +-----
drivers/net/wireless/ath/ath9k/common.c | 286 +++++++++++
drivers/net/wireless/ath/ath9k/common.h | 123 +++++
drivers/net/wireless/ath/ath9k/hw.c | 15 +
drivers/net/wireless/ath/ath9k/hw.h | 3 +-
drivers/net/wireless/ath/ath9k/main.c | 243 ++++++-----
drivers/net/wireless/ath/ath9k/rc.h | 2 +
drivers/net/wireless/ath/ath9k/recv.c | 313 ++-----------
drivers/net/wireless/ath/ath9k/reg.h | 4 +-
drivers/net/wireless/ath/ath9k/virtual.c | 79 +++-
drivers/net/wireless/ath/ath9k/xmit.c | 21 +-
drivers/net/wireless/atmel.c | 16 +
drivers/net/wireless/b43/dma.c | 48 +--
drivers/net/wireless/b43/pio.c | 6 +-
drivers/net/wireless/b43/xmit.h | 19 +
drivers/net/wireless/ipw2x00/ipw2100.c | 6 +
drivers/net/wireless/ipw2x00/ipw2200.c | 5 +
drivers/net/wireless/iwlwifi/iwl-1000.c | 1 +
drivers/net/wireless/iwlwifi/iwl-3945.c | 3 +-
drivers/net/wireless/iwlwifi/iwl-4965.c | 14 +-
drivers/net/wireless/iwlwifi/iwl-5000.c | 16 +-
drivers/net/wireless/iwlwifi/iwl-6000.c | 106 +----
drivers/net/wireless/iwlwifi/iwl-agn.c | 79 ++--
drivers/net/wireless/iwlwifi/iwl-commands.h | 7 +-
drivers/net/wireless/iwlwifi/iwl-core.c | 54 ++-
drivers/net/wireless/iwlwifi/iwl-core.h | 5 +
drivers/net/wireless/iwlwifi/iwl-dev.h | 22 +-
drivers/net/wireless/iwlwifi/iwl-hcmd.c | 4 +-
drivers/net/wireless/iwlwifi/iwl-io.h | 20 +
drivers/net/wireless/iwlwifi/iwl-prph.h | 19 +-
drivers/net/wireless/iwlwifi/iwl-rx.c | 5 +-
drivers/net/wireless/iwlwifi/iwl-scan.c | 18 +-
drivers/net/wireless/iwlwifi/iwl-tx.c | 12 +-
drivers/net/wireless/iwlwifi/iwl3945-base.c | 42 ++-
drivers/net/wireless/iwmc3200wifi/sdio.c | 3 +
drivers/net/wireless/libertas/if_cs.c | 1 +
drivers/net/wireless/libertas/if_sdio.c | 6 +
drivers/net/wireless/libertas/if_spi.c | 4 +
drivers/net/wireless/libertas/if_usb.c | 2 +
drivers/net/wireless/libertas_tf/if_usb.c | 2 +
drivers/net/wireless/mwl8k.c | 3 +
drivers/net/wireless/orinoco/fw.c | 6 +
drivers/net/wireless/prism54/islpci_dev.c | 3 +
drivers/net/wireless/ray_cs.c | 2 +-
drivers/net/wireless/rndis_wlan.c | 2 +
drivers/net/wireless/rt2x00/rt2400pci.c | 3 +-
drivers/net/wireless/rt2x00/rt2400pci.h | 2 +-
drivers/net/wireless/rt2x00/rt2500pci.c | 3 +-
drivers/net/wireless/rt2x00/rt2500pci.h | 2 +-
drivers/net/wireless/rt2x00/rt2500usb.c | 137 +------
drivers/net/wireless/rt2x00/rt2500usb.h | 2 +-
drivers/net/wireless/rt2x00/rt2800.h | 38 ++-
drivers/net/wireless/rt2x00/rt2800lib.c | 494 +++++++++++++++++++-
drivers/net/wireless/rt2x00/rt2800lib.h | 17 +
drivers/net/wireless/rt2x00/rt2800pci.c | 416 +---------------
drivers/net/wireless/rt2x00/rt2800pci.h | 37 +--
drivers/net/wireless/rt2x00/rt2800usb.c | 418 +----------------
drivers/net/wireless/rt2x00/rt2800usb.h | 46 +-
drivers/net/wireless/rt2x00/rt2x00.h | 22 +-
drivers/net/wireless/rt2x00/rt2x00config.c | 2 +-
drivers/net/wireless/rt2x00/rt2x00crypto.c | 2 +-
drivers/net/wireless/rt2x00/rt2x00debug.c | 2 +-
drivers/net/wireless/rt2x00/rt2x00debug.h | 2 +-
drivers/net/wireless/rt2x00/rt2x00dev.c | 3 +-
drivers/net/wireless/rt2x00/rt2x00dump.h | 2 +-
drivers/net/wireless/rt2x00/rt2x00firmware.c | 3 +-
drivers/net/wireless/rt2x00/rt2x00ht.c | 2 +-
drivers/net/wireless/rt2x00/rt2x00leds.c | 2 +-
drivers/net/wireless/rt2x00/rt2x00leds.h | 2 +-
drivers/net/wireless/rt2x00/rt2x00lib.h | 16 +-
drivers/net/wireless/rt2x00/rt2x00link.c | 90 +----
drivers/net/wireless/rt2x00/rt2x00mac.c | 2 +-
drivers/net/wireless/rt2x00/rt2x00pci.c | 4 +-
drivers/net/wireless/rt2x00/rt2x00pci.h | 2 +-
drivers/net/wireless/rt2x00/rt2x00queue.c | 3 +-
drivers/net/wireless/rt2x00/rt2x00queue.h | 2 +-
drivers/net/wireless/rt2x00/rt2x00reg.h | 2 +-
drivers/net/wireless/rt2x00/rt2x00soc.c | 8 +-
drivers/net/wireless/rt2x00/rt2x00soc.h | 2 +-
drivers/net/wireless/rt2x00/rt2x00usb.c | 4 +-
drivers/net/wireless/rt2x00/rt2x00usb.h | 4 +-
drivers/net/wireless/rt2x00/rt61pci.c | 39 +-
drivers/net/wireless/rt2x00/rt61pci.h | 2 +-
drivers/net/wireless/rt2x00/rt73usb.c | 3 +-
drivers/net/wireless/rt2x00/rt73usb.h | 2 +-
drivers/net/wireless/wl12xx/wl1251_main.c | 1 +
drivers/net/wireless/wl12xx/wl1271_main.c | 1 +
drivers/net/wireless/zd1201.c | 3 +
drivers/net/wireless/zd1211rw/zd_usb.c | 7 +
drivers/net/znet.c | 3 +-
drivers/staging/arlan/Kconfig | 2 +-
drivers/staging/netwave/Kconfig | 2 +-
drivers/staging/wavelan/Kconfig | 4 +-
drivers/staging/wavelan/wavelan_cs.p.h | 2 +-
.../staging/wavelan => include/linux}/i82593.h | 0
include/linux/ieee80211.h | 17 +-
include/linux/nl80211.h | 49 ++-
include/net/cfg80211.h | 45 ++-
net/mac80211/Kconfig | 13 +
net/mac80211/cfg.c | 47 ++-
net/mac80211/debugfs_netdev.c | 2 +
net/mac80211/ieee80211_i.h | 27 +-
net/mac80211/iface.c | 4 +
net/mac80211/mesh.c | 143 ++++--
net/mac80211/mesh.h | 28 +-
net/mac80211/mesh_hwmp.c | 388 ++++++++++-----
net/mac80211/mesh_pathtbl.c | 18 +-
net/mac80211/mesh_plink.c | 56 ++-
net/mac80211/mlme.c | 1 -
net/mac80211/rx.c | 40 ++-
net/mac80211/sta_info.c | 3 +
net/mac80211/tx.c | 47 ++-
net/mac80211/util.c | 4 +
net/wireless/nl80211.c | 208 +++++++--
net/wireless/util.c | 4 +-
122 files changed, 2688 insertions(+), 2220 deletions(-)
create mode 100644 drivers/net/wireless/ath/ath9k/common.c
create mode 100644 drivers/net/wireless/ath/ath9k/common.h
rename {drivers/staging/wavelan => include/linux}/i82593.h (100%)
Omnibus patch is available here:
http://www.kernel.org/pub/linux/kernel/people/linville/wireless-next-2.6-2009-11-17.patch.bz2
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply
* [net-next-2.6 PATCH 2/2] ixgbe: Display currently attached PHY through ethtool get_drvinfo
From: Jeff Kirsher @ 2009-11-17 16:14 UTC (permalink / raw)
To: davem; +Cc: netdev, gospo, Peter P Waskiewicz Jr, Jeff Kirsher
In-Reply-To: <20091117161309.11341.9165.stgit@localhost.localdomain>
From: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
This patch uses the new ethtool interface to display what PHY
is currently connected to a NIC. The results can be viewed in
ethtool -i ethX output.
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ixgbe/ixgbe_ethtool.c | 61 +++++++++++++++++++++++++++++++++++++
1 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 9d2cc83..0012c65 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -782,6 +782,67 @@ static void ixgbe_get_drvinfo(struct net_device *netdev,
drvinfo->n_stats = IXGBE_STATS_LEN;
drvinfo->testinfo_len = IXGBE_TEST_LEN;
drvinfo->regdump_len = ixgbe_get_regs_len(netdev);
+
+ /* Get PHY type */
+
+ /*
+ * If the adapter is not up, we should re-identify the PHY type.
+ * It might be stale otherwise.
+ */
+ if (test_bit(__IXGBE_DOWN, &adapter->state)) {
+ /* clear the PHY type to ensure we do a full scan */
+ adapter->hw.phy.type = ixgbe_phy_unknown;
+ adapter->hw.phy.ops.identify(&adapter->hw);
+ }
+
+ switch (adapter->hw.phy.type) {
+ case ixgbe_phy_tn:
+ case ixgbe_phy_cu_unknown:
+ /* Copper 10G-BASET */
+ drvinfo->phy_type = ETH_PHY_BASE_T;
+ break;
+ case ixgbe_phy_qt:
+ drvinfo->phy_type = ETH_PHY_XFP_FIBER;
+ break;
+ case ixgbe_phy_nl:
+ case ixgbe_phy_tw_tyco:
+ case ixgbe_phy_tw_unknown:
+ case ixgbe_phy_sfp_ftl:
+ case ixgbe_phy_sfp_avago:
+ case ixgbe_phy_sfp_intel:
+ case ixgbe_phy_sfp_unknown:
+ case ixgbe_phy_unknown:
+ switch (adapter->hw.phy.sfp_type) {
+ /* SFP+ devices, further checking needed */
+ case ixgbe_sfp_type_da_cu:
+ case ixgbe_sfp_type_da_cu_core0:
+ case ixgbe_sfp_type_da_cu_core1:
+ drvinfo->phy_type = ETH_PHY_DA_TWINAX;
+ break;
+ case ixgbe_sfp_type_sr:
+ case ixgbe_sfp_type_lr:
+ case ixgbe_sfp_type_srlr_core0:
+ case ixgbe_sfp_type_srlr_core1:
+ drvinfo->phy_type = ETH_PHY_SFP_FIBER;
+ break;
+ case ixgbe_sfp_type_not_present:
+ drvinfo->phy_type = ETH_PHY_NOT_PRESENT;
+ break;
+ case ixgbe_sfp_type_unknown:
+ default:
+ ETH_PHY_UNSPECIFIED;
+ break;
+ }
+ break;
+ case ixgbe_phy_xaui:
+ drvinfo->phy_type = ETH_PHY_NOT_PRESENT;
+ break;
+ case ixgbe_phy_generic:
+ case ixgbe_phy_sfp_unsupported:
+ default:
+ drvinfo->phy_type = ETH_PHY_UNSPECIFIED;
+ break;
+ }
}
static void ixgbe_get_ringparam(struct net_device *netdev,
^ permalink raw reply related
* [net-next-2.6 PATCH 1/2] ethtool: Add PHY type to ethtool get_drvinfo
From: Jeff Kirsher @ 2009-11-17 16:13 UTC (permalink / raw)
To: davem; +Cc: netdev, gospo, Peter P Waskiewicz Jr, Jeff Kirsher
From: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
Allow the PHY type to be passed from a driver to ethtool when
ethtool -i ethX is called. With newer network cards having SFP
and SFP+ PHY cages, this information can be useful, especially
if the NIC supports hot-swapping of the PHY modules.
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
include/linux/ethtool.h | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index edd03b7..d6606a5 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -59,7 +59,8 @@ struct ethtool_drvinfo {
char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */
/* For PCI devices, use pci_name(pci_dev). */
char reserved1[32];
- char reserved2[12];
+ char reserved2[11];
+ __u8 phy_type; /* PHY type present on the NIC */
__u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
__u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
__u32 testinfo_len;
@@ -291,6 +292,27 @@ enum ethtool_flags {
ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
};
+/*
+ * PHY types supported
+ *
+ * 0 - PHY not specified
+ * 1 - SFP/SFP+ Fiber (SR and LR)
+ * 2 - XFP Fiber (SR and LR)
+ * 3 - SFP+ Direct Attach (TwinAX)
+ * 4 - BASE-T (RJ-45)
+ * MAX - PHY not present
+ */
+enum ethtool_phy_type {
+ ETH_PHY_UNSPECIFIED = 0,
+ ETH_PHY_SFP_FIBER,
+ ETH_PHY_XFP_FIBER,
+ ETH_PHY_DA_TWINAX,
+ ETH_PHY_BASE_T,
+
+ /* This must be the last entry */
+ ETH_PHY_NOT_PRESENT,
+};
+
/* The following structures are for supporting RX network flow
* classification configuration. Note, all multibyte fields, e.g.,
* ip4src, ip4dst, psrc, pdst, spi, etc. are expected to be in network
^ permalink raw reply related
* Re: PATCH net-next-2.6] linkwatch: linkwatch_forget_dev() to speedup device dismantle
From: Eric Dumazet @ 2009-11-17 15:59 UTC (permalink / raw)
To: Herbert Xu, David Miller; +Cc: shemminger, netdev
In-Reply-To: <20091117123133.GA14831@gondor.apana.org.au>
Herbert Xu a écrit :
> On Tue, Nov 17, 2009 at 04:26:04AM -0800, David Miller wrote:
>> Really, the link watch stuff is just due for a redesign. I don't
>> think a simple hack is going to cut it this time, sorry Eric :-)
>
> I have no objections against any redesigns, but since the only
> caller of linkwatch_forget_dev runs in process context with the
> RTNL, it could also legally emit those events.
Thanks guys, here an updated version then, before linkwatch surgery ?
In this version, I force the event to be sent synchronously.
[PATCH net-next-2.6] linkwatch: linkwatch_forget_dev() to speedup device dismantle
time ip link del eth3.103 ; time ip link del eth3.104 ; time ip link del eth3.105
real 0m0.266s
user 0m0.000s
sys 0m0.001s
real 0m0.770s
user 0m0.000s
sys 0m0.000s
real 0m1.022s
user 0m0.000s
sys 0m0.000s
One problem of current schem in vlan dismantle phase is the
holding of device done by following chain :
vlan_dev_stop() ->
netif_carrier_off(dev) ->
linkwatch_fire_event(dev) ->
dev_hold() ...
And __linkwatch_run_queue() runs up to one second later...
A generic fix to this problem is to add a linkwatch_forget_dev() method
to unlink the device from the list of watched devices.
dev->link_watch_next becomes dev->link_watch_list (and use a bit more memory),
to be able to unlink device in O(1).
After patch :
time ip link del eth3.103 ; time ip link del eth3.104 ; time ip link del eth3.105
real 0m0.024s
user 0m0.000s
sys 0m0.000s
real 0m0.032s
user 0m0.000s
sys 0m0.001s
real 0m0.033s
user 0m0.000s
sys 0m0.000s
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
include/linux/netdevice.h | 3 -
net/core/dev.c | 3 +
net/core/link_watch.c | 94 +++++++++++++++++++++---------------
3 files changed, 62 insertions(+), 38 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7043f85..4e25730 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -896,7 +896,7 @@ struct net_device {
/* device index hash chain */
struct hlist_node index_hlist;
- struct net_device *link_watch_next;
+ struct list_head link_watch_list;
/* register/unregister state machine */
enum { NETREG_UNINITIALIZED=0,
@@ -1600,6 +1600,7 @@ static inline void dev_hold(struct net_device *dev)
*/
extern void linkwatch_fire_event(struct net_device *dev);
+extern void linkwatch_forget_dev(struct net_device *dev);
/**
* netif_carrier_ok - test if carrier present
diff --git a/net/core/dev.c b/net/core/dev.c
index d867522..9b58c04 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5067,6 +5067,8 @@ static void netdev_wait_allrefs(struct net_device *dev)
{
unsigned long rebroadcast_time, warning_time;
+ linkwatch_forget_dev(dev);
+
rebroadcast_time = warning_time = jiffies;
while (atomic_read(&dev->refcnt) != 0) {
if (time_after(jiffies, rebroadcast_time + 1 * HZ)) {
@@ -5281,6 +5283,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
INIT_LIST_HEAD(&dev->napi_list);
INIT_LIST_HEAD(&dev->unreg_list);
+ INIT_LIST_HEAD(&dev->link_watch_list);
dev->priv_flags = IFF_XMIT_DST_RELEASE;
setup(dev);
strcpy(dev->name, name);
diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index bf8f7af..5910b55 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -35,7 +35,7 @@ static unsigned long linkwatch_nextevent;
static void linkwatch_event(struct work_struct *dummy);
static DECLARE_DELAYED_WORK(linkwatch_work, linkwatch_event);
-static struct net_device *lweventlist;
+static LIST_HEAD(lweventlist);
static DEFINE_SPINLOCK(lweventlist_lock);
static unsigned char default_operstate(const struct net_device *dev)
@@ -89,8 +89,10 @@ static void linkwatch_add_event(struct net_device *dev)
unsigned long flags;
spin_lock_irqsave(&lweventlist_lock, flags);
- dev->link_watch_next = lweventlist;
- lweventlist = dev;
+ if (list_empty(&dev->link_watch_list)) {
+ list_add_tail(&dev->link_watch_list, &lweventlist);
+ dev_hold(dev);
+ }
spin_unlock_irqrestore(&lweventlist_lock, flags);
}
@@ -133,9 +135,35 @@ static void linkwatch_schedule_work(int urgent)
}
+static void linkwatch_do_dev(struct net_device *dev)
+{
+ /*
+ * Make sure the above read is complete since it can be
+ * rewritten as soon as we clear the bit below.
+ */
+ smp_mb__before_clear_bit();
+
+ /* We are about to handle this device,
+ * so new events can be accepted
+ */
+ clear_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state);
+
+ rfc2863_policy(dev);
+ if (dev->flags & IFF_UP) {
+ if (netif_carrier_ok(dev))
+ dev_activate(dev);
+ else
+ dev_deactivate(dev);
+
+ netdev_state_change(dev);
+ }
+ dev_put(dev);
+}
+
static void __linkwatch_run_queue(int urgent_only)
{
- struct net_device *next;
+ struct net_device *dev;
+ LIST_HEAD(wrk);
/*
* Limit the number of linkwatch events to one
@@ -153,46 +181,40 @@ static void __linkwatch_run_queue(int urgent_only)
clear_bit(LW_URGENT, &linkwatch_flags);
spin_lock_irq(&lweventlist_lock);
- next = lweventlist;
- lweventlist = NULL;
- spin_unlock_irq(&lweventlist_lock);
+ list_splice_init(&lweventlist, &wrk);
- while (next) {
- struct net_device *dev = next;
+ while (!list_empty(&wrk)) {
- next = dev->link_watch_next;
+ dev = list_first_entry(&wrk, struct net_device, link_watch_list);
+ list_del_init(&dev->link_watch_list);
if (urgent_only && !linkwatch_urgent_event(dev)) {
- linkwatch_add_event(dev);
+ list_add_tail(&dev->link_watch_list, &lweventlist);
continue;
}
-
- /*
- * Make sure the above read is complete since it can be
- * rewritten as soon as we clear the bit below.
- */
- smp_mb__before_clear_bit();
-
- /* We are about to handle this device,
- * so new events can be accepted
- */
- clear_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state);
-
- rfc2863_policy(dev);
- if (dev->flags & IFF_UP) {
- if (netif_carrier_ok(dev))
- dev_activate(dev);
- else
- dev_deactivate(dev);
-
- netdev_state_change(dev);
- }
-
- dev_put(dev);
+ spin_unlock_irq(&lweventlist_lock);
+ linkwatch_do_dev(dev);
+ spin_lock_irq(&lweventlist_lock);
}
- if (lweventlist)
+ if (!list_empty(&lweventlist))
linkwatch_schedule_work(0);
+ spin_unlock_irq(&lweventlist_lock);
+}
+
+void linkwatch_forget_dev(struct net_device *dev)
+{
+ unsigned long flags;
+ int clean = 0;
+
+ spin_lock_irqsave(&lweventlist_lock, flags);
+ if (!list_empty(&dev->link_watch_list)) {
+ list_del_init(&dev->link_watch_list);
+ clean = 1;
+ }
+ spin_unlock_irqrestore(&lweventlist_lock, flags);
+ if (clean)
+ linkwatch_do_dev(dev);
}
@@ -216,8 +238,6 @@ void linkwatch_fire_event(struct net_device *dev)
bool urgent = linkwatch_urgent_event(dev);
if (!test_and_set_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state)) {
- dev_hold(dev);
-
linkwatch_add_event(dev);
} else if (!urgent)
return;
^ permalink raw reply related
* Re: updates to the mscan-driver in net-next
From: Wolfgang Grandegger @ 2009-11-17 15:53 UTC (permalink / raw)
To: David Miller; +Cc: socketcan-core, netdev, linuxppc-dev
In-Reply-To: <20091117.035416.250564986.davem@davemloft.net>
David Miller wrote:
> From: Wolfram Sang <w.sang@pengutronix.de>
> Date: Mon, 16 Nov 2009 23:57:43 +0100
>
>> here are the patches which fix the issues for the mscan & mpc52xx_can drivers
>> raised by Wolfgang Grandegger and Grant Likely. They are based on the initial
>> version of the drivers I sent a few days ago. Devicetree-discuss has been added
>> for the property changes. I will also update my branch on pengutronix.de
>> tomorrow, I seem to have issues when trying that from home :(^
>
> All applied to net-next-2.6, thank you.
Puh, I'm again too late for commenting, testing and adding my
signed-off-by line. Nevertheless, the driver looks good and works fine now.
Thanks,
Wolfgang.
^ permalink raw reply
* Re: [PATCH] znet: fix build failure from i82593.h relocation
From: David Miller @ 2009-11-17 15:36 UTC (permalink / raw)
To: linville; +Cc: netdev, linux-kernel, william.allen.simpson
In-Reply-To: <1258471249-6531-1-git-send-email-linville@tuxdriver.com>
From: "John W. Linville" <linville@tuxdriver.com>
Date: Tue, 17 Nov 2009 10:20:49 -0500
> I'll just include this with the wireless-next-2.6 pull request I intend
> to send later today...
Sounds good.
^ permalink raw reply
* [PATCH 2/4] [RFC] Add c/r support for connected INET sockets (v5)
From: Dan Smith @ 2009-11-17 15:26 UTC (permalink / raw)
To: containers; +Cc: orenl, netdev
In-Reply-To: <1258471590-29768-1-git-send-email-danms@us.ibm.com>
This patch adds basic support for C/R of open INET sockets. I think that
all the important bits of the TCP and ICSK socket structures is saved,
but I think there is still some additional IPv6 stuff that needs to be
handled.
With this patch applied, the following script can be used to demonstrate
the functionality:
https://lists.linux-foundation.org/pipermail/containers/2009-October/021239.html
It shows that this enables migration of a sendmail process with open
connections from one machine to another without dropping.
We probably need comments from the netdev people about the quality of
sanity checking we do on the values in the ckpt_hdr_socket_inet
structure on restart.
Note that this still doesn't address lingering sockets yet.
Changes in v5:
- Change ckpt_write_err() to ckpt_err()
Changes in v4:
- Use the new socket buffer restore functions introduced in the
previous patch
- Move listen_sockets list under the restart items in ckpt_ctx
- Rename RESTART_SOCK_LISTENONLY to RESTART_CONN_RESET
Changes in v3:
- Prevent restart from allowing a bind on a <1024 port unless the
user is granted that capability
- Add some sanity checking in the inet_precheck() function to make sure
the values read from the checkpoint image are within acceptable ranges
- Check the result of sock_restore_header_info() and fail if needed
Changes in v2:
- Restore saddr, rcv_saddr, daddr, sport, and dport from the sockaddr
structure instead of saving them separately
- Fix 'sock' naming in sock_cptrst()
- Don't take the queue lock before skb_queue_tail() since it is
done for us
- Allow "listen only" restore behavior if RESTART_SOCK_LISTENONLY
flag is specified on sys_restart()
- Pull the implementation of the list of listening sockets back into
this patch
- Fix dangling printk
- Add some comments around the parent/child restore logic
Cc: netdev@vger.kernel.org
Acked-by: Oren Laadan <orenl@librato.com>
Signed-off-by: Dan Smith <danms@us.ibm.com>
---
checkpoint/sys.c | 4 +
include/linux/checkpoint.h | 5 +-
include/linux/checkpoint_hdr.h | 95 +++++++++
include/linux/checkpoint_types.h | 1 +
net/checkpoint.c | 27 ++--
net/ipv4/checkpoint.c | 391 ++++++++++++++++++++++++++++++++++----
6 files changed, 473 insertions(+), 50 deletions(-)
diff --git a/checkpoint/sys.c b/checkpoint/sys.c
index 9f9e825..baed891 100644
--- a/checkpoint/sys.c
+++ b/checkpoint/sys.c
@@ -244,6 +244,8 @@ static void ckpt_ctx_free(struct ckpt_ctx *ctx)
kfree(ctx->pids_arr);
+ sock_listening_list_free(&ctx->listen_sockets);
+
kfree(ctx);
}
@@ -274,6 +276,8 @@ static struct ckpt_ctx *ckpt_ctx_alloc(int fd, unsigned long uflags,
mutex_init(&ctx->msg_mutex);
+ INIT_LIST_HEAD(&ctx->listen_sockets);
+
err = -EBADF;
ctx->file = fget(fd);
if (!ctx->file)
diff --git a/include/linux/checkpoint.h b/include/linux/checkpoint.h
index 0eff43e..ddc9aa0 100644
--- a/include/linux/checkpoint.h
+++ b/include/linux/checkpoint.h
@@ -20,6 +20,7 @@
#define RESTART_FROZEN 0x2
#define RESTART_GHOST 0x4
#define RESTART_KEEP_LSM 0x8
+#define RESTART_CONN_RESET 0x10
/* misc user visible */
#define CHECKPOINT_FD_NONE -1
@@ -53,7 +54,8 @@
(RESTART_TASKSELF | \
RESTART_FROZEN | \
RESTART_KEEP_LSM | \
- RESTART_GHOST)
+ RESTART_GHOST | \
+ RESTART_CONN_RESET)
#define CKPT_LSM_INFO_LEN 200
#define CKPT_LSM_STRING_MAX 1024
@@ -105,6 +107,7 @@ extern int ckpt_sock_getnames(struct ckpt_ctx *ctx,
struct sockaddr *loc, unsigned *loc_len,
struct sockaddr *rem, unsigned *rem_len);
struct sk_buff *sock_restore_skb(struct ckpt_ctx *ctx);
+void sock_listening_list_free(struct list_head *head);
/* ckpt kflags */
#define ckpt_set_ctx_kflag(__ctx, __kflag) \
diff --git a/include/linux/checkpoint_hdr.h b/include/linux/checkpoint_hdr.h
index 787cf89..d1a93e3 100644
--- a/include/linux/checkpoint_hdr.h
+++ b/include/linux/checkpoint_hdr.h
@@ -15,6 +15,7 @@
#include <linux/socket.h>
#include <linux/un.h>
#include <linux/in.h>
+#include <linux/in6.h>
#else
#include <sys/types.h>
#include <linux/types.h>
@@ -625,6 +626,100 @@ struct ckpt_hdr_socket_unix {
struct ckpt_hdr_socket_inet {
struct ckpt_hdr h;
+ __u32 daddr;
+ __u32 rcv_saddr;
+ __u32 saddr;
+ __u16 dport;
+ __u16 num;
+ __u16 sport;
+ __s16 uc_ttl;
+ __u16 cmsg_flags;
+
+ struct {
+ __u64 timeout;
+ __u32 ato;
+ __u32 lrcvtime;
+ __u16 last_seg_size;
+ __u16 rcv_mss;
+ __u8 pending;
+ __u8 quick;
+ __u8 pingpong;
+ __u8 blocked;
+ } icsk_ack __attribute__ ((aligned(8)));
+
+ /* FIXME: Skipped opt, tos, multicast, cork settings */
+
+ struct {
+ __u32 rcv_nxt;
+ __u32 copied_seq;
+ __u32 rcv_wup;
+ __u32 snd_nxt;
+ __u32 snd_una;
+ __u32 snd_sml;
+ __u32 rcv_tstamp;
+ __u32 lsndtime;
+
+ __u32 snd_wl1;
+ __u32 snd_wnd;
+ __u32 max_window;
+ __u32 mss_cache;
+ __u32 window_clamp;
+ __u32 rcv_ssthresh;
+ __u32 frto_highmark;
+
+ __u32 srtt;
+ __u32 mdev;
+ __u32 mdev_max;
+ __u32 rttvar;
+ __u32 rtt_seq;
+
+ __u32 packets_out;
+ __u32 retrans_out;
+
+ __u32 snd_up;
+ __u32 rcv_wnd;
+ __u32 write_seq;
+ __u32 pushed_seq;
+ __u32 lost_out;
+ __u32 sacked_out;
+ __u32 fackets_out;
+ __u32 tso_deferred;
+ __u32 bytes_acked;
+
+ __s32 lost_cnt_hint;
+ __u32 retransmit_high;
+
+ __u32 lost_retrans_low;
+
+ __u32 prior_ssthresh;
+ __u32 high_seq;
+
+ __u32 retrans_stamp;
+ __u32 undo_marker;
+ __s32 undo_retrans;
+ __u32 total_retrans;
+
+ __u32 urg_seq;
+ __u32 keepalive_time;
+ __u32 keepalive_intvl;
+
+ __u16 urg_data;
+ __u16 advmss;
+ __u8 frto_counter;
+ __u8 nonagle;
+
+ __u8 ecn_flags;
+ __u8 reordering;
+
+ __u8 keepalive_probes;
+ } tcp __attribute__ ((aligned(8)));
+
+ struct {
+ struct in6_addr saddr;
+ struct in6_addr rcv_saddr;
+ struct in6_addr daddr;
+ } inet6 __attribute__ ((aligned(8)));
+
__u32 laddr_len;
__u32 raddr_len;
struct sockaddr_in laddr;
diff --git a/include/linux/checkpoint_types.h b/include/linux/checkpoint_types.h
index 77f8592..79c9c09 100644
--- a/include/linux/checkpoint_types.h
+++ b/include/linux/checkpoint_types.h
@@ -82,6 +82,7 @@ struct ckpt_ctx {
wait_queue_head_t waitq; /* waitqueue for restarting tasks */
wait_queue_head_t ghostq; /* waitqueue for ghost tasks */
struct cred *realcred, *ecred; /* tmp storage for cred at restart */
+ struct list_head listen_sockets;/* listening parent sockets */
struct ckpt_stats stats; /* statistics */
diff --git a/net/checkpoint.c b/net/checkpoint.c
index 49d9a2f..aba1497 100644
--- a/net/checkpoint.c
+++ b/net/checkpoint.c
@@ -324,6 +324,7 @@ static int __sock_write_skb(struct ckpt_ctx *ctx,
static int __sock_write_buffers(struct ckpt_ctx *ctx,
struct sk_buff_head *queue,
+ uint16_t family,
int dst_objref)
{
struct sk_buff *skb;
@@ -336,11 +337,11 @@ static int __sock_write_buffers(struct ckpt_ctx *ctx,
return -EBUSY;
}
- /* The other ancillary messages are always present
- * unlike descriptors. Even though we can't detect
- * them and fail the checkpoint, we're not at risk
- * because we don't save out (or restore) the control
- * information contained in the skb.
+ /* The other ancillary messages UNIX are always
+ * present unlike descriptors. Even though we can't
+ * detect them and fail the checkpoint, we're not at
+ * risk because we don't restore the control
+ * information in the UNIX code.
*/
ret = __sock_write_skb(ctx, skb, dst_objref);
@@ -353,6 +354,7 @@ static int __sock_write_buffers(struct ckpt_ctx *ctx,
static int sock_write_buffers(struct ckpt_ctx *ctx,
struct sk_buff_head *queue,
+ uint16_t family,
int dst_objref)
{
struct ckpt_hdr_socket_queue *h;
@@ -372,7 +374,7 @@ static int sock_write_buffers(struct ckpt_ctx *ctx,
h->skb_count = ret;
ret = ckpt_write_obj(ctx, (struct ckpt_hdr *) h);
if (!ret)
- ret = __sock_write_buffers(ctx, &tmpq, dst_objref);
+ ret = __sock_write_buffers(ctx, &tmpq, family, dst_objref);
out:
ckpt_hdr_put(ctx, h);
@@ -394,12 +396,14 @@ int sock_deferred_write_buffers(void *data)
return dst_objref;
}
- ret = sock_write_buffers(ctx, &dq->sk->sk_receive_queue, dst_objref);
+ ret = sock_write_buffers(ctx, &dq->sk->sk_receive_queue,
+ dq->sk->sk_family, dst_objref);
ckpt_debug("write recv buffers: %i\n", ret);
if (ret < 0)
return ret;
- ret = sock_write_buffers(ctx, &dq->sk->sk_write_queue, dst_objref);
+ ret = sock_write_buffers(ctx, &dq->sk->sk_write_queue,
+ dq->sk->sk_family, dst_objref);
ckpt_debug("write send buffers: %i\n", ret);
return ret;
@@ -924,10 +928,9 @@ struct sock *do_sock_restore(struct ckpt_ctx *ctx)
goto err;
if ((h->sock_common.family == AF_INET) &&
- (h->sock.state != TCP_LISTEN)) {
- /* Temporary hack to enable restore of TCP_LISTEN sockets
- * while forcing anything else to a closed state
- */
+ (h->sock.state != TCP_LISTEN) &&
+ (ctx->uflags & RESTART_CONN_RESET)) {
+ ckpt_debug("Forcing open socket closed\n");
sock->sk->sk_state = TCP_CLOSE;
sock->state = SS_UNCONNECTED;
}
diff --git a/net/ipv4/checkpoint.c b/net/ipv4/checkpoint.c
index 9cbbf5e..3e20cc9 100644
--- a/net/ipv4/checkpoint.c
+++ b/net/ipv4/checkpoint.c
@@ -17,6 +17,7 @@
#include <linux/deferqueue.h>
#include <net/tcp_states.h>
#include <net/tcp.h>
+#include <net/ipv6.h>
struct dq_sock {
struct ckpt_ctx *ctx;
@@ -28,6 +29,236 @@ struct dq_buffers {
struct sock *sk;
};
+struct listen_item {
+ struct sock *sk;
+ struct list_head list;
+};
+
+void sock_listening_list_free(struct list_head *head)
+{
+ struct listen_item *item, *tmp;
+
+ list_for_each_entry_safe(item, tmp, head, list) {
+ list_del(&item->list);
+ kfree(item);
+ }
+}
+
+static int sock_listening_list_add(struct ckpt_ctx *ctx, struct sock *sk)
+{
+ struct listen_item *item;
+
+ item = kmalloc(sizeof(*item), GFP_KERNEL);
+ if (!item)
+ return -ENOMEM;
+
+ item->sk = sk;
+ list_add(&item->list, &ctx->listen_sockets);
+
+ return 0;
+}
+
+static struct sock *sock_get_parent(struct ckpt_ctx *ctx, struct sock *sk)
+{
+ struct listen_item *item;
+
+ list_for_each_entry(item, &ctx->listen_sockets, list) {
+ if (inet_sk(sk)->sport == inet_sk(item->sk)->sport)
+ return item->sk;
+ }
+
+ return NULL;
+}
+
+static int sock_hash_parent(void *data)
+{
+ struct dq_sock *dq = (struct dq_sock *)data;
+ struct sock *parent;
+
+ ckpt_debug("INET post-restart hash\n");
+
+ dq->sk->sk_prot->hash(dq->sk);
+
+ /* If there is a listening socket with the same source port,
+ * then become a child of that socket [we are the result of an
+ * accept()]. Otherwise hash ourselves directly in [we are
+ * the result of a connect()]
+ */
+
+ parent = sock_get_parent(dq->ctx, dq->sk);
+ if (parent) {
+ inet_sk(dq->sk)->num = ntohs(inet_sk(dq->sk)->sport);
+ local_bh_disable();
+ __inet_inherit_port(parent, dq->sk);
+ local_bh_enable();
+ } else {
+ inet_sk(dq->sk)->num = 0;
+ inet_hash_connect(&tcp_death_row, dq->sk);
+ inet_sk(dq->sk)->num = ntohs(inet_sk(dq->sk)->sport);
+ }
+
+ return 0;
+}
+
+static int sock_defer_hash(struct ckpt_ctx *ctx, struct sock *sock)
+{
+ struct dq_sock dq;
+
+ dq.sk = sock;
+ dq.ctx = ctx;
+
+ return deferqueue_add(ctx->deferqueue, &dq, sizeof(dq),
+ sock_hash_parent, NULL);
+}
+
+static int sock_inet_tcp_cptrst(struct ckpt_ctx *ctx,
+ struct tcp_sock *sk,
+ struct ckpt_hdr_socket_inet *hh,
+ int op)
+{
+ CKPT_COPY(op, hh->tcp.rcv_nxt, sk->rcv_nxt);
+ CKPT_COPY(op, hh->tcp.copied_seq, sk->copied_seq);
+ CKPT_COPY(op, hh->tcp.rcv_wup, sk->rcv_wup);
+ CKPT_COPY(op, hh->tcp.snd_nxt, sk->snd_nxt);
+ CKPT_COPY(op, hh->tcp.snd_una, sk->snd_una);
+ CKPT_COPY(op, hh->tcp.snd_sml, sk->snd_sml);
+ CKPT_COPY(op, hh->tcp.rcv_tstamp, sk->rcv_tstamp);
+ CKPT_COPY(op, hh->tcp.lsndtime, sk->lsndtime);
+
+ CKPT_COPY(op, hh->tcp.snd_wl1, sk->snd_wl1);
+ CKPT_COPY(op, hh->tcp.snd_wnd, sk->snd_wnd);
+ CKPT_COPY(op, hh->tcp.max_window, sk->max_window);
+ CKPT_COPY(op, hh->tcp.mss_cache, sk->mss_cache);
+ CKPT_COPY(op, hh->tcp.window_clamp, sk->window_clamp);
+ CKPT_COPY(op, hh->tcp.rcv_ssthresh, sk->rcv_ssthresh);
+ CKPT_COPY(op, hh->tcp.frto_highmark, sk->frto_highmark);
+ CKPT_COPY(op, hh->tcp.advmss, sk->advmss);
+ CKPT_COPY(op, hh->tcp.frto_counter, sk->frto_counter);
+ CKPT_COPY(op, hh->tcp.nonagle, sk->nonagle);
+
+ CKPT_COPY(op, hh->tcp.srtt, sk->srtt);
+ CKPT_COPY(op, hh->tcp.mdev, sk->mdev);
+ CKPT_COPY(op, hh->tcp.mdev_max, sk->mdev_max);
+ CKPT_COPY(op, hh->tcp.rttvar, sk->rttvar);
+ CKPT_COPY(op, hh->tcp.rtt_seq, sk->rtt_seq);
+
+ CKPT_COPY(op, hh->tcp.packets_out, sk->packets_out);
+ CKPT_COPY(op, hh->tcp.retrans_out, sk->retrans_out);
+
+ CKPT_COPY(op, hh->tcp.urg_data, sk->urg_data);
+ CKPT_COPY(op, hh->tcp.ecn_flags, sk->ecn_flags);
+ CKPT_COPY(op, hh->tcp.reordering, sk->reordering);
+ CKPT_COPY(op, hh->tcp.snd_up, sk->snd_up);
+
+ CKPT_COPY(op, hh->tcp.keepalive_probes, sk->keepalive_probes);
+
+ CKPT_COPY(op, hh->tcp.rcv_wnd, sk->rcv_wnd);
+ CKPT_COPY(op, hh->tcp.write_seq, sk->write_seq);
+ CKPT_COPY(op, hh->tcp.pushed_seq, sk->pushed_seq);
+ CKPT_COPY(op, hh->tcp.lost_out, sk->lost_out);
+ CKPT_COPY(op, hh->tcp.sacked_out, sk->sacked_out);
+ CKPT_COPY(op, hh->tcp.fackets_out, sk->fackets_out);
+ CKPT_COPY(op, hh->tcp.tso_deferred, sk->tso_deferred);
+ CKPT_COPY(op, hh->tcp.bytes_acked, sk->bytes_acked);
+
+ CKPT_COPY(op, hh->tcp.lost_cnt_hint, sk->lost_cnt_hint);
+ CKPT_COPY(op, hh->tcp.retransmit_high, sk->retransmit_high);
+
+ CKPT_COPY(op, hh->tcp.lost_retrans_low, sk->lost_retrans_low);
+
+ CKPT_COPY(op, hh->tcp.prior_ssthresh, sk->prior_ssthresh);
+ CKPT_COPY(op, hh->tcp.high_seq, sk->high_seq);
+
+ CKPT_COPY(op, hh->tcp.retrans_stamp, sk->retrans_stamp);
+ CKPT_COPY(op, hh->tcp.undo_marker, sk->undo_marker);
+ CKPT_COPY(op, hh->tcp.undo_retrans, sk->undo_retrans);
+ CKPT_COPY(op, hh->tcp.total_retrans, sk->total_retrans);
+
+ CKPT_COPY(op, hh->tcp.urg_seq, sk->urg_seq);
+ CKPT_COPY(op, hh->tcp.keepalive_time, sk->keepalive_time);
+ CKPT_COPY(op, hh->tcp.keepalive_intvl, sk->keepalive_intvl);
+
+ if (!skb_queue_empty(&sk->ucopy.prequeue))
+ printk("PREQUEUE!\n");
+
+ return 0;
+}
+
+static int sock_inet_restore_addrs(struct inet_sock *inet,
+ struct ckpt_hdr_socket_inet *hh)
+{
+ inet->daddr = hh->raddr.sin_addr.s_addr;
+ inet->saddr = hh->laddr.sin_addr.s_addr;
+ inet->rcv_saddr = inet->saddr;
+
+ inet->dport = hh->raddr.sin_port;
+ inet->sport = hh->laddr.sin_port;
+
+ return 0;
+}
+
+static int sock_inet_cptrst(struct ckpt_ctx *ctx,
+ struct sock *sk,
+ struct ckpt_hdr_socket_inet *hh,
+ int op)
+{
+ struct inet_sock *inet = inet_sk(sk);
+ struct inet_connection_sock *icsk = inet_csk(sk);
+ int ret;
+
+ if (op == CKPT_CPT) {
+ CKPT_COPY(op, hh->daddr, inet->daddr);
+ CKPT_COPY(op, hh->rcv_saddr, inet->rcv_saddr);
+ CKPT_COPY(op, hh->dport, inet->dport);
+ CKPT_COPY(op, hh->saddr, inet->saddr);
+ CKPT_COPY(op, hh->sport, inet->sport);
+ } else {
+ ret = sock_inet_restore_addrs(inet, hh);
+ if (ret)
+ return ret;
+ }
+
+ CKPT_COPY(op, hh->num, inet->num);
+ CKPT_COPY(op, hh->uc_ttl, inet->uc_ttl);
+ CKPT_COPY(op, hh->cmsg_flags, inet->cmsg_flags);
+
+ CKPT_COPY(op, hh->icsk_ack.pending, icsk->icsk_ack.pending);
+ CKPT_COPY(op, hh->icsk_ack.quick, icsk->icsk_ack.quick);
+ CKPT_COPY(op, hh->icsk_ack.pingpong, icsk->icsk_ack.pingpong);
+ CKPT_COPY(op, hh->icsk_ack.blocked, icsk->icsk_ack.blocked);
+ CKPT_COPY(op, hh->icsk_ack.ato, icsk->icsk_ack.ato);
+ CKPT_COPY(op, hh->icsk_ack.timeout, icsk->icsk_ack.timeout);
+ CKPT_COPY(op, hh->icsk_ack.lrcvtime, icsk->icsk_ack.lrcvtime);
+ CKPT_COPY(op,
+ hh->icsk_ack.last_seg_size, icsk->icsk_ack.last_seg_size);
+ CKPT_COPY(op, hh->icsk_ack.rcv_mss, icsk->icsk_ack.rcv_mss);
+
+ if (sk->sk_protocol == IPPROTO_TCP)
+ ret = sock_inet_tcp_cptrst(ctx, tcp_sk(sk), hh, op);
+ else if (sk->sk_protocol == IPPROTO_UDP)
+ ret = 0;
+ else {
+ ret = -EINVAL;
+ ckpt_err(ctx, ret, "unknown socket protocol %d",
+ sk->sk_protocol);
+ }
+
+ if (sk->sk_family == AF_INET6) {
+ struct ipv6_pinfo *inet6 = inet6_sk(sk);
+ if (op == CKPT_CPT) {
+ ipv6_addr_copy(&hh->inet6.saddr, &inet6->saddr);
+ ipv6_addr_copy(&hh->inet6.rcv_saddr, &inet6->rcv_saddr);
+ ipv6_addr_copy(&hh->inet6.daddr, &inet6->daddr);
+ } else {
+ ipv6_addr_copy(&inet6->saddr, &hh->inet6.saddr);
+ ipv6_addr_copy(&inet6->rcv_saddr, &hh->inet6.rcv_saddr);
+ ipv6_addr_copy(&inet6->daddr, &hh->inet6.daddr);
+ }
+ }
+
+ return ret;
+}
+
int inet_checkpoint(struct ckpt_ctx *ctx, struct socket *sock)
{
struct ckpt_hdr_socket_inet *in;
@@ -43,6 +274,10 @@ int inet_checkpoint(struct ckpt_ctx *ctx, struct socket *sock)
if (ret)
goto out;
+ ret = sock_inet_cptrst(ctx, sock->sk, in, CKPT_CPT);
+ if (ret < 0)
+ goto out;
+
ret = ckpt_write_obj(ctx, (struct ckpt_hdr *) in);
out:
ckpt_hdr_put(ctx, in);
@@ -55,51 +290,22 @@ int inet_collect(struct ckpt_ctx *ctx, struct socket *sock)
return ckpt_obj_collect(ctx, sock->sk, CKPT_OBJ_SOCK);
}
-static int inet_read_buffer(struct ckpt_ctx *ctx, struct sk_buff_head *queue)
+static int inet_read_buffer(struct ckpt_ctx *ctx,
+ struct sk_buff_head *queue)
{
- struct ckpt_hdr_socket_buffer *h;
- int len;
- int ret;
struct sk_buff *skb = NULL;
- h = ckpt_read_obj_type(ctx, sizeof(*h), CKPT_HDR_SOCKET_BUFFER);
- if (IS_ERR(h))
- return PTR_ERR(h);
-
- len = _ckpt_read_obj_type(ctx, NULL, 0, CKPT_HDR_BUFFER);
- if (len < 0) {
- ret = len;
- goto out;
- } else if (len > SKB_MAX_ALLOC) {
- ckpt_debug("Socket buffer too big (%i > %lu)",
- len, SKB_MAX_ALLOC);
- ret = -ENOSPC;
- goto out;
- }
-
- skb = alloc_skb(len, GFP_KERNEL);
- if (!skb) {
- ret = -ENOMEM;
- goto out;
- }
-
- ret = ckpt_kread(ctx, skb_put(skb, len), len);
- if (ret < 0)
- goto out;
+ skb = sock_restore_skb(ctx);
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
- spin_lock(&queue->lock);
skb_queue_tail(queue, skb);
- spin_unlock(&queue->lock);
- out:
- ckpt_hdr_put(ctx, h);
-
- if ((ret < 0) && skb)
- kfree_skb(skb);
- return ret;
+ return skb->len;
}
-static int inet_read_buffers(struct ckpt_ctx *ctx, struct sk_buff_head *queue)
+static int inet_read_buffers(struct ckpt_ctx *ctx,
+ struct sk_buff_head *queue)
{
struct ckpt_hdr_socket_queue *h;
int ret = 0;
@@ -162,6 +368,19 @@ static int inet_defer_restore_buffers(struct ckpt_ctx *ctx, struct sock *sk)
static int inet_precheck(struct socket *sock, struct ckpt_hdr_socket_inet *in)
{
+ __u8 icsk_ack_mask = ICSK_ACK_SCHED | ICSK_ACK_TIMER |
+ ICSK_ACK_PUSHED | ICSK_ACK_PUSHED2;
+ __u16 urg_mask = TCP_URG_VALID | TCP_URG_NOTYET | TCP_URG_READ;
+ __u8 nonagle_mask = TCP_NAGLE_OFF | TCP_NAGLE_CORK | TCP_NAGLE_PUSH;
+ __u8 ecn_mask = TCP_ECN_OK | TCP_ECN_QUEUE_CWR | TCP_ECN_DEMAND_CWR;
+
+ if ((htons(in->laddr.sin_port) < PROT_SOCK) &&
+ !capable(CAP_NET_BIND_SERVICE)) {
+ ckpt_debug("unable to bind to port %hu\n",
+ htons(in->laddr.sin_port));
+ return -EINVAL;
+ }
+
if (in->laddr_len > sizeof(struct sockaddr_in)) {
ckpt_debug("laddr_len is too big\n");
return -EINVAL;
@@ -172,6 +391,77 @@ static int inet_precheck(struct socket *sock, struct ckpt_hdr_socket_inet *in)
return -EINVAL;
}
+ /* Set ato to the default */
+ in->icsk_ack.ato = TCP_ATO_MIN;
+
+ /* No quick acks are scheduled after a restart */
+ in->icsk_ack.quick = 0;
+
+ if (in->icsk_ack.pending & ~icsk_ack_mask) {
+ ckpt_debug("invalid pending flags 0x%x\n",
+ in->icsk_ack.pending & ~icsk_ack_mask);
+ return -EINVAL;
+ }
+
+ if (in->icsk_ack.pingpong > 1) {
+ ckpt_debug("invalid icsk_ack.pingpong value\n");
+ return -EINVAL;
+ }
+
+ if (in->icsk_ack.blocked > 1) {
+ ckpt_debug("invalid icsk_ack.blocked value\n");
+ return -EINVAL;
+ }
+
+ /* do_tcp_setsockopt() quietly makes this coercion */
+ if (in->tcp.window_clamp < (SOCK_MIN_RCVBUF / 2))
+ in->tcp.window_clamp = SOCK_MIN_RCVBUF / 2;
+ else if (in->tcp.window_clamp > 65535U) {
+ ckpt_debug("invalid window_clamp value\n");
+ return -EINVAL;
+ }
+
+ if (in->tcp.rcv_ssthresh > (4U * in->tcp.advmss))
+ in->tcp.rcv_ssthresh = 4U * in->tcp.advmss;
+
+ /* These will all be recalculated on the next call to
+ * tcp_rtt_estimator()
+ */
+ in->tcp.srtt = in->tcp.mdev = in->tcp.mdev_max = 0;
+ in->tcp.rttvar = in->tcp.rtt_seq = 0;
+
+ /* Might want to set packets_out to zero ? */
+
+ if (in->tcp.rcv_wnd > MAX_TCP_WINDOW)
+ in->tcp.rcv_wnd = MAX_TCP_WINDOW;
+
+ if (in->tcp.keepalive_intvl > MAX_TCP_KEEPINTVL) {
+ ckpt_debug("keepalive_intvl %i out of range\n",
+ in->tcp.keepalive_intvl);
+ return -EINVAL;
+ }
+
+ if (in->tcp.keepalive_probes > MAX_TCP_KEEPCNT) {
+ ckpt_debug("Invalid keepalive_probes value %i\n",
+ in->tcp.keepalive_probes);
+ return -EINVAL;
+ }
+
+ if (in->tcp.urg_data & ~urg_mask) {
+ ckpt_debug("Invalid urg_data value\n");
+ return -EINVAL;
+ }
+
+ if (in->tcp.nonagle & ~nonagle_mask) {
+ ckpt_debug("Invalid nonagle value\n");
+ return -EINVAL;
+ }
+
+ if (in->tcp.ecn_flags & ~ecn_mask) {
+ ckpt_debug("Invalid ecn_flags value\n");
+ return -EINVAL;
+ }
+
return 0;
}
@@ -209,8 +499,35 @@ int inet_restore(struct ckpt_ctx *ctx,
ckpt_debug("inet listen: %i\n", ret);
if (ret < 0)
goto out;
+
+ /* We are a listening socket, so add ourselves
+ * to the list of parent sockets. This will
+ * allow our children to find us later and
+ * link up
+ */
+
+ ret = sock_listening_list_add(ctx, sock->sk);
+ if (ret < 0)
+ goto out;
}
} else {
+ ret = sock_inet_cptrst(ctx, sock->sk, in, CKPT_RST);
+ if (ret)
+ goto out;
+
+ if ((h->sock.state == TCP_ESTABLISHED) &&
+ (h->sock.protocol == IPPROTO_TCP)) {
+ /* A connected socket that was spawned from an
+ * accept() needs to be hashed with its parent
+ * listening socket in order to receive
+ * traffic on the original port. Since we may
+ * not have restarted the parent yet, we defer
+ * this until later when we know we have all
+ * the listening sockets accounted for.
+ */
+ ret = sock_defer_hash(ctx, sock->sk);
+ }
+
if (!sock_flag(sock->sk, SOCK_DEAD))
ret = inet_defer_restore_buffers(ctx, sock->sk);
}
--
1.6.2.5
^ permalink raw reply related
* [PATCH] znet: fix build failure from i82593.h relocation
From: John W. Linville @ 2009-11-17 15:20 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, william.allen.simpson, davem, John W. Linville
In-Reply-To: <20091117.034428.47467823.davem@davemloft.net>
znet was including "wireless/i82593.h" (which is a bit wierd), and I
missed that when I relocated i82593.h to drivers/staging/wavelan. Since
I don't have ISA turned-on in my normal .config, I didn't see the build
failures -- mea culpa!
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
I'll just include this with the wireless-next-2.6 pull request I intend
to send later today...
drivers/net/znet.c | 3 +-
drivers/staging/wavelan/i82593.h | 229 --------------------------------
drivers/staging/wavelan/wavelan_cs.p.h | 2 +-
include/linux/i82593.h | 229 ++++++++++++++++++++++++++++++++
4 files changed, 231 insertions(+), 232 deletions(-)
delete mode 100644 drivers/staging/wavelan/i82593.h
create mode 100644 include/linux/i82593.h
diff --git a/drivers/net/znet.c b/drivers/net/znet.c
index b423473..443c4ee 100644
--- a/drivers/net/znet.c
+++ b/drivers/net/znet.c
@@ -103,8 +103,7 @@
#include <asm/io.h>
#include <asm/dma.h>
-/* This include could be elsewhere, since it is not wireless specific */
-#include "wireless/i82593.h"
+#include <linux/i82593.h>
static char version[] __initdata = "znet.c:v1.02 9/23/94 becker@scyld.com\n";
diff --git a/drivers/staging/wavelan/i82593.h b/drivers/staging/wavelan/i82593.h
deleted file mode 100644
index afac5c7..0000000
--- a/drivers/staging/wavelan/i82593.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Definitions for Intel 82593 CSMA/CD Core LAN Controller
- * The definitions are taken from the 1992 users manual with Intel
- * order number 297125-001.
- *
- * /usr/src/pc/RCS/i82593.h,v 1.1 1996/07/17 15:23:12 root Exp
- *
- * Copyright 1994, Anders Klemets <klemets@it.kth.se>
- *
- * HISTORY
- * i82593.h,v
- * Revision 1.4 2005/11/4 09:15:00 baroniunas
- * Modified copyright with permission of author as follows:
- *
- * "If I82539.H is the only file with my copyright statement
- * that is included in the Source Forge project, then you have
- * my approval to change the copyright statement to be a GPL
- * license, in the way you proposed on October 10."
- *
- * Revision 1.1 1996/07/17 15:23:12 root
- * Initial revision
- *
- * Revision 1.3 1995/04/05 15:13:58 adj
- * Initial alpha release
- *
- * Revision 1.2 1994/06/16 23:57:31 klemets
- * Mirrored all the fields in the configuration block.
- *
- * Revision 1.1 1994/06/02 20:25:34 klemets
- * Initial revision
- *
- *
- */
-#ifndef _I82593_H
-#define _I82593_H
-
-/* Intel 82593 CSMA/CD Core LAN Controller */
-
-/* Port 0 Command Register definitions */
-
-/* Execution operations */
-#define OP0_NOP 0 /* CHNL = 0 */
-#define OP0_SWIT_TO_PORT_1 0 /* CHNL = 1 */
-#define OP0_IA_SETUP 1
-#define OP0_CONFIGURE 2
-#define OP0_MC_SETUP 3
-#define OP0_TRANSMIT 4
-#define OP0_TDR 5
-#define OP0_DUMP 6
-#define OP0_DIAGNOSE 7
-#define OP0_TRANSMIT_NO_CRC 9
-#define OP0_RETRANSMIT 12
-#define OP0_ABORT 13
-/* Reception operations */
-#define OP0_RCV_ENABLE 8
-#define OP0_RCV_DISABLE 10
-#define OP0_STOP_RCV 11
-/* Status pointer control operations */
-#define OP0_FIX_PTR 15 /* CHNL = 1 */
-#define OP0_RLS_PTR 15 /* CHNL = 0 */
-#define OP0_RESET 14
-
-#define CR0_CHNL (1 << 4) /* 0=Channel 0, 1=Channel 1 */
-#define CR0_STATUS_0 0x00
-#define CR0_STATUS_1 0x20
-#define CR0_STATUS_2 0x40
-#define CR0_STATUS_3 0x60
-#define CR0_INT_ACK (1 << 7) /* 0=No ack, 1=acknowledge */
-
-/* Port 0 Status Register definitions */
-
-#define SR0_NO_RESULT 0 /* dummy */
-#define SR0_EVENT_MASK 0x0f
-#define SR0_IA_SETUP_DONE 1
-#define SR0_CONFIGURE_DONE 2
-#define SR0_MC_SETUP_DONE 3
-#define SR0_TRANSMIT_DONE 4
-#define SR0_TDR_DONE 5
-#define SR0_DUMP_DONE 6
-#define SR0_DIAGNOSE_PASSED 7
-#define SR0_TRANSMIT_NO_CRC_DONE 9
-#define SR0_RETRANSMIT_DONE 12
-#define SR0_EXECUTION_ABORTED 13
-#define SR0_END_OF_FRAME 8
-#define SR0_RECEPTION_ABORTED 10
-#define SR0_DIAGNOSE_FAILED 15
-#define SR0_STOP_REG_HIT 11
-
-#define SR0_CHNL (1 << 4)
-#define SR0_EXECUTION (1 << 5)
-#define SR0_RECEPTION (1 << 6)
-#define SR0_INTERRUPT (1 << 7)
-#define SR0_BOTH_RX_TX (SR0_EXECUTION | SR0_RECEPTION)
-
-#define SR3_EXEC_STATE_MASK 0x03
-#define SR3_EXEC_IDLE 0
-#define SR3_TX_ABORT_IN_PROGRESS 1
-#define SR3_EXEC_ACTIVE 2
-#define SR3_ABORT_IN_PROGRESS 3
-#define SR3_EXEC_CHNL (1 << 2)
-#define SR3_STP_ON_NO_RSRC (1 << 3)
-#define SR3_RCVING_NO_RSRC (1 << 4)
-#define SR3_RCV_STATE_MASK 0x60
-#define SR3_RCV_IDLE 0x00
-#define SR3_RCV_READY 0x20
-#define SR3_RCV_ACTIVE 0x40
-#define SR3_RCV_STOP_IN_PROG 0x60
-#define SR3_RCV_CHNL (1 << 7)
-
-/* Port 1 Command Register definitions */
-
-#define OP1_NOP 0
-#define OP1_SWIT_TO_PORT_0 1
-#define OP1_INT_DISABLE 2
-#define OP1_INT_ENABLE 3
-#define OP1_SET_TS 5
-#define OP1_RST_TS 7
-#define OP1_POWER_DOWN 8
-#define OP1_RESET_RING_MNGMT 11
-#define OP1_RESET 14
-#define OP1_SEL_RST 15
-
-#define CR1_STATUS_4 0x00
-#define CR1_STATUS_5 0x20
-#define CR1_STATUS_6 0x40
-#define CR1_STOP_REG_UPDATE (1 << 7)
-
-/* Receive frame status bits */
-
-#define RX_RCLD (1 << 0)
-#define RX_IA_MATCH (1 << 1)
-#define RX_NO_AD_MATCH (1 << 2)
-#define RX_NO_SFD (1 << 3)
-#define RX_SRT_FRM (1 << 7)
-#define RX_OVRRUN (1 << 8)
-#define RX_ALG_ERR (1 << 10)
-#define RX_CRC_ERR (1 << 11)
-#define RX_LEN_ERR (1 << 12)
-#define RX_RCV_OK (1 << 13)
-#define RX_TYP_LEN (1 << 15)
-
-/* Transmit status bits */
-
-#define TX_NCOL_MASK 0x0f
-#define TX_FRTL (1 << 4)
-#define TX_MAX_COL (1 << 5)
-#define TX_HRT_BEAT (1 << 6)
-#define TX_DEFER (1 << 7)
-#define TX_UND_RUN (1 << 8)
-#define TX_LOST_CTS (1 << 9)
-#define TX_LOST_CRS (1 << 10)
-#define TX_LTCOL (1 << 11)
-#define TX_OK (1 << 13)
-#define TX_COLL (1 << 15)
-
-struct i82593_conf_block {
- u_char fifo_limit : 4,
- forgnesi : 1,
- fifo_32 : 1,
- d6mod : 1,
- throttle_enb : 1;
- u_char throttle : 6,
- cntrxint : 1,
- contin : 1;
- u_char addr_len : 3,
- acloc : 1,
- preamb_len : 2,
- loopback : 2;
- u_char lin_prio : 3,
- tbofstop : 1,
- exp_prio : 3,
- bof_met : 1;
- u_char : 4,
- ifrm_spc : 4;
- u_char : 5,
- slottim_low : 3;
- u_char slottim_hi : 3,
- : 1,
- max_retr : 4;
- u_char prmisc : 1,
- bc_dis : 1,
- : 1,
- crs_1 : 1,
- nocrc_ins : 1,
- crc_1632 : 1,
- : 1,
- crs_cdt : 1;
- u_char cs_filter : 3,
- crs_src : 1,
- cd_filter : 3,
- : 1;
- u_char : 2,
- min_fr_len : 6;
- u_char lng_typ : 1,
- lng_fld : 1,
- rxcrc_xf : 1,
- artx : 1,
- sarec : 1,
- tx_jabber : 1, /* why is this called max_len in the manual? */
- hash_1 : 1,
- lbpkpol : 1;
- u_char : 6,
- fdx : 1,
- : 1;
- u_char dummy_6 : 6, /* supposed to be ones */
- mult_ia : 1,
- dis_bof : 1;
- u_char dummy_1 : 1, /* supposed to be one */
- tx_ifs_retrig : 2,
- mc_all : 1,
- rcv_mon : 2,
- frag_acpt : 1,
- tstrttrs : 1;
- u_char fretx : 1,
- runt_eop : 1,
- hw_sw_pin : 1,
- big_endn : 1,
- syncrqs : 1,
- sttlen : 1,
- tx_eop : 1,
- rx_eop : 1;
- u_char rbuf_size : 5,
- rcvstop : 1,
- : 2;
-};
-
-#define I82593_MAX_MULTICAST_ADDRESSES 128 /* Hardware hashed filter */
-
-#endif /* _I82593_H */
diff --git a/drivers/staging/wavelan/wavelan_cs.p.h b/drivers/staging/wavelan/wavelan_cs.p.h
index 81d9153..8fbfaa8 100644
--- a/drivers/staging/wavelan/wavelan_cs.p.h
+++ b/drivers/staging/wavelan/wavelan_cs.p.h
@@ -446,7 +446,7 @@
#include <pcmcia/ds.h>
/* Wavelan declarations */
-#include "i82593.h" /* Definitions for the Intel chip */
+#include <linux/i82593.h> /* Definitions for the Intel chip */
#include "wavelan_cs.h" /* Others bits of the hardware */
diff --git a/include/linux/i82593.h b/include/linux/i82593.h
new file mode 100644
index 0000000..afac5c7
--- /dev/null
+++ b/include/linux/i82593.h
@@ -0,0 +1,229 @@
+/*
+ * Definitions for Intel 82593 CSMA/CD Core LAN Controller
+ * The definitions are taken from the 1992 users manual with Intel
+ * order number 297125-001.
+ *
+ * /usr/src/pc/RCS/i82593.h,v 1.1 1996/07/17 15:23:12 root Exp
+ *
+ * Copyright 1994, Anders Klemets <klemets@it.kth.se>
+ *
+ * HISTORY
+ * i82593.h,v
+ * Revision 1.4 2005/11/4 09:15:00 baroniunas
+ * Modified copyright with permission of author as follows:
+ *
+ * "If I82539.H is the only file with my copyright statement
+ * that is included in the Source Forge project, then you have
+ * my approval to change the copyright statement to be a GPL
+ * license, in the way you proposed on October 10."
+ *
+ * Revision 1.1 1996/07/17 15:23:12 root
+ * Initial revision
+ *
+ * Revision 1.3 1995/04/05 15:13:58 adj
+ * Initial alpha release
+ *
+ * Revision 1.2 1994/06/16 23:57:31 klemets
+ * Mirrored all the fields in the configuration block.
+ *
+ * Revision 1.1 1994/06/02 20:25:34 klemets
+ * Initial revision
+ *
+ *
+ */
+#ifndef _I82593_H
+#define _I82593_H
+
+/* Intel 82593 CSMA/CD Core LAN Controller */
+
+/* Port 0 Command Register definitions */
+
+/* Execution operations */
+#define OP0_NOP 0 /* CHNL = 0 */
+#define OP0_SWIT_TO_PORT_1 0 /* CHNL = 1 */
+#define OP0_IA_SETUP 1
+#define OP0_CONFIGURE 2
+#define OP0_MC_SETUP 3
+#define OP0_TRANSMIT 4
+#define OP0_TDR 5
+#define OP0_DUMP 6
+#define OP0_DIAGNOSE 7
+#define OP0_TRANSMIT_NO_CRC 9
+#define OP0_RETRANSMIT 12
+#define OP0_ABORT 13
+/* Reception operations */
+#define OP0_RCV_ENABLE 8
+#define OP0_RCV_DISABLE 10
+#define OP0_STOP_RCV 11
+/* Status pointer control operations */
+#define OP0_FIX_PTR 15 /* CHNL = 1 */
+#define OP0_RLS_PTR 15 /* CHNL = 0 */
+#define OP0_RESET 14
+
+#define CR0_CHNL (1 << 4) /* 0=Channel 0, 1=Channel 1 */
+#define CR0_STATUS_0 0x00
+#define CR0_STATUS_1 0x20
+#define CR0_STATUS_2 0x40
+#define CR0_STATUS_3 0x60
+#define CR0_INT_ACK (1 << 7) /* 0=No ack, 1=acknowledge */
+
+/* Port 0 Status Register definitions */
+
+#define SR0_NO_RESULT 0 /* dummy */
+#define SR0_EVENT_MASK 0x0f
+#define SR0_IA_SETUP_DONE 1
+#define SR0_CONFIGURE_DONE 2
+#define SR0_MC_SETUP_DONE 3
+#define SR0_TRANSMIT_DONE 4
+#define SR0_TDR_DONE 5
+#define SR0_DUMP_DONE 6
+#define SR0_DIAGNOSE_PASSED 7
+#define SR0_TRANSMIT_NO_CRC_DONE 9
+#define SR0_RETRANSMIT_DONE 12
+#define SR0_EXECUTION_ABORTED 13
+#define SR0_END_OF_FRAME 8
+#define SR0_RECEPTION_ABORTED 10
+#define SR0_DIAGNOSE_FAILED 15
+#define SR0_STOP_REG_HIT 11
+
+#define SR0_CHNL (1 << 4)
+#define SR0_EXECUTION (1 << 5)
+#define SR0_RECEPTION (1 << 6)
+#define SR0_INTERRUPT (1 << 7)
+#define SR0_BOTH_RX_TX (SR0_EXECUTION | SR0_RECEPTION)
+
+#define SR3_EXEC_STATE_MASK 0x03
+#define SR3_EXEC_IDLE 0
+#define SR3_TX_ABORT_IN_PROGRESS 1
+#define SR3_EXEC_ACTIVE 2
+#define SR3_ABORT_IN_PROGRESS 3
+#define SR3_EXEC_CHNL (1 << 2)
+#define SR3_STP_ON_NO_RSRC (1 << 3)
+#define SR3_RCVING_NO_RSRC (1 << 4)
+#define SR3_RCV_STATE_MASK 0x60
+#define SR3_RCV_IDLE 0x00
+#define SR3_RCV_READY 0x20
+#define SR3_RCV_ACTIVE 0x40
+#define SR3_RCV_STOP_IN_PROG 0x60
+#define SR3_RCV_CHNL (1 << 7)
+
+/* Port 1 Command Register definitions */
+
+#define OP1_NOP 0
+#define OP1_SWIT_TO_PORT_0 1
+#define OP1_INT_DISABLE 2
+#define OP1_INT_ENABLE 3
+#define OP1_SET_TS 5
+#define OP1_RST_TS 7
+#define OP1_POWER_DOWN 8
+#define OP1_RESET_RING_MNGMT 11
+#define OP1_RESET 14
+#define OP1_SEL_RST 15
+
+#define CR1_STATUS_4 0x00
+#define CR1_STATUS_5 0x20
+#define CR1_STATUS_6 0x40
+#define CR1_STOP_REG_UPDATE (1 << 7)
+
+/* Receive frame status bits */
+
+#define RX_RCLD (1 << 0)
+#define RX_IA_MATCH (1 << 1)
+#define RX_NO_AD_MATCH (1 << 2)
+#define RX_NO_SFD (1 << 3)
+#define RX_SRT_FRM (1 << 7)
+#define RX_OVRRUN (1 << 8)
+#define RX_ALG_ERR (1 << 10)
+#define RX_CRC_ERR (1 << 11)
+#define RX_LEN_ERR (1 << 12)
+#define RX_RCV_OK (1 << 13)
+#define RX_TYP_LEN (1 << 15)
+
+/* Transmit status bits */
+
+#define TX_NCOL_MASK 0x0f
+#define TX_FRTL (1 << 4)
+#define TX_MAX_COL (1 << 5)
+#define TX_HRT_BEAT (1 << 6)
+#define TX_DEFER (1 << 7)
+#define TX_UND_RUN (1 << 8)
+#define TX_LOST_CTS (1 << 9)
+#define TX_LOST_CRS (1 << 10)
+#define TX_LTCOL (1 << 11)
+#define TX_OK (1 << 13)
+#define TX_COLL (1 << 15)
+
+struct i82593_conf_block {
+ u_char fifo_limit : 4,
+ forgnesi : 1,
+ fifo_32 : 1,
+ d6mod : 1,
+ throttle_enb : 1;
+ u_char throttle : 6,
+ cntrxint : 1,
+ contin : 1;
+ u_char addr_len : 3,
+ acloc : 1,
+ preamb_len : 2,
+ loopback : 2;
+ u_char lin_prio : 3,
+ tbofstop : 1,
+ exp_prio : 3,
+ bof_met : 1;
+ u_char : 4,
+ ifrm_spc : 4;
+ u_char : 5,
+ slottim_low : 3;
+ u_char slottim_hi : 3,
+ : 1,
+ max_retr : 4;
+ u_char prmisc : 1,
+ bc_dis : 1,
+ : 1,
+ crs_1 : 1,
+ nocrc_ins : 1,
+ crc_1632 : 1,
+ : 1,
+ crs_cdt : 1;
+ u_char cs_filter : 3,
+ crs_src : 1,
+ cd_filter : 3,
+ : 1;
+ u_char : 2,
+ min_fr_len : 6;
+ u_char lng_typ : 1,
+ lng_fld : 1,
+ rxcrc_xf : 1,
+ artx : 1,
+ sarec : 1,
+ tx_jabber : 1, /* why is this called max_len in the manual? */
+ hash_1 : 1,
+ lbpkpol : 1;
+ u_char : 6,
+ fdx : 1,
+ : 1;
+ u_char dummy_6 : 6, /* supposed to be ones */
+ mult_ia : 1,
+ dis_bof : 1;
+ u_char dummy_1 : 1, /* supposed to be one */
+ tx_ifs_retrig : 2,
+ mc_all : 1,
+ rcv_mon : 2,
+ frag_acpt : 1,
+ tstrttrs : 1;
+ u_char fretx : 1,
+ runt_eop : 1,
+ hw_sw_pin : 1,
+ big_endn : 1,
+ syncrqs : 1,
+ sttlen : 1,
+ tx_eop : 1,
+ rx_eop : 1;
+ u_char rbuf_size : 5,
+ rcvstop : 1,
+ : 2;
+};
+
+#define I82593_MAX_MULTICAST_ADDRESSES 128 /* Hardware hashed filter */
+
+#endif /* _I82593_H */
--
1.6.2.5
^ permalink raw reply related
* Re: [PATCH 2/2 net-next-2.6] vlan: Precise RX stats accounting
From: Eric Dumazet @ 2009-11-17 14:53 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20091117.002037.229474882.davem@davemloft.net>
David Miller a écrit :
>
> Eric, please make allocation failure cause the vlan_setup()
> to fail and propagate -EFAULT back to the caller.
>
Given that vlan_setup(struct net_device *) is void and cannot
return error status, unless using a global variable (ugly),
or changing all setup() prototypes (oh well...)
One possibility is to perform the allocation in vlan_dev_init()
(called from register_netdevice()), and freeing it in vlan_dev_uninit().
Thanks
[PATCH net-next-2.6 take2] vlan: Precise RX stats accounting
With multi queue devices, its possible that several cpus call
vlan RX routines simultaneously for the same vlan device.
We update RX stats counter without any locking, so we can
get slightly wrong counters.
One possible fix is to use percpu counters, to get precise
accounting and also get guarantee of no cache line ping pongs
between cpus.
Note: this adds 16 bytes (32 bytes on 64bit arches) of percpu
data per vlan device.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/8021q/vlan.h | 17 ++++++++++++++
net/8021q/vlan_core.c | 12 +++++-----
net/8021q/vlan_dev.c | 47 ++++++++++++++++++++++++++++++++++------
3 files changed, 65 insertions(+), 11 deletions(-)
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 68f9290..5685296 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -16,6 +16,21 @@ struct vlan_priority_tci_mapping {
struct vlan_priority_tci_mapping *next;
};
+
+/**
+ * struct vlan_rx_stats - VLAN percpu rx stats
+ * @rx_packets: number of received packets
+ * @rx_bytes: number of received bytes
+ * @multicast: number of received multicast packets
+ * @rx_errors: number of errors
+ */
+struct vlan_rx_stats {
+ unsigned long rx_packets;
+ unsigned long rx_bytes;
+ unsigned long multicast;
+ unsigned long rx_errors;
+};
+
/**
* struct vlan_dev_info - VLAN private device data
* @nr_ingress_mappings: number of ingress priority mappings
@@ -29,6 +44,7 @@ struct vlan_priority_tci_mapping {
* @dent: proc dir entry
* @cnt_inc_headroom_on_tx: statistic - number of skb expansions on TX
* @cnt_encap_on_xmit: statistic - number of skb encapsulations on TX
+ * @vlan_rx_stats: ptr to percpu rx stats
*/
struct vlan_dev_info {
unsigned int nr_ingress_mappings;
@@ -45,6 +61,7 @@ struct vlan_dev_info {
struct proc_dir_entry *dent;
unsigned long cnt_inc_headroom_on_tx;
unsigned long cnt_encap_on_xmit;
+ struct vlan_rx_stats *vlan_rx_stats;
};
static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev)
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 971d375..e75a2f3 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -31,7 +31,7 @@ EXPORT_SYMBOL(__vlan_hwaccel_rx);
int vlan_hwaccel_do_receive(struct sk_buff *skb)
{
struct net_device *dev = skb->dev;
- struct net_device_stats *stats;
+ struct vlan_rx_stats *rx_stats;
skb->dev = vlan_dev_info(dev)->real_dev;
netif_nit_deliver(skb);
@@ -40,15 +40,17 @@ int vlan_hwaccel_do_receive(struct sk_buff *skb)
skb->priority = vlan_get_ingress_priority(dev, skb->vlan_tci);
skb->vlan_tci = 0;
- stats = &dev->stats;
- stats->rx_packets++;
- stats->rx_bytes += skb->len;
+ rx_stats = per_cpu_ptr(vlan_dev_info(dev)->vlan_rx_stats,
+ smp_processor_id());
+
+ rx_stats->rx_packets++;
+ rx_stats->rx_bytes += skb->len;
switch (skb->pkt_type) {
case PACKET_BROADCAST:
break;
case PACKET_MULTICAST:
- stats->multicast++;
+ rx_stats->multicast++;
break;
case PACKET_OTHERHOST:
/* Our lower layer thinks this is not local, let's make sure.
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 9159659..de0dc6b 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -140,7 +140,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *ptype, struct net_device *orig_dev)
{
struct vlan_hdr *vhdr;
- struct net_device_stats *stats;
+ struct vlan_rx_stats *rx_stats;
u16 vlan_id;
u16 vlan_tci;
@@ -163,9 +163,10 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
goto err_unlock;
}
- stats = &skb->dev->stats;
- stats->rx_packets++;
- stats->rx_bytes += skb->len;
+ rx_stats = per_cpu_ptr(vlan_dev_info(dev)->vlan_rx_stats,
+ smp_processor_id());
+ rx_stats->rx_packets++;
+ rx_stats->rx_bytes += skb->len;
skb_pull_rcsum(skb, VLAN_HLEN);
@@ -180,7 +181,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
break;
case PACKET_MULTICAST:
- stats->multicast++;
+ rx_stats->multicast++;
break;
case PACKET_OTHERHOST:
@@ -200,7 +201,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
skb = vlan_check_reorder_header(skb);
if (!skb) {
- stats->rx_errors++;
+ rx_stats->rx_errors++;
goto err_unlock;
}
@@ -731,6 +732,11 @@ static int vlan_dev_init(struct net_device *dev)
subclass = 1;
vlan_dev_set_lockdep_class(dev, subclass);
+
+ vlan_dev_info(dev)->vlan_rx_stats = alloc_percpu(struct vlan_rx_stats);
+ if (!vlan_dev_info(dev)->vlan_rx_stats)
+ return -ENOMEM;
+
return 0;
}
@@ -740,6 +746,8 @@ static void vlan_dev_uninit(struct net_device *dev)
struct vlan_dev_info *vlan = vlan_dev_info(dev);
int i;
+ free_percpu(vlan->vlan_rx_stats);
+ vlan->vlan_rx_stats = NULL;
for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) {
while ((pm = vlan->egress_priority_map[i]) != NULL) {
vlan->egress_priority_map[i] = pm->next;
@@ -775,6 +783,31 @@ static u32 vlan_ethtool_get_flags(struct net_device *dev)
return dev_ethtool_get_flags(vlan->real_dev);
}
+static struct net_device_stats *vlan_dev_get_stats(struct net_device *dev)
+{
+ struct net_device_stats *stats = &dev->stats;
+
+ dev_txq_stats_fold(dev, stats);
+
+ if (vlan_dev_info(dev)->vlan_rx_stats) {
+ struct vlan_rx_stats *p, rx = {0};
+ int i;
+
+ for_each_possible_cpu(i) {
+ p = per_cpu_ptr(vlan_dev_info(dev)->vlan_rx_stats, i);
+ rx.rx_packets += p->rx_packets;
+ rx.rx_bytes += p->rx_bytes;
+ rx.rx_errors += p->rx_errors;
+ rx.multicast += p->multicast;
+ }
+ stats->rx_packets = rx.rx_packets;
+ stats->rx_bytes = rx.rx_bytes;
+ stats->rx_errors = rx.rx_errors;
+ stats->multicast = rx.multicast;
+ }
+ return stats;
+}
+
static const struct ethtool_ops vlan_ethtool_ops = {
.get_settings = vlan_ethtool_get_settings,
.get_drvinfo = vlan_ethtool_get_drvinfo,
@@ -797,6 +830,7 @@ static const struct net_device_ops vlan_netdev_ops = {
.ndo_change_rx_flags = vlan_dev_change_rx_flags,
.ndo_do_ioctl = vlan_dev_ioctl,
.ndo_neigh_setup = vlan_dev_neigh_setup,
+ .ndo_get_stats = vlan_dev_get_stats,
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
.ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup,
.ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done,
@@ -820,6 +854,7 @@ static const struct net_device_ops vlan_netdev_accel_ops = {
.ndo_change_rx_flags = vlan_dev_change_rx_flags,
.ndo_do_ioctl = vlan_dev_ioctl,
.ndo_neigh_setup = vlan_dev_neigh_setup,
+ .ndo_get_stats = vlan_dev_get_stats,
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
.ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup,
.ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done,
^ 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