* [net-next 1/4] e100: Fix rx-over-length statistics.
2012-03-03 2:26 [net-next 0/4][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
@ 2012-03-03 2:26 ` Jeff Kirsher
2012-03-03 2:26 ` [net-next 2/4] e100: Show short v/s long rx length errors in ethtool stats Jeff Kirsher
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jeff Kirsher @ 2012-03-03 2:26 UTC (permalink / raw)
To: davem; +Cc: Ben Greear, netdev, gospo, sassmann, Jeff Kirsher
From: Ben Greear <greearb@candelatech.com>
The old code would += the total errors every time
stats were gathered. Instead, keep a count of short-pkt
and long-pkt counters and then simply add them together
for the rx-over-length stat.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/e100.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index 4d8a616..d2b7872 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -622,6 +622,7 @@ struct nic {
u32 rx_fc_pause;
u32 rx_fc_unsupported;
u32 rx_tco_frames;
+ u32 rx_short_frame_errors;
u32 rx_over_length_errors;
u16 eeprom_wc;
@@ -1622,7 +1623,9 @@ static void e100_update_stats(struct nic *nic)
ns->collisions += nic->tx_collisions;
ns->tx_errors += le32_to_cpu(s->tx_max_collisions) +
le32_to_cpu(s->tx_lost_crs);
- ns->rx_length_errors += le32_to_cpu(s->rx_short_frame_errors) +
+ nic->rx_short_frame_errors +=
+ le32_to_cpu(s->rx_short_frame_errors);
+ ns->rx_length_errors = nic->rx_short_frame_errors +
nic->rx_over_length_errors;
ns->rx_crc_errors += le32_to_cpu(s->rx_crc_errors);
ns->rx_frame_errors += le32_to_cpu(s->rx_alignment_errors);
--
1.7.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [net-next 2/4] e100: Show short v/s long rx length errors in ethtool stats.
2012-03-03 2:26 [net-next 0/4][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2012-03-03 2:26 ` [net-next 1/4] e100: Fix rx-over-length statistics Jeff Kirsher
@ 2012-03-03 2:26 ` Jeff Kirsher
2012-03-03 2:26 ` [net-next 3/4] ixgbe: dcb: check setup_tc return codes Jeff Kirsher
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jeff Kirsher @ 2012-03-03 2:26 UTC (permalink / raw)
To: davem; +Cc: Ben Greear, netdev, gospo, sassmann, Jeff Kirsher
From: Ben Greear <greearb@candelatech.com>
Signed-off-by: Ben Greear <greearb@candelatech.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/e100.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index d2b7872..e498eff 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -2661,6 +2661,7 @@ static const char e100_gstrings_stats[][ETH_GSTRING_LEN] = {
"tx_deferred", "tx_single_collisions", "tx_multi_collisions",
"tx_flow_control_pause", "rx_flow_control_pause",
"rx_flow_control_unsupported", "tx_tco_packets", "rx_tco_packets",
+ "rx_short_frame_errors", "rx_over_length_errors",
};
#define E100_NET_STATS_LEN 21
#define E100_STATS_LEN ARRAY_SIZE(e100_gstrings_stats)
@@ -2694,6 +2695,8 @@ static void e100_get_ethtool_stats(struct net_device *netdev,
data[i++] = nic->rx_fc_unsupported;
data[i++] = nic->tx_tco_frames;
data[i++] = nic->rx_tco_frames;
+ data[i++] = nic->rx_short_frame_errors;
+ data[i++] = nic->rx_over_length_errors;
}
static void e100_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
--
1.7.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [net-next 3/4] ixgbe: dcb: check setup_tc return codes
2012-03-03 2:26 [net-next 0/4][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2012-03-03 2:26 ` [net-next 1/4] e100: Fix rx-over-length statistics Jeff Kirsher
2012-03-03 2:26 ` [net-next 2/4] e100: Show short v/s long rx length errors in ethtool stats Jeff Kirsher
@ 2012-03-03 2:26 ` Jeff Kirsher
2012-03-03 2:26 ` [net-next 4/4] net: dcb: getnumtcs()/setnumtcs() should return an int Jeff Kirsher
2012-03-03 19:53 ` [net-next 0/4][pull request] Intel Wired LAN Driver Updates David Miller
4 siblings, 0 replies; 7+ messages in thread
From: Jeff Kirsher @ 2012-03-03 2:26 UTC (permalink / raw)
To: davem; +Cc: John Fastabend, netdev, gospo, sassmann, Jeff Kirsher
From: John Fastabend <john.r.fastabend@intel.com>
dcb netlink code calls setup_tc to init hardware traffic classes
to use for DCB. At some call sites the return values are not
checked for errors and in one case may return -EINVAL back to
the net/dcbnl.c caller which is expecting a u8.
This fixes some smatch hits and although failures are never
seen in practive its best to check return codes.
Reported-by: Dan Carenter <dan.carpenter@oracle.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | 26 +++++++++++++++-------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
index 79a92fe..95e5d11 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
@@ -111,7 +111,7 @@ static u8 ixgbe_dcbnl_get_state(struct net_device *netdev)
static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
{
- u8 err = 0;
+ int err = 0;
u8 prio_tc[MAX_USER_PRIORITY] = {0};
int i;
struct ixgbe_adapter *adapter = netdev_priv(netdev);
@@ -122,7 +122,7 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
/* verify there is something to do, if not then exit */
if (!!state != !(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
- return err;
+ goto out;
if (state > 0) {
err = ixgbe_setup_tc(netdev, adapter->dcb_cfg.num_tcs.pg_tcs);
@@ -131,10 +131,14 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
err = ixgbe_setup_tc(netdev, 0);
}
+ if (err)
+ goto out;
+
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
netdev_set_prio_tc_map(netdev, i, prio_tc[i]);
- return err;
+out:
+ return err ? 1 : 0;
}
static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev,
@@ -581,7 +585,7 @@ static int ixgbe_dcbnl_ieee_setets(struct net_device *dev,
{
struct ixgbe_adapter *adapter = netdev_priv(dev);
int max_frame = dev->mtu + ETH_HLEN + ETH_FCS_LEN;
- int i;
+ int i, err = 0;
__u8 max_tc = 0;
if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE))
@@ -608,12 +612,17 @@ static int ixgbe_dcbnl_ieee_setets(struct net_device *dev,
return -EINVAL;
if (max_tc != netdev_get_num_tc(dev))
- ixgbe_setup_tc(dev, max_tc);
+ err = ixgbe_setup_tc(dev, max_tc);
+
+ if (err)
+ goto err_out;
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
netdev_set_prio_tc_map(dev, i, ets->prio_tc[i]);
- return ixgbe_dcb_hw_ets(&adapter->hw, ets, max_frame);
+ err = ixgbe_dcb_hw_ets(&adapter->hw, ets, max_frame);
+err_out:
+ return err;
}
static int ixgbe_dcbnl_ieee_getpfc(struct net_device *dev,
@@ -726,6 +735,7 @@ static u8 ixgbe_dcbnl_setdcbx(struct net_device *dev, u8 mode)
struct ixgbe_adapter *adapter = netdev_priv(dev);
struct ieee_ets ets = {0};
struct ieee_pfc pfc = {0};
+ int err = 0;
/* no support for LLD_MANAGED modes or CEE+IEEE */
if ((mode & DCB_CAP_DCBX_LLD_MANAGED) ||
@@ -756,10 +766,10 @@ static u8 ixgbe_dcbnl_setdcbx(struct net_device *dev, u8 mode)
*/
ixgbe_dcbnl_ieee_setets(dev, &ets);
ixgbe_dcbnl_ieee_setpfc(dev, &pfc);
- ixgbe_setup_tc(dev, 0);
+ err = ixgbe_setup_tc(dev, 0);
}
- return 0;
+ return err ? 1 : 0;
}
const struct dcbnl_rtnl_ops dcbnl_ops = {
--
1.7.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [net-next 4/4] net: dcb: getnumtcs()/setnumtcs() should return an int
2012-03-03 2:26 [net-next 0/4][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (2 preceding siblings ...)
2012-03-03 2:26 ` [net-next 3/4] ixgbe: dcb: check setup_tc return codes Jeff Kirsher
@ 2012-03-03 2:26 ` Jeff Kirsher
2012-03-03 19:53 ` [net-next 0/4][pull request] Intel Wired LAN Driver Updates David Miller
4 siblings, 0 replies; 7+ messages in thread
From: Jeff Kirsher @ 2012-03-03 2:26 UTC (permalink / raw)
To: davem
Cc: John Fastabend, netdev, gospo, sassmann, Eilon Greenstein,
Jeff Kirsher
From: John Fastabend <john.r.fastabend@intel.com>
{g|s}etnumtcs() today returns a u8 that is only used by the DCB code
to verify no error occurred. Today the driver implementations return
negative error codes which end up being non-zero so the logic works
out but triggers some sparse warnings.
To fix the sparse warnings convert the return value to an int.
CC: Eilon Greenstein <eilong@broadcom.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c | 4 ++--
drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | 4 ++--
include/net/dcbnl.h | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
index 9a9bd3a..9a4ed05 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
@@ -2142,7 +2142,7 @@ static u8 bnx2x_dcbnl_get_cap(struct net_device *netdev, int capid, u8 *cap)
return rval;
}
-static u8 bnx2x_dcbnl_get_numtcs(struct net_device *netdev, int tcid, u8 *num)
+static int bnx2x_dcbnl_get_numtcs(struct net_device *netdev, int tcid, u8 *num)
{
struct bnx2x *bp = netdev_priv(netdev);
u8 rval = 0;
@@ -2169,7 +2169,7 @@ static u8 bnx2x_dcbnl_get_numtcs(struct net_device *netdev, int tcid, u8 *num)
return rval;
}
-static u8 bnx2x_dcbnl_set_numtcs(struct net_device *netdev, int tcid, u8 num)
+static int bnx2x_dcbnl_set_numtcs(struct net_device *netdev, int tcid, u8 num)
{
struct bnx2x *bp = netdev_priv(netdev);
DP(NETIF_MSG_LINK, "num tcs = %d; Not supported\n", num);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
index 95e5d11..dde65f9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
@@ -490,7 +490,7 @@ static u8 ixgbe_dcbnl_getcap(struct net_device *netdev, int capid, u8 *cap)
return 0;
}
-static u8 ixgbe_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
+static int ixgbe_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
{
struct ixgbe_adapter *adapter = netdev_priv(netdev);
u8 rval = 0;
@@ -514,7 +514,7 @@ static u8 ixgbe_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
return rval;
}
-static u8 ixgbe_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num)
+static int ixgbe_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num)
{
return -EINVAL;
}
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index 2cd66d0..f55c980 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -72,8 +72,8 @@ struct dcbnl_rtnl_ops {
void (*getpfccfg)(struct net_device *, int, u8 *);
u8 (*setall)(struct net_device *);
u8 (*getcap)(struct net_device *, int, u8 *);
- u8 (*getnumtcs)(struct net_device *, int, u8 *);
- u8 (*setnumtcs)(struct net_device *, int, u8);
+ int (*getnumtcs)(struct net_device *, int, u8 *);
+ int (*setnumtcs)(struct net_device *, int, u8);
u8 (*getpfcstate)(struct net_device *);
void (*setpfcstate)(struct net_device *, u8);
void (*getbcncfg)(struct net_device *, int, u32 *);
--
1.7.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [net-next 0/4][pull request] Intel Wired LAN Driver Updates
2012-03-03 2:26 [net-next 0/4][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (3 preceding siblings ...)
2012-03-03 2:26 ` [net-next 4/4] net: dcb: getnumtcs()/setnumtcs() should return an int Jeff Kirsher
@ 2012-03-03 19:53 ` David Miller
4 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2012-03-03 19:53 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, sassmann
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Fri, 2 Mar 2012 18:26:23 -0800
> This series of patches contains fixes e100 and DCB (ixgbe, bnx2x).
>
> The following are changes since commit b4017c5368f992fb8fb3a2545a0977082c6664e4:
> Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
> and are available in the git repository at:
> git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master
>
> Ben Greear (2):
> e100: Fix rx-over-length statistics.
> e100: Show short v/s long rx length errors in ethtool stats.
>
> John Fastabend (2):
> ixgbe: dcb: check setup_tc return codes
> net: dcb: getnumtcs()/setnumtcs() should return an int
Pulled, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread