* Re: 3.0.8 kernel : NULL ptr deref in skb_queue_purge()
From: Greg KH @ 2011-12-08 18:02 UTC (permalink / raw)
To: Grant Grundler
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <CANEJEGtJ3UmFNyui_SaZ6NF5FFVjZ+_UBg1RC2eif5Lu1YKDsQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Wed, Dec 07, 2011 at 02:40:49PM -0800, Grant Grundler wrote:
> Hi,
> I'm testing asix (USB 100BT ethernet adapter with AX88772) driver
> initialization (and shut down) paths and reproduced a
> "skb_queue_purge" panic 3 times after a few hundred/thousand
> iterations of rmmod/modprobe. I'm inclined to believe
> skb_queue_purge() is a victim and not a culprit here.
>
> I don't know if all 3 "spontaneous reboots" I've seen have the same
> stack trace as the one I have a record for:
Have you tried this on 3.1, and especially, 3.2-rc? A number of asix
patches have gone into the 3.2-rc series, perhaps they might have
resolved this problem already?
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH net-next] bnx2x: properly initialize L5 features
From: Dmitry Kravkov @ 2011-12-08 18:04 UTC (permalink / raw)
To: davem, netdev; +Cc: eric.dumazet, barak, Dmitry Kravkov
The code is missing initialization of NO_FCOE_FLAG and NO_ISCSI*FLAGS
when CONFIG_CNIC is not selected.
This causes panic during driver load since commit
1d187b34daaecbb87aa523ba46b92930a388cb21 where NO_FCOE tested
unconditionally (outside #ifdef BCM_CNIC structure) and
accessed fp[FCOE_IDX] which is not allocated.
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 2 --
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 12 ++++++++----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index 2891cdc..bf27c54 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -1491,7 +1491,6 @@ static inline u16 bnx2x_extract_max_cfg(struct bnx2x *bp, u32 mf_cfg)
return max_cfg;
}
-#ifdef BCM_CNIC
/**
* bnx2x_get_iscsi_info - update iSCSI params according to licensing info.
*
@@ -1499,7 +1498,6 @@ static inline u16 bnx2x_extract_max_cfg(struct bnx2x *bp, u32 mf_cfg)
*
*/
void bnx2x_get_iscsi_info(struct bnx2x *bp);
-#endif
/* returns func by VN for current port */
static inline int func_by_vn(struct bnx2x *bp, int vn)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 62aa3a8..b45baf9 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9478,9 +9478,9 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp)
bp->common.shmem2_base);
}
-#ifdef BCM_CNIC
void bnx2x_get_iscsi_info(struct bnx2x *bp)
{
+#ifdef BCM_CNIC
int port = BP_PORT(bp);
u32 max_iscsi_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp,
@@ -9500,10 +9500,14 @@ void bnx2x_get_iscsi_info(struct bnx2x *bp)
*/
if (!bp->cnic_eth_dev.max_iscsi_conn)
bp->flags |= NO_ISCSI_FLAG;
+#else
+ bp->flags |= NO_ISCSI_FLAG;
+#endif
}
static void __devinit bnx2x_get_fcoe_info(struct bnx2x *bp)
{
+#ifdef BCM_CNIC
int port = BP_PORT(bp);
int func = BP_ABS_FUNC(bp);
@@ -9570,6 +9574,9 @@ static void __devinit bnx2x_get_fcoe_info(struct bnx2x *bp)
*/
if (!bp->cnic_eth_dev.max_fcoe_conn)
bp->flags |= NO_FCOE_FLAG;
+#else
+ bp->flags |= NO_FCOE_FLAG;
+#endif
}
static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp)
@@ -9582,7 +9589,6 @@ static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp)
bnx2x_get_iscsi_info(bp);
bnx2x_get_fcoe_info(bp);
}
-#endif
static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
{
@@ -9907,9 +9913,7 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp)
/* Get MAC addresses */
bnx2x_get_mac_hwinfo(bp);
-#ifdef BCM_CNIC
bnx2x_get_cnic_info(bp);
-#endif
/* Get current FW pulse sequence */
if (!BP_NOMCP(bp)) {
--
1.7.7.2
^ permalink raw reply related
* Re: [PATCH net-next] sch_red: Adaptative RED AQM
From: Eric Dumazet @ 2011-12-08 18:16 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Dave Taht, David Miller, linux-wireless, netdev,
Hagen Paul Pfeifer, bloat-devel, bloat
In-Reply-To: <20111208092130.656c39ff@nehalam.linuxnetplumber.net>
Le jeudi 08 décembre 2011 à 09:21 -0800, Stephen Hemminger a écrit :
> Is this backward compatible for users that don't specify
> an adaptive parameter.
Yes, completely compatible. I made sure max_p was initted with value
provided by tc (Plog based)
I also plan the TCA_RED_MAX_P support at configuration time with finer
granularity than 1/(2^Plog), so a new tc user can ask for precise
probability instead of current few discrete values. [ for non adaptative
RED of course, since max_p can change very fast otherwise :) ]
^ permalink raw reply
* Re: 3.0.8 kernel : NULL ptr deref in skb_queue_purge()
From: Grant Grundler @ 2011-12-08 19:04 UTC (permalink / raw)
To: Greg KH; +Cc: netdev, linux-usb
In-Reply-To: <20111208180208.GA16883@kroah.com>
On Thu, Dec 8, 2011 at 10:02 AM, Greg KH <greg@kroah.com> wrote:
> On Wed, Dec 07, 2011 at 02:40:49PM -0800, Grant Grundler wrote:
>> Hi,
>> I'm testing asix (USB 100BT ethernet adapter with AX88772) driver
>> initialization (and shut down) paths and reproduced a
>> "skb_queue_purge" panic 3 times after a few hundred/thousand
>> iterations of rmmod/modprobe. I'm inclined to believe
>> skb_queue_purge() is a victim and not a culprit here.
>>
>> I don't know if all 3 "spontaneous reboots" I've seen have the same
>> stack trace as the one I have a record for:
>
> Have you tried this on 3.1, and especially, 3.2-rc?
Hi Greg,
I haven't tried any thing later yet. I would consider it if someone
could point at a change(s) that might be relevant to the symptom.
> A number of asix
> patches have gone into the 3.2-rc series, perhaps they might have
> resolved this problem already?
I'm the one who submitted those changes. :)
asix.c driver I'm testing was pulled directly from davem's net-next
tree and I believe that's what is in 3.2-rc series now.
Those changes only relate to AX88772 and AX88178 bind and reset code.
suspend/resume support is unchanged - though I suspect ax*_reset
functions get called in resume.
It's possible this code path in asix.c has *always* been broken. I see
two drivesr/net/usbnet USB drivers that do this:
drivers/net/usb/cdc_ether.c 614 .reset_resume = usbnet_resume,
drivers/net/usb/cdc_ncm.c 1193 .reset_resume = usbnet_resume,
Even though most usbnet drivers don't, I'm tempted to add this code
and "just try it":
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index e6fed4d..b2de65f 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -1666,6 +1666,7 @@ static struct usb_driver asix_driver = {
.probe = usbnet_probe,
.suspend = usbnet_suspend,
.resume = usbnet_resume,
+ .reset_resume = usbnet_reset_resume,
.disconnect = usbnet_disconnect,
.supports_autosuspend = 1,
};
thanks!
grant
^ permalink raw reply related
* Re: [RFT] sky2: 32 bit DMA quirk
From: Milan Kocian @ 2011-12-08 19:58 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20111207150205.3fad9290@nehalam.linuxnetplumber.net>
Hello Stephen,
On Wed, Dec 07, 2011 at 03:02:05PM -0800, Stephen Hemminger wrote:
> This a patch to force 32 bit DMA. Not sure if the DMI values
> are right for the Gigabyte motherboard with the problem.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
Unfortunately it didn't help. I tried parameter
only_32bit_dma=1 alone and then with parameter disable_msi=1
with the same result.
> --- a/drivers/net/ethernet/marvell/sky2.c 2011-12-07 10:54:18.816279159 -0800
> +++ b/drivers/net/ethernet/marvell/sky2.c 2011-12-07 14:59:47.737381388 -0800
> @@ -41,6 +41,7 @@
> #include <linux/delay.h>
> #include <linux/workqueue.h>
> #include <linux/if_vlan.h>
> +#include <linux/dmi.h>
> #include <linux/prefetch.h>
> #include <linux/debugfs.h>
> #include <linux/mii.h>
> @@ -95,6 +96,10 @@ static int disable_msi = 0;
> module_param(disable_msi, int, 0);
> MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
>
> +static int only_32bit_dma;
> +module_param(only_32bit_dma, int, 0);
> +MODULE_PARM_DESC(only_32bit_dma, "Limit device to 32 bit DMA access");
> +
> static DEFINE_PCI_DEVICE_TABLE(sky2_id_table) = {
> { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, /* SK-9Sxx */
> { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */
> @@ -4889,7 +4894,7 @@ static int __devinit sky2_probe(struct p
>
> pci_set_master(pdev);
>
> - if (sizeof(dma_addr_t) > sizeof(u32) &&
> + if (sizeof(dma_addr_t) > sizeof(u32) && !only_32bit_dma &&
> !(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))) {
> using_dac = 1;
> err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
> @@ -5163,10 +5168,24 @@ static struct pci_driver sky2_driver = {
> .driver.pm = SKY2_PM_OPS,
> };
>
> +static struct dmi_system_id sky2_32bit_dma_boards[] = {
> + {
> + .ident = "Gigabyte GA-965GM-S2 boards",
> + .matches = {
> + DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co"),
> + DMI_MATCH(DMI_BOARD_NAME, "GA-965GM-S2"),
> + },
> + },
> + {}
> +};
> +
> static int __init sky2_init_module(void)
> {
> pr_info("driver version " DRV_VERSION "\n");
>
> + if (dmi_check_system(sky2_32bit_dma_boards))
> + only_32bit_dma = 1;
> +
> sky2_debug_init();
> return pci_register_driver(&sky2_driver);
> }
>
>
--
Milan Kocian
^ permalink raw reply
* Re: [PATCH 0/4] SUNRPC: pass network namespace context to sockaddr construction routines
From: J. Bruce Fields @ 2011-12-08 20:46 UTC (permalink / raw)
To: Stanislav Kinsbursky
Cc: Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA,
linux-nfs-u79uwXL29TY76Z2rM5mHXA, xemul-bzQdu9zFT3WakBO8gow8eQ,
neilb-l3A5Bk7waGM, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
jbottomley-bzQdu9zFT3WakBO8gow8eQ, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
devel-GEFAQzZX7r8dnm+yROfE0A
In-Reply-To: <20111207111716.17273.63010.stgit-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
On Wed, Dec 07, 2011 at 03:20:07PM +0300, Stanislav Kinsbursky wrote:
> This is another precursor patch set aimed to remove hard-coded "init_net"
> reference from SUNRPC sockaddr convertion and construction routines.
ACK--all look straightforward. (Only complaint would be that this isn't
terribly interesting till we see how these are used.)
--b.
>
> The following series consists of:
>
> ---
>
> Stanislav Kinsbursky (4):
> SUNRPC: use passed network namespace context in rpc_parse_scope_id()
> SUNRPC: use passed network namespace context in rpc_pton6()
> SUNRPC: use passed network namespace context in rpc_pton()
> SUNRPC: use passed network namespace context in rpc_uaddr2sockaddr()
>
>
> fs/nfs/dns_resolve.c | 4 ++--
> fs/nfs/nfs4filelayoutdev.c | 2 +-
> fs/nfs/nfs4namespace.c | 2 +-
> fs/nfs/super.c | 4 ++--
> fs/nfsd/nfs4state.c | 2 +-
> fs/nfsd/nfsctl.c | 2 +-
> include/linux/sunrpc/clnt.h | 4 ++--
> net/sunrpc/addr.c | 24 +++++++++++++-----------
> net/sunrpc/rpcb_clnt.c | 2 +-
> net/sunrpc/svcauth_unix.c | 2 +-
> 10 files changed, 25 insertions(+), 23 deletions(-)
>
> --
> Signature
--
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 1/4] SUNRPC: use passed network namespace context in rpc_parse_scope_id()
From: J. Bruce Fields @ 2011-12-08 20:47 UTC (permalink / raw)
To: Stanislav Kinsbursky
Cc: Trond.Myklebust, linux-nfs, xemul, neilb, netdev, linux-kernel,
jbottomley, davem, devel
In-Reply-To: <20111207112016.17273.44510.stgit@localhost6.localdomain6>
On Wed, Dec 07, 2011 at 03:20:16PM +0300, Stanislav Kinsbursky wrote:
> Use incomming network context in rpc_parse_scope_id() instead of hard-coded
Changelogs are a little confusing; I might have said "allow
rpc_parse_cope_id() caller to pass in network context instead of using
hard-code "init_net"."
--b.
> "init_net".
>
> Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
>
> ---
> net/sunrpc/addr.c | 9 +++++----
> 1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c
> index 67a655e..35eb188 100644
> --- a/net/sunrpc/addr.c
> +++ b/net/sunrpc/addr.c
> @@ -156,8 +156,9 @@ static size_t rpc_pton4(const char *buf, const size_t buflen,
> }
>
> #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
> -static int rpc_parse_scope_id(const char *buf, const size_t buflen,
> - const char *delim, struct sockaddr_in6 *sin6)
> +static int rpc_parse_scope_id(struct net *net, const char *buf,
> + const size_t buflen, const char *delim,
> + struct sockaddr_in6 *sin6)
> {
> char *p;
> size_t len;
> @@ -177,7 +178,7 @@ static int rpc_parse_scope_id(const char *buf, const size_t buflen,
> unsigned long scope_id = 0;
> struct net_device *dev;
>
> - dev = dev_get_by_name(&init_net, p);
> + dev = dev_get_by_name(net, p);
> if (dev != NULL) {
> scope_id = dev->ifindex;
> dev_put(dev);
> @@ -213,7 +214,7 @@ static size_t rpc_pton6(const char *buf, const size_t buflen,
> if (in6_pton(buf, buflen, addr, IPV6_SCOPE_DELIMITER, &delim) == 0)
> return 0;
>
> - if (!rpc_parse_scope_id(buf, buflen, delim, sin6))
> + if (!rpc_parse_scope_id(&init_net, buf, buflen, delim, sin6))
> return 0;
>
> sin6->sin6_family = AF_INET6;
>
^ permalink raw reply
* Re: 3.0.8 kernel : NULL ptr deref in skb_queue_purge()
From: Greg KH @ 2011-12-08 21:35 UTC (permalink / raw)
To: Grant Grundler; +Cc: netdev, linux-usb
In-Reply-To: <CANEJEGvNePLb9KcMO-sGSN81y6mb_zaHHQVujSbJXcCwh3Xcmw@mail.gmail.com>
On Thu, Dec 08, 2011 at 11:04:48AM -0800, Grant Grundler wrote:
> On Thu, Dec 8, 2011 at 10:02 AM, Greg KH <greg@kroah.com> wrote:
> > On Wed, Dec 07, 2011 at 02:40:49PM -0800, Grant Grundler wrote:
> >> Hi,
> >> I'm testing asix (USB 100BT ethernet adapter with AX88772) driver
> >> initialization (and shut down) paths and reproduced a
> >> "skb_queue_purge" panic 3 times after a few hundred/thousand
> >> iterations of rmmod/modprobe. I'm inclined to believe
> >> skb_queue_purge() is a victim and not a culprit here.
> >>
> >> I don't know if all 3 "spontaneous reboots" I've seen have the same
> >> stack trace as the one I have a record for:
> >
> > Have you tried this on 3.1, and especially, 3.2-rc?
>
> Hi Greg,
> I haven't tried any thing later yet. I would consider it if someone
> could point at a change(s) that might be relevant to the symptom.
>
>
> > A number of asix
> > patches have gone into the 3.2-rc series, perhaps they might have
> > resolved this problem already?
>
> I'm the one who submitted those changes. :)
Heh, oops, sorry about that :)
> asix.c driver I'm testing was pulled directly from davem's net-next
> tree and I believe that's what is in 3.2-rc series now.
>
> Those changes only relate to AX88772 and AX88178 bind and reset code.
> suspend/resume support is unchanged - though I suspect ax*_reset
> functions get called in resume.
>
> It's possible this code path in asix.c has *always* been broken. I see
> two drivesr/net/usbnet USB drivers that do this:
>
> drivers/net/usb/cdc_ether.c 614 .reset_resume = usbnet_resume,
> drivers/net/usb/cdc_ncm.c 1193 .reset_resume = usbnet_resume,
>
> Even though most usbnet drivers don't, I'm tempted to add this code
> and "just try it":
Let us know if that works or not.
thanks,
greg k-h
^ permalink raw reply
* [PATCH net-next 6/6] tg3: Update version to 3.122
From: Matt Carlson @ 2011-12-08 21:50 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch updates the tg3 version to 3.122.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index d1b8ec5..558dcdf1 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -89,10 +89,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)
#define DRV_MODULE_NAME "tg3"
#define TG3_MAJ_NUM 3
-#define TG3_MIN_NUM 121
+#define TG3_MIN_NUM 122
#define DRV_MODULE_VERSION \
__stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)
-#define DRV_MODULE_RELDATE "November 2, 2011"
+#define DRV_MODULE_RELDATE "December 7, 2011"
#define RESET_KIND_SHUTDOWN 0
#define RESET_KIND_INIT 1
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 1/6] tg3: Remove ethtool stats member from dev struct
From: Matt Carlson @ 2011-12-08 21:49 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson, Michael Chan
This patch removes the ethtool stats member from the tg3 device
structure.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 14 +++++++-------
drivers/net/ethernet/broadcom/tg3.h | 1 -
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index cf36312..26eb4d4 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -9770,7 +9770,8 @@ err_out1:
static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *,
struct rtnl_link_stats64 *);
-static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *);
+static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *,
+ struct tg3_ethtool_stats *);
static int tg3_close(struct net_device *dev)
{
@@ -9804,9 +9805,7 @@ static int tg3_close(struct net_device *dev)
tg3_ints_fini(tp);
tg3_get_stats64(tp->dev, &tp->net_stats_prev);
-
- memcpy(&tp->estats_prev, tg3_get_estats(tp),
- sizeof(tp->estats_prev));
+ tg3_get_estats(tp, &tp->estats_prev);
tg3_napi_fini(tp);
@@ -9854,9 +9853,9 @@ static u64 calc_crc_errors(struct tg3 *tp)
estats->member = old_estats->member + \
get_stat64(&hw_stats->member)
-static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp)
+static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp,
+ struct tg3_ethtool_stats *estats)
{
- struct tg3_ethtool_stats *estats = &tp->estats;
struct tg3_ethtool_stats *old_estats = &tp->estats_prev;
struct tg3_hw_stats *hw_stats = tp->hw_stats;
@@ -10762,7 +10761,8 @@ static void tg3_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *estats, u64 *tmp_stats)
{
struct tg3 *tp = netdev_priv(dev);
- memcpy(tmp_stats, tg3_get_estats(tp), sizeof(tp->estats));
+
+ tg3_get_estats(tp, (struct tg3_ethtool_stats *)tmp_stats);
}
static __be32 *tg3_vpd_readblock(struct tg3 *tp, u32 *vpdlen)
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
index 9cc10a8..a2818ef 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -3013,7 +3013,6 @@ struct tg3 {
unsigned long rx_dropped;
unsigned long tx_dropped;
struct rtnl_link_stats64 net_stats_prev;
- struct tg3_ethtool_stats estats;
struct tg3_ethtool_stats estats_prev;
DECLARE_BITMAP(tg3_flags, TG3_FLAG_NUMBER_OF_FLAGS);
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 3/6] tg3: Integrate flowctrl check into AN adv check
From: Matt Carlson @ 2011-12-08 21:49 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch integrates tg3_adv_1000T_flowctrl_ok() into
tg3_copper_is_advertising_all() and renames the function
tg3_phy_copper_an_config_ok().
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 81 +++++++++++------------------------
1 files changed, 25 insertions(+), 56 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 713e37a..d1681db 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -3768,65 +3768,39 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp)
return err;
}
-static int tg3_copper_is_advertising_all(struct tg3 *tp, u32 mask)
+static bool tg3_phy_copper_an_config_ok(struct tg3 *tp, u32 *lcladv)
{
- u32 adv_reg, all_mask = 0;
+ u32 advmsk, tgtadv, advertising;
- all_mask = ethtool_adv_to_mii_adv_t(mask) & ADVERTISE_ALL;
+ advertising = tp->link_config.advertising;
+ tgtadv = ethtool_adv_to_mii_adv_t(advertising) & ADVERTISE_ALL;
- if (tg3_readphy(tp, MII_ADVERTISE, &adv_reg))
- return 0;
+ advmsk = ADVERTISE_ALL;
+ if (tp->link_config.active_duplex == DUPLEX_FULL) {
+ tgtadv |= tg3_advert_flowctrl_1000T(tp->link_config.flowctrl);
+ advmsk |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
+ }
- if ((adv_reg & ADVERTISE_ALL) != all_mask)
- return 0;
+ if (tg3_readphy(tp, MII_ADVERTISE, lcladv))
+ return false;
+
+ if ((*lcladv & advmsk) != tgtadv)
+ return false;
if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {
u32 tg3_ctrl;
- all_mask = ethtool_adv_to_mii_ctrl1000_t(mask);
+ tgtadv = ethtool_adv_to_mii_ctrl1000_t(advertising);
if (tg3_readphy(tp, MII_CTRL1000, &tg3_ctrl))
- return 0;
+ return false;
tg3_ctrl &= (ADVERTISE_1000HALF | ADVERTISE_1000FULL);
- if (tg3_ctrl != all_mask)
- return 0;
- }
-
- return 1;
-}
-
-static int tg3_adv_1000T_flowctrl_ok(struct tg3 *tp, u32 *lcladv, u32 *rmtadv)
-{
- u32 curadv, reqadv;
-
- if (tg3_readphy(tp, MII_ADVERTISE, lcladv))
- return 1;
-
- curadv = *lcladv & (ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM);
- reqadv = tg3_advert_flowctrl_1000T(tp->link_config.flowctrl);
-
- if (tp->link_config.active_duplex == DUPLEX_FULL) {
- if (curadv != reqadv)
- return 0;
-
- if (tg3_flag(tp, PAUSE_AUTONEG))
- tg3_readphy(tp, MII_LPA, rmtadv);
- } else {
- /* Reprogram the advertisement register, even if it
- * does not affect the current link. If the link
- * gets renegotiated in the future, we can save an
- * additional renegotiation cycle by advertising
- * it correctly in the first place.
- */
- if (curadv != reqadv) {
- *lcladv &= ~(ADVERTISE_PAUSE_CAP |
- ADVERTISE_PAUSE_ASYM);
- tg3_writephy(tp, MII_ADVERTISE, *lcladv | reqadv);
- }
+ if (tg3_ctrl != tgtadv)
+ return false;
}
- return 1;
+ return true;
}
static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
@@ -3988,12 +3962,10 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
if (tp->link_config.autoneg == AUTONEG_ENABLE) {
if ((bmcr & BMCR_ANENABLE) &&
- tg3_copper_is_advertising_all(tp,
- tp->link_config.advertising)) {
- if (tg3_adv_1000T_flowctrl_ok(tp, &lcl_adv,
- &rmt_adv))
- current_link_up = 1;
- }
+ tg3_phy_copper_an_config_ok(tp, &lcl_adv) &&
+ (tg3_flag(tp, PAUSE_AUTONEG) &&
+ !tg3_readphy(tp, MII_LPA, &rmt_adv)))
+ current_link_up = 1;
} else {
if (!(bmcr & BMCR_ANENABLE) &&
tp->link_config.speed == current_speed &&
@@ -13323,7 +13295,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES) &&
!tg3_flag(tp, ENABLE_APE) &&
!tg3_flag(tp, ENABLE_ASF)) {
- u32 bmsr, mask;
+ u32 bmsr, dummy;
tg3_readphy(tp, MII_BMSR, &bmsr);
if (!tg3_readphy(tp, MII_BMSR, &bmsr) &&
@@ -13336,10 +13308,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
tg3_phy_set_wirespeed(tp);
- mask = (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
- ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
- ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full);
- if (!tg3_copper_is_advertising_all(tp, mask)) {
+ if (!tg3_phy_copper_an_config_ok(tp, &dummy)) {
tg3_phy_autoneg_cfg(tp, tp->link_config.advertising,
tp->link_config.flowctrl);
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 0/6] tg3: Stats and flowctrl cleanups
From: Matt Carlson @ 2011-12-08 21:49 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patchset integrates a few flow control and statistics cleanups.
^ permalink raw reply
* [PATCH net-next 2/6] tg3: Save stats across chip resets
From: Matt Carlson @ 2011-12-08 21:49 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
Tg3 has a place to store stats, but doesn't really use it. This patch
modifies the driver so that stats are saved across chip resets and gets
cleared across close / open calls.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 26eb4d4..713e37a 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -7588,8 +7588,6 @@ static int tg3_abort_hw(struct tg3 *tp, int silent)
if (tnapi->hw_status)
memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
}
- if (tp->hw_stats)
- memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats));
return err;
}
@@ -7905,6 +7903,11 @@ static int tg3_chip_reset(struct tg3 *tp)
return 0;
}
+static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *,
+ struct rtnl_link_stats64 *);
+static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *,
+ struct tg3_ethtool_stats *);
+
/* tp->lock is held. */
static int tg3_halt(struct tg3 *tp, int kind, int silent)
{
@@ -7922,6 +7925,15 @@ static int tg3_halt(struct tg3 *tp, int kind, int silent)
tg3_write_sig_legacy(tp, kind);
tg3_write_sig_post_reset(tp, kind);
+ if (tp->hw_stats) {
+ /* Save the stats across chip resets... */
+ tg3_get_stats64(tp->dev, &tp->net_stats_prev),
+ tg3_get_estats(tp, &tp->estats_prev);
+
+ /* And make sure the next sample is new data */
+ memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats));
+ }
+
if (err)
return err;
@@ -9768,11 +9780,6 @@ err_out1:
return err;
}
-static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *,
- struct rtnl_link_stats64 *);
-static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *,
- struct tg3_ethtool_stats *);
-
static int tg3_close(struct net_device *dev)
{
int i;
@@ -9804,8 +9811,9 @@ static int tg3_close(struct net_device *dev)
tg3_ints_fini(tp);
- tg3_get_stats64(tp->dev, &tp->net_stats_prev);
- tg3_get_estats(tp, &tp->estats_prev);
+ /* Clear stats across close / open calls */
+ memset(&tp->net_stats_prev, 0, sizeof(tp->net_stats_prev));
+ memset(&tp->estats_prev, 0, sizeof(tp->estats_prev));
tg3_napi_fini(tp);
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 4/6] tg3: Track LP advertising
From: Matt Carlson @ 2011-12-08 21:50 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch adds code to track the autonegotiation advertisements of the
link partner and report them through ethtool.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 41 ++++++++++++++++++++++++++++++++--
drivers/net/ethernet/broadcom/tg3.h | 1 +
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index d1681db..ae1e838 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -3803,6 +3803,29 @@ static bool tg3_phy_copper_an_config_ok(struct tg3 *tp, u32 *lcladv)
return true;
}
+static bool tg3_phy_copper_fetch_rmtadv(struct tg3 *tp, u32 *rmtadv)
+{
+ u32 val, lpeth = 0;
+
+ if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {
+ if (tg3_readphy(tp, MII_STAT1000, &val))
+ return false;
+
+ lpeth = mii_stat1000_to_ethtool_lpa_t(val);
+ }
+
+ if (tg3_readphy(tp, MII_LPA, &val))
+ return false;
+
+ lpeth |= mii_lpa_to_ethtool_lpa_t(val);
+ tp->link_config.rmt_adv = lpeth;
+
+ if (tg3_flag(tp, PAUSE_AUTONEG))
+ *rmtadv = val;
+
+ return true;
+}
+
static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
{
int current_link_up;
@@ -3907,6 +3930,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
current_speed = SPEED_INVALID;
current_duplex = DUPLEX_INVALID;
tp->phy_flags &= ~TG3_PHYFLG_MDIX_STATE;
+ tp->link_config.rmt_adv = 0;
if (tp->phy_flags & TG3_PHYFLG_CAPACITIVE_COUPLING) {
err = tg3_phy_auxctl_read(tp,
@@ -3963,8 +3987,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
if (tp->link_config.autoneg == AUTONEG_ENABLE) {
if ((bmcr & BMCR_ANENABLE) &&
tg3_phy_copper_an_config_ok(tp, &lcl_adv) &&
- (tg3_flag(tp, PAUSE_AUTONEG) &&
- !tg3_readphy(tp, MII_LPA, &rmt_adv)))
+ tg3_phy_copper_fetch_rmtadv(tp, &rmt_adv))
current_link_up = 1;
} else {
if (!(bmcr & BMCR_ANENABLE) &&
@@ -4601,6 +4624,9 @@ restart_autoneg:
if (sg_dig_status & SG_DIG_PARTNER_ASYM_PAUSE)
remote_adv |= LPA_1000XPAUSE_ASYM;
+ tp->link_config.rmt_adv =
+ mii_adv_to_ethtool_adv_x(remote_adv);
+
tg3_setup_flow_control(tp, local_adv, remote_adv);
current_link_up = 1;
tp->serdes_counter = 0;
@@ -4672,6 +4698,9 @@ static int tg3_setup_fiber_by_hand(struct tg3 *tp, u32 mac_status)
if (rxflags & MR_LP_ADV_ASYM_PAUSE)
remote_adv |= LPA_1000XPAUSE_ASYM;
+ tp->link_config.rmt_adv =
+ mii_adv_to_ethtool_adv_x(remote_adv);
+
tg3_setup_flow_control(tp, local_adv, remote_adv);
current_link_up = 1;
@@ -4754,6 +4783,7 @@ static int tg3_setup_fiber_phy(struct tg3 *tp, int force_reset)
udelay(40);
current_link_up = 0;
+ tp->link_config.rmt_adv = 0;
mac_status = tr32(MAC_STATUS);
if (tg3_flag(tp, HW_AUTONEG))
@@ -4845,6 +4875,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
current_link_up = 0;
current_speed = SPEED_INVALID;
current_duplex = DUPLEX_INVALID;
+ tp->link_config.rmt_adv = 0;
err |= tg3_readphy(tp, MII_BMSR, &bmsr);
err |= tg3_readphy(tp, MII_BMSR, &bmsr);
@@ -4951,6 +4982,9 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
current_duplex = DUPLEX_FULL;
else
current_duplex = DUPLEX_HALF;
+
+ tp->link_config.rmt_adv =
+ mii_adv_to_ethtool_adv_x(remote_adv);
} else if (!tg3_flag(tp, 5780_CLASS)) {
/* Link is up via parallel detect */
} else {
@@ -10283,9 +10317,10 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->advertising |= ADVERTISED_Asym_Pause;
}
}
- if (netif_running(dev)) {
+ if (netif_running(dev) && netif_carrier_ok(dev)) {
ethtool_cmd_speed_set(cmd, tp->link_config.active_speed);
cmd->duplex = tp->link_config.active_duplex;
+ cmd->lp_advertising = tp->link_config.rmt_adv;
if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES)) {
if (tp->phy_flags & TG3_PHYFLG_MDIX_STATE)
cmd->eth_tp_mdix = ETH_TP_MDI_X;
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
index a2818ef..9d9f634 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -2698,6 +2698,7 @@ struct tg3_link_config {
#define DUPLEX_INVALID 0xff
#define AUTONEG_INVALID 0xff
u16 active_speed;
+ u32 rmt_adv;
/* When we go in and out of low power mode we need
* to swap with this state.
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next 5/6] tg3: Return flowctrl config through ethtool
From: Matt Carlson @ 2011-12-08 21:50 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch changes the driver to return the flow control configuration
rather than the flow control status through the ETHTOOL_GPAUSEPARAM
ioctl.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index ae1e838..d1b8ec5 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -10597,12 +10597,12 @@ static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam
epause->autoneg = !!tg3_flag(tp, PAUSE_AUTONEG);
- if (tp->link_config.active_flowctrl & FLOW_CTRL_RX)
+ if (tp->link_config.flowctrl & FLOW_CTRL_RX)
epause->rx_pause = 1;
else
epause->rx_pause = 0;
- if (tp->link_config.active_flowctrl & FLOW_CTRL_TX)
+ if (tp->link_config.flowctrl & FLOW_CTRL_TX)
epause->tx_pause = 1;
else
epause->tx_pause = 0;
--
1.7.3.4
^ permalink raw reply related
* policing actions pipe and ok
From: John A. Sullivan III @ 2011-12-08 22:14 UTC (permalink / raw)
To: netdev
Hello, all. I'm having trouble finding documentation on the tc filter
policing actions pipe and ok. What exactly do they do? Thanks - John
^ permalink raw reply
* Re: [PATCH net-next 4/6] tg3: Track LP advertising
From: Ben Hutchings @ 2011-12-08 23:06 UTC (permalink / raw)
To: Matt Carlson; +Cc: davem, netdev
In-Reply-To: <1323381002-31565-5-git-send-email-mcarlson@broadcom.com>
On Thu, 2011-12-08 at 13:50 -0800, Matt Carlson wrote:
> This patch adds code to track the autonegotiation advertisements of the
> link partner and report them through ethtool.
>
> Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
> Reviewed-by: Michael Chan <mchan@broadcom.com>
> ---
> drivers/net/ethernet/broadcom/tg3.c | 41 ++++++++++++++++++++++++++++++++--
> drivers/net/ethernet/broadcom/tg3.h | 1 +
> 2 files changed, 39 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index d1681db..ae1e838 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -3803,6 +3803,29 @@ static bool tg3_phy_copper_an_config_ok(struct tg3 *tp, u32 *lcladv)
> return true;
> }
>
> +static bool tg3_phy_copper_fetch_rmtadv(struct tg3 *tp, u32 *rmtadv)
> +{
> + u32 val, lpeth = 0;
> +
> + if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {
> + if (tg3_readphy(tp, MII_STAT1000, &val))
> + return false;
> +
> + lpeth = mii_stat1000_to_ethtool_lpa_t(val);
> + }
> +
> + if (tg3_readphy(tp, MII_LPA, &val))
> + return false;
> +
> + lpeth |= mii_lpa_to_ethtool_lpa_t(val);
> + tp->link_config.rmt_adv = lpeth;
> +
> + if (tg3_flag(tp, PAUSE_AUTONEG))
> + *rmtadv = val;
I assume that the caller only needs this information if pause autoneg is
enabled, but it's still very strange to put the condition here.
Ben.
> + return true;
> +}
[...]
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [PATCH iproute2] red: harddrop support and cleanups
From: Eric Dumazet @ 2011-12-08 23:11 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
Add harddrop support (kernel support added a long time ago), and various
cleanups.
min BYTES, max BYTES are now optional and follow Sally Floyd's
recommendations.
By the way, our default 2% probability is a bit low, Sally recommends
10%.
Not a big deal if upcoming adaptative algo is deployed.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
tc/q_red.c | 41 ++++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 21 deletions(-)
diff --git a/tc/q_red.c b/tc/q_red.c
index 6e58d7a..90c8573 100644
--- a/tc/q_red.c
+++ b/tc/q_red.c
@@ -27,8 +27,8 @@
static void explain(void)
{
- fprintf(stderr, "Usage: ... red limit BYTES min BYTES max BYTES avpkt BYTES burst PACKETS\n");
- fprintf(stderr, " probability PROBABILITY bandwidth KBPS [ ecn ]\n");
+ fprintf(stderr, "Usage: ... red limit BYTES [min BYTES] [max BYTES] avpkt BYTES [burst PACKETS]\n");
+ fprintf(stderr, " [probability PROBABILITY] bandwidth KBPS [ecn] [harddrop]\n");
}
static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
@@ -38,7 +38,6 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
unsigned avpkt = 0;
double probability = 0.02;
unsigned rate = 0;
- int ecn_ok = 0;
int wlog;
__u8 sbuf[256];
struct rtattr *tail;
@@ -89,7 +88,9 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
return -1;
}
} else if (strcmp(*argv, "ecn") == 0) {
- ecn_ok = 1;
+ opt.flags |= TC_RED_ECN;
+ } else if (strcmp(*argv, "harddrop") == 0) {
+ opt.flags |= TC_RED_HARDDROP;
} else if (strcmp(*argv, "help") == 0) {
explain();
return -1;
@@ -104,14 +105,20 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
if (rate == 0)
get_rate(&rate, "10Mbit");
- if (!opt.qth_min || !opt.qth_max || !opt.limit || !avpkt) {
- fprintf(stderr, "RED: Required parameter (min, max, limit, avpkt) is missing\n");
+ if (!opt.limit || !avpkt) {
+ fprintf(stderr, "RED: Required parameter (limit, avpkt) is missing\n");
return -1;
}
- if (!burst) {
+ /* Compute default min/max thresholds based on
+ * Sally Floyd's recommendations:
+ * http://www.icir.org/floyd/REDparameters.txt
+ */
+ if (!opt.qth_max)
+ opt.qth_max = opt.qth_min ? opt.qth_min * 3 : opt.limit / 4;
+ if (!opt.qth_min)
+ opt.qth_min = opt.qth_max / 3;
+ if (!burst)
burst = (2 * opt.qth_min + opt.qth_max) / (3 * avpkt);
- fprintf(stderr, "RED: set burst to %u\n", burst);
- }
if ((wlog = tc_red_eval_ewma(opt.qth_min, burst, avpkt)) < 0) {
fprintf(stderr, "RED: failed to calculate EWMA constant.\n");
return -1;
@@ -129,14 +136,6 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
return -1;
}
opt.Scell_log = wlog;
- if (ecn_ok) {
-#ifdef TC_RED_ECN
- opt.flags |= TC_RED_ECN;
-#else
- fprintf(stderr, "RED: ECN support is missing in this binary.\n");
- return -1;
-#endif
- }
tail = NLMSG_TAIL(n);
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
@@ -148,7 +147,7 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
{
- struct rtattr *tb[TCA_RED_STAB+1];
+ struct rtattr *tb[TCA_RED_MAX + 1];
struct tc_red_qopt *qopt;
SPRINT_BUF(b1);
SPRINT_BUF(b2);
@@ -157,7 +156,7 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
if (opt == NULL)
return 0;
- parse_rtattr_nested(tb, TCA_RED_STAB, opt);
+ parse_rtattr_nested(tb, TCA_RED_MAX, opt);
if (tb[TCA_RED_PARMS] == NULL)
return -1;
@@ -168,10 +167,10 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
sprint_size(qopt->limit, b1),
sprint_size(qopt->qth_min, b2),
sprint_size(qopt->qth_max, b3));
-#ifdef TC_RED_ECN
if (qopt->flags & TC_RED_ECN)
fprintf(f, "ecn ");
-#endif
+ if (qopt->flags & TC_RED_HARDDROP)
+ fprintf(f, "harddrop ");
if (show_details) {
fprintf(f, "ewma %u Plog %u Scell_log %u",
qopt->Wlog, qopt->Plog, qopt->Scell_log);
^ permalink raw reply related
* Re: [RFT] sky2: 32 bit DMA quirk
From: Stephen Hemminger @ 2011-12-08 23:26 UTC (permalink / raw)
To: Milan Kocian; +Cc: netdev
In-Reply-To: <20111208195833.GA13613@ntm.wq.cz>
On Thu, 8 Dec 2011 20:58:33 +0100
Milan Kocian <milon@wq.cz> wrote:
> Hello Stephen,
>
> On Wed, Dec 07, 2011 at 03:02:05PM -0800, Stephen Hemminger wrote:
> > This a patch to force 32 bit DMA. Not sure if the DMI values
> > are right for the Gigabyte motherboard with the problem.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >
>
> Unfortunately it didn't help. I tried parameter
> only_32bit_dma=1 alone and then with parameter disable_msi=1
> with the same result.
Thanks for trying. Looks like not worth bothering investigating further.
^ permalink raw reply
* Re: [RFT] sky2: 32 bit DMA quirk
From: Milan Kocian @ 2011-12-09 0:11 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20111208152614.37a8379b@s6510.linuxnetplumber.net>
On Thu, Dec 08, 2011 at 03:26:14PM -0800, Stephen Hemminger wrote:
> On Thu, 8 Dec 2011 20:58:33 +0100
> Milan Kocian <milon@wq.cz> wrote:
>
> > Hello Stephen,
> >
> > On Wed, Dec 07, 2011 at 03:02:05PM -0800, Stephen Hemminger wrote:
> > > This a patch to force 32 bit DMA. Not sure if the DMI values
> > > are right for the Gigabyte motherboard with the problem.
> > >
> > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> > >
> >
> > Unfortunately it didn't help. I tried parameter
> > only_32bit_dma=1 alone and then with parameter disable_msi=1
> > with the same result.
>
> Thanks for trying. Looks like not worth bothering investigating further.
>
Yes, I agree. Many thanks for your time Stephen.
--
Milan Kocian
^ permalink raw reply
* Re: [PATCH net-next 4/6] tg3: Track LP advertising
From: Matt Carlson @ 2011-12-09 0:14 UTC (permalink / raw)
To: Ben Hutchings
Cc: Matthew Carlson, davem@davemloft.net, netdev@vger.kernel.org
In-Reply-To: <1323385565.3094.3.camel@bwh-desktop>
On Thu, Dec 08, 2011 at 03:06:05PM -0800, Ben Hutchings wrote:
> On Thu, 2011-12-08 at 13:50 -0800, Matt Carlson wrote:
> > This patch adds code to track the autonegotiation advertisements of the
> > link partner and report them through ethtool.
> >
> > Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
> > Reviewed-by: Michael Chan <mchan@broadcom.com>
> > ---
> > drivers/net/ethernet/broadcom/tg3.c | 41 ++++++++++++++++++++++++++++++++--
> > drivers/net/ethernet/broadcom/tg3.h | 1 +
> > 2 files changed, 39 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> > index d1681db..ae1e838 100644
> > --- a/drivers/net/ethernet/broadcom/tg3.c
> > +++ b/drivers/net/ethernet/broadcom/tg3.c
> > @@ -3803,6 +3803,29 @@ static bool tg3_phy_copper_an_config_ok(struct tg3 *tp, u32 *lcladv)
> > return true;
> > }
> >
> > +static bool tg3_phy_copper_fetch_rmtadv(struct tg3 *tp, u32 *rmtadv)
> > +{
> > + u32 val, lpeth = 0;
> > +
> > + if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {
> > + if (tg3_readphy(tp, MII_STAT1000, &val))
> > + return false;
> > +
> > + lpeth = mii_stat1000_to_ethtool_lpa_t(val);
> > + }
> > +
> > + if (tg3_readphy(tp, MII_LPA, &val))
> > + return false;
> > +
> > + lpeth |= mii_lpa_to_ethtool_lpa_t(val);
> > + tp->link_config.rmt_adv = lpeth;
> > +
> > + if (tg3_flag(tp, PAUSE_AUTONEG))
> > + *rmtadv = val;
>
> I assume that the caller only needs this information if pause autoneg is
> enabled, but it's still very strange to put the condition here.
I see your point. I'm being overly cautious. I'll respin this patch.
> Ben.
>
> > + return true;
> > +}
> [...]
>
> --
> Ben Hutchings, Staff Engineer, Solarflare
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* [PATCH net-next v2 0/6] tg3: Stats and flowctrl cleanups
From: Matt Carlson @ 2011-12-09 0:40 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patchset integrates a few flow control and statistics cleanups.
^ permalink raw reply
* [PATCH net-next v2 2/6] tg3: Save stats across chip resets
From: Matt Carlson @ 2011-12-09 0:40 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
Tg3 has a place to store stats, but doesn't really use it. This patch
modifies the driver so that stats are saved across chip resets and gets
cleared across close / open calls.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/ethernet/broadcom/tg3.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 26eb4d4..713e37a 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -7588,8 +7588,6 @@ static int tg3_abort_hw(struct tg3 *tp, int silent)
if (tnapi->hw_status)
memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
}
- if (tp->hw_stats)
- memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats));
return err;
}
@@ -7905,6 +7903,11 @@ static int tg3_chip_reset(struct tg3 *tp)
return 0;
}
+static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *,
+ struct rtnl_link_stats64 *);
+static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *,
+ struct tg3_ethtool_stats *);
+
/* tp->lock is held. */
static int tg3_halt(struct tg3 *tp, int kind, int silent)
{
@@ -7922,6 +7925,15 @@ static int tg3_halt(struct tg3 *tp, int kind, int silent)
tg3_write_sig_legacy(tp, kind);
tg3_write_sig_post_reset(tp, kind);
+ if (tp->hw_stats) {
+ /* Save the stats across chip resets... */
+ tg3_get_stats64(tp->dev, &tp->net_stats_prev),
+ tg3_get_estats(tp, &tp->estats_prev);
+
+ /* And make sure the next sample is new data */
+ memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats));
+ }
+
if (err)
return err;
@@ -9768,11 +9780,6 @@ err_out1:
return err;
}
-static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *,
- struct rtnl_link_stats64 *);
-static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *,
- struct tg3_ethtool_stats *);
-
static int tg3_close(struct net_device *dev)
{
int i;
@@ -9804,8 +9811,9 @@ static int tg3_close(struct net_device *dev)
tg3_ints_fini(tp);
- tg3_get_stats64(tp->dev, &tp->net_stats_prev);
- tg3_get_estats(tp, &tp->estats_prev);
+ /* Clear stats across close / open calls */
+ memset(&tp->net_stats_prev, 0, sizeof(tp->net_stats_prev));
+ memset(&tp->estats_prev, 0, sizeof(tp->estats_prev));
tg3_napi_fini(tp);
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next v2 3/6] tg3: Integrate flowctrl check into AN adv check
From: Matt Carlson @ 2011-12-09 0:40 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson
This patch integrates tg3_adv_1000T_flowctrl_ok() into
tg3_copper_is_advertising_all() and renames the function
tg3_phy_copper_an_config_ok().
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/ethernet/broadcom/tg3.c | 81 +++++++++++------------------------
1 files changed, 25 insertions(+), 56 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 713e37a..d1681db 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -3768,65 +3768,39 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp)
return err;
}
-static int tg3_copper_is_advertising_all(struct tg3 *tp, u32 mask)
+static bool tg3_phy_copper_an_config_ok(struct tg3 *tp, u32 *lcladv)
{
- u32 adv_reg, all_mask = 0;
+ u32 advmsk, tgtadv, advertising;
- all_mask = ethtool_adv_to_mii_adv_t(mask) & ADVERTISE_ALL;
+ advertising = tp->link_config.advertising;
+ tgtadv = ethtool_adv_to_mii_adv_t(advertising) & ADVERTISE_ALL;
- if (tg3_readphy(tp, MII_ADVERTISE, &adv_reg))
- return 0;
+ advmsk = ADVERTISE_ALL;
+ if (tp->link_config.active_duplex == DUPLEX_FULL) {
+ tgtadv |= tg3_advert_flowctrl_1000T(tp->link_config.flowctrl);
+ advmsk |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
+ }
- if ((adv_reg & ADVERTISE_ALL) != all_mask)
- return 0;
+ if (tg3_readphy(tp, MII_ADVERTISE, lcladv))
+ return false;
+
+ if ((*lcladv & advmsk) != tgtadv)
+ return false;
if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {
u32 tg3_ctrl;
- all_mask = ethtool_adv_to_mii_ctrl1000_t(mask);
+ tgtadv = ethtool_adv_to_mii_ctrl1000_t(advertising);
if (tg3_readphy(tp, MII_CTRL1000, &tg3_ctrl))
- return 0;
+ return false;
tg3_ctrl &= (ADVERTISE_1000HALF | ADVERTISE_1000FULL);
- if (tg3_ctrl != all_mask)
- return 0;
- }
-
- return 1;
-}
-
-static int tg3_adv_1000T_flowctrl_ok(struct tg3 *tp, u32 *lcladv, u32 *rmtadv)
-{
- u32 curadv, reqadv;
-
- if (tg3_readphy(tp, MII_ADVERTISE, lcladv))
- return 1;
-
- curadv = *lcladv & (ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM);
- reqadv = tg3_advert_flowctrl_1000T(tp->link_config.flowctrl);
-
- if (tp->link_config.active_duplex == DUPLEX_FULL) {
- if (curadv != reqadv)
- return 0;
-
- if (tg3_flag(tp, PAUSE_AUTONEG))
- tg3_readphy(tp, MII_LPA, rmtadv);
- } else {
- /* Reprogram the advertisement register, even if it
- * does not affect the current link. If the link
- * gets renegotiated in the future, we can save an
- * additional renegotiation cycle by advertising
- * it correctly in the first place.
- */
- if (curadv != reqadv) {
- *lcladv &= ~(ADVERTISE_PAUSE_CAP |
- ADVERTISE_PAUSE_ASYM);
- tg3_writephy(tp, MII_ADVERTISE, *lcladv | reqadv);
- }
+ if (tg3_ctrl != tgtadv)
+ return false;
}
- return 1;
+ return true;
}
static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
@@ -3988,12 +3962,10 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
if (tp->link_config.autoneg == AUTONEG_ENABLE) {
if ((bmcr & BMCR_ANENABLE) &&
- tg3_copper_is_advertising_all(tp,
- tp->link_config.advertising)) {
- if (tg3_adv_1000T_flowctrl_ok(tp, &lcl_adv,
- &rmt_adv))
- current_link_up = 1;
- }
+ tg3_phy_copper_an_config_ok(tp, &lcl_adv) &&
+ (tg3_flag(tp, PAUSE_AUTONEG) &&
+ !tg3_readphy(tp, MII_LPA, &rmt_adv)))
+ current_link_up = 1;
} else {
if (!(bmcr & BMCR_ANENABLE) &&
tp->link_config.speed == current_speed &&
@@ -13323,7 +13295,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES) &&
!tg3_flag(tp, ENABLE_APE) &&
!tg3_flag(tp, ENABLE_ASF)) {
- u32 bmsr, mask;
+ u32 bmsr, dummy;
tg3_readphy(tp, MII_BMSR, &bmsr);
if (!tg3_readphy(tp, MII_BMSR, &bmsr) &&
@@ -13336,10 +13308,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
tg3_phy_set_wirespeed(tp);
- mask = (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
- ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
- ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full);
- if (!tg3_copper_is_advertising_all(tp, mask)) {
+ if (!tg3_phy_copper_an_config_ok(tp, &dummy)) {
tg3_phy_autoneg_cfg(tp, tp->link_config.advertising,
tp->link_config.flowctrl);
--
1.7.3.4
^ permalink raw reply related
* [PATCH net-next v2 1/6] tg3: Remove ethtool stats member from dev struct
From: Matt Carlson @ 2011-12-09 0:40 UTC (permalink / raw)
To: davem; +Cc: netdev, mcarlson, Michael Chan
This patch removes the ethtool stats member from the tg3 device
structure.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/ethernet/broadcom/tg3.c | 14 +++++++-------
drivers/net/ethernet/broadcom/tg3.h | 1 -
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index cf36312..26eb4d4 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -9770,7 +9770,8 @@ err_out1:
static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *,
struct rtnl_link_stats64 *);
-static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *);
+static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *,
+ struct tg3_ethtool_stats *);
static int tg3_close(struct net_device *dev)
{
@@ -9804,9 +9805,7 @@ static int tg3_close(struct net_device *dev)
tg3_ints_fini(tp);
tg3_get_stats64(tp->dev, &tp->net_stats_prev);
-
- memcpy(&tp->estats_prev, tg3_get_estats(tp),
- sizeof(tp->estats_prev));
+ tg3_get_estats(tp, &tp->estats_prev);
tg3_napi_fini(tp);
@@ -9854,9 +9853,9 @@ static u64 calc_crc_errors(struct tg3 *tp)
estats->member = old_estats->member + \
get_stat64(&hw_stats->member)
-static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp)
+static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp,
+ struct tg3_ethtool_stats *estats)
{
- struct tg3_ethtool_stats *estats = &tp->estats;
struct tg3_ethtool_stats *old_estats = &tp->estats_prev;
struct tg3_hw_stats *hw_stats = tp->hw_stats;
@@ -10762,7 +10761,8 @@ static void tg3_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *estats, u64 *tmp_stats)
{
struct tg3 *tp = netdev_priv(dev);
- memcpy(tmp_stats, tg3_get_estats(tp), sizeof(tp->estats));
+
+ tg3_get_estats(tp, (struct tg3_ethtool_stats *)tmp_stats);
}
static __be32 *tg3_vpd_readblock(struct tg3 *tp, u32 *vpdlen)
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
index 9cc10a8..a2818ef 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -3013,7 +3013,6 @@ struct tg3 {
unsigned long rx_dropped;
unsigned long tx_dropped;
struct rtnl_link_stats64 net_stats_prev;
- struct tg3_ethtool_stats estats;
struct tg3_ethtool_stats estats_prev;
DECLARE_BITMAP(tg3_flags, TG3_FLAG_NUMBER_OF_FLAGS);
--
1.7.3.4
^ 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