* [Intel-wired-lan] [PATCH 2/6] fm10k: reduce duplicate fm10k_stat macro code
2018-04-12 18:15 [Intel-wired-lan] [PATCH 1/6] fm10k: setup VLANs for l2 accelerated macvlan interfaces Jacob Keller
@ 2018-04-12 18:15 ` Jacob Keller
2018-05-01 21:23 ` Singh, Krishneil K
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 3/6] fm10k: use variadic arguments to fm10k_add_stat_strings Jacob Keller
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Jacob Keller @ 2018-04-12 18:15 UTC (permalink / raw)
To: intel-wired-lan
Share some of the code for setting up fm10k_stat macros by implementing
an FM10K_STAT_FIELDS macro which we can use when setting up the type
specific macros.
Change-Id: Ifeedfafa4707cbeb4fac818ed6672eb1db268e1a
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Title: reduce duplicate fm10k_stat macro code
Change-type: ImplementationChange
Reviewed-on: https://git-amr-1.devtools.intel.com/gerrit/198021
---
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 30 ++++++++++++------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index 28b6b4e56487..339915400a03 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/* Intel(R) Ethernet Switch Host Interface Driver
- * Copyright(c) 2013 - 2017 Intel Corporation.
+ * Copyright(c) 2013 - 2018 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -29,12 +29,16 @@ struct fm10k_stats {
int stat_offset;
};
-#define FM10K_NETDEV_STAT(_net_stat) { \
- .stat_string = #_net_stat, \
- .sizeof_stat = FIELD_SIZEOF(struct net_device_stats, _net_stat), \
- .stat_offset = offsetof(struct net_device_stats, _net_stat) \
+#define FM10K_STAT_FIELDS(_type, _name, _stat) { \
+ .stat_string = _name, \
+ .sizeof_stat = FIELD_SIZEOF(_type, _stat), \
+ .stat_offset = offsetof(_type, _stat) \
}
+/* netdevice statistics */
+#define FM10K_NETDEV_STAT(_net_stat) \
+ FM10K_STAT_FIELDS(struct net_device_stats, #_net_stat, _net_stat)
+
static const struct fm10k_stats fm10k_gstrings_net_stats[] = {
FM10K_NETDEV_STAT(tx_packets),
FM10K_NETDEV_STAT(tx_bytes),
@@ -52,11 +56,9 @@ static const struct fm10k_stats fm10k_gstrings_net_stats[] = {
#define FM10K_NETDEV_STATS_LEN ARRAY_SIZE(fm10k_gstrings_net_stats)
-#define FM10K_STAT(_name, _stat) { \
- .stat_string = _name, \
- .sizeof_stat = FIELD_SIZEOF(struct fm10k_intfc, _stat), \
- .stat_offset = offsetof(struct fm10k_intfc, _stat) \
-}
+/* General interface statistics */
+#define FM10K_STAT(_name, _stat) \
+ FM10K_STAT_FIELDS(struct fm10k_intfc, _name, _stat)
static const struct fm10k_stats fm10k_gstrings_global_stats[] = {
FM10K_STAT("tx_restart_queue", restart_queue),
@@ -93,11 +95,9 @@ static const struct fm10k_stats fm10k_gstrings_pf_stats[] = {
FM10K_STAT("nodesc_drop", stats.nodesc_drop.count),
};
-#define FM10K_MBX_STAT(_name, _stat) { \
- .stat_string = _name, \
- .sizeof_stat = FIELD_SIZEOF(struct fm10k_mbx_info, _stat), \
- .stat_offset = offsetof(struct fm10k_mbx_info, _stat) \
-}
+/* mailbox statistics */
+#define FM10K_MBX_STAT(_name, _stat) \
+ FM10K_STAT_FIELDS(struct fm10k_mbx_info, _name, _stat)
static const struct fm10k_stats fm10k_gstrings_mbx_stats[] = {
FM10K_MBX_STAT("mbx_tx_busy", tx_busy),
--
2.15.1.478.ga1e07cd25f8b
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-wired-lan] [PATCH 2/6] fm10k: reduce duplicate fm10k_stat macro code
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 2/6] fm10k: reduce duplicate fm10k_stat macro code Jacob Keller
@ 2018-05-01 21:23 ` Singh, Krishneil K
0 siblings, 0 replies; 12+ messages in thread
From: Singh, Krishneil K @ 2018-05-01 21:23 UTC (permalink / raw)
To: intel-wired-lan
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of
> Jacob Keller
> Sent: Thursday, April 12, 2018 11:16 AM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 2/6] fm10k: reduce duplicate fm10k_stat
> macro code
>
> Share some of the code for setting up fm10k_stat macros by implementing
> an FM10K_STAT_FIELDS macro which we can use when setting up the type
> specific macros.
>
> Change-Id: Ifeedfafa4707cbeb4fac818ed6672eb1db268e1a
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Title: reduce duplicate fm10k_stat macro code
> Change-type: ImplementationChange
> Reviewed-on: https://git-amr-1.devtools.intel.com/gerrit/198021
> ---
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Intel-wired-lan] [PATCH 3/6] fm10k: use variadic arguments to fm10k_add_stat_strings
2018-04-12 18:15 [Intel-wired-lan] [PATCH 1/6] fm10k: setup VLANs for l2 accelerated macvlan interfaces Jacob Keller
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 2/6] fm10k: reduce duplicate fm10k_stat macro code Jacob Keller
@ 2018-04-12 18:15 ` Jacob Keller
2018-05-01 21:24 ` Singh, Krishneil K
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 4/6] fm10k: use macro to avoid passing the array and size separately Jacob Keller
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Jacob Keller @ 2018-04-12 18:15 UTC (permalink / raw)
To: intel-wired-lan
Instead of using a fixed prefix string we setup before each call to
fm10k_add_stat_strings, modify the helper to take variadic arguments and
pass them to vsnprintf. This requires changing the fm10k_stat strings to
take % format specifiers where necessary, but the resulting code is much
simpler.
Change-Id: I8055adeae0d63c227024c007c2ff51d0ee495238
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Title: use variadic arguments to fm10k_add_stat_strings
Change-type: ImplementationChange
Reviewed-on: https://git-amr-1.devtools.intel.com/gerrit/198022
Tested-by: nosbuild <nosbuild@intel.com>
---
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 53 ++++++++++++------------
1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index 339915400a03..26bf2322f457 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -24,6 +24,11 @@
#include "fm10k.h"
struct fm10k_stats {
+ /* The stat_string is expected to be a format string formatted using
+ * vsnprintf by fm10k_add_stat_strings. Every member of a stats array
+ * should use the same format specifiers as they will be formatted
+ * using the same variadic arguments.
+ */
char stat_string[ETH_GSTRING_LEN];
int sizeof_stat;
int stat_offset;
@@ -111,15 +116,13 @@ static const struct fm10k_stats fm10k_gstrings_mbx_stats[] = {
FM10K_MBX_STAT("mbx_rx_mbmem_pushed", rx_mbmem_pushed),
};
-#define FM10K_QUEUE_STAT(_name, _stat) { \
- .stat_string = _name, \
- .sizeof_stat = FIELD_SIZEOF(struct fm10k_ring, _stat), \
- .stat_offset = offsetof(struct fm10k_ring, _stat) \
-}
+/* per-queue ring statistics */
+#define FM10K_QUEUE_STAT(_name, _stat) \
+ FM10K_STAT_FIELDS(struct fm10k_ring, _name, _stat)
static const struct fm10k_stats fm10k_gstrings_queue_stats[] = {
- FM10K_QUEUE_STAT("packets", stats.packets),
- FM10K_QUEUE_STAT("bytes", stats.bytes),
+ FM10K_QUEUE_STAT("%s_queue_%u_packets", stats.packets),
+ FM10K_QUEUE_STAT("%s_queue_%u_bytes", stats.bytes),
};
#define FM10K_GLOBAL_STATS_LEN ARRAY_SIZE(fm10k_gstrings_global_stats)
@@ -149,16 +152,18 @@ enum {
static const char fm10k_prv_flags[FM10K_PRV_FLAG_LEN][ETH_GSTRING_LEN] = {
};
-static void fm10k_add_stat_strings(u8 **p, const char *prefix,
- const struct fm10k_stats stats[],
- const unsigned int size)
+static void fm10k_add_stat_strings(u8 **p, const struct fm10k_stats stats[],
+ const unsigned int size, ...)
{
unsigned int i;
for (i = 0; i < size; i++) {
- snprintf(*p, ETH_GSTRING_LEN, "%s%s",
- prefix, stats[i].stat_string);
+ va_list args;
+
+ va_start(args, size);
+ vsnprintf(*p, ETH_GSTRING_LEN, stats[i].stat_string, args);
*p += ETH_GSTRING_LEN;
+ va_end(args);
}
}
@@ -167,31 +172,27 @@ static void fm10k_get_stat_strings(struct net_device *dev, u8 *data)
struct fm10k_intfc *interface = netdev_priv(dev);
unsigned int i;
- fm10k_add_stat_strings(&data, "", fm10k_gstrings_net_stats,
+ fm10k_add_stat_strings(&data, fm10k_gstrings_net_stats,
FM10K_NETDEV_STATS_LEN);
- fm10k_add_stat_strings(&data, "", fm10k_gstrings_global_stats,
+ fm10k_add_stat_strings(&data, fm10k_gstrings_global_stats,
FM10K_GLOBAL_STATS_LEN);
- fm10k_add_stat_strings(&data, "", fm10k_gstrings_mbx_stats,
+ fm10k_add_stat_strings(&data, fm10k_gstrings_mbx_stats,
FM10K_MBX_STATS_LEN);
if (interface->hw.mac.type != fm10k_mac_vf)
- fm10k_add_stat_strings(&data, "", fm10k_gstrings_pf_stats,
+ fm10k_add_stat_strings(&data, fm10k_gstrings_pf_stats,
FM10K_PF_STATS_LEN);
for (i = 0; i < interface->hw.mac.max_queues; i++) {
- char prefix[ETH_GSTRING_LEN];
+ fm10k_add_stat_strings(&data, fm10k_gstrings_queue_stats,
+ FM10K_QUEUE_STATS_LEN,
+ "tx", i);
- snprintf(prefix, ETH_GSTRING_LEN, "tx_queue_%u_", i);
- fm10k_add_stat_strings(&data, prefix,
- fm10k_gstrings_queue_stats,
- FM10K_QUEUE_STATS_LEN);
-
- snprintf(prefix, ETH_GSTRING_LEN, "rx_queue_%u_", i);
- fm10k_add_stat_strings(&data, prefix,
- fm10k_gstrings_queue_stats,
- FM10K_QUEUE_STATS_LEN);
+ fm10k_add_stat_strings(&data, fm10k_gstrings_queue_stats,
+ FM10K_QUEUE_STATS_LEN,
+ "rx", i);
}
}
--
2.15.1.478.ga1e07cd25f8b
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-wired-lan] [PATCH 3/6] fm10k: use variadic arguments to fm10k_add_stat_strings
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 3/6] fm10k: use variadic arguments to fm10k_add_stat_strings Jacob Keller
@ 2018-05-01 21:24 ` Singh, Krishneil K
0 siblings, 0 replies; 12+ messages in thread
From: Singh, Krishneil K @ 2018-05-01 21:24 UTC (permalink / raw)
To: intel-wired-lan
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of
> Jacob Keller
> Sent: Thursday, April 12, 2018 11:16 AM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 3/6] fm10k: use variadic arguments to
> fm10k_add_stat_strings
>
> Instead of using a fixed prefix string we setup before each call to
> fm10k_add_stat_strings, modify the helper to take variadic arguments and
> pass them to vsnprintf. This requires changing the fm10k_stat strings to
> take % format specifiers where necessary, but the resulting code is much
> simpler.
>
> Change-Id: I8055adeae0d63c227024c007c2ff51d0ee495238
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Title: use variadic arguments to fm10k_add_stat_strings
> Change-type: ImplementationChange
> Reviewed-on: https://git-amr-1.devtools.intel.com/gerrit/198022
> Tested-by: nosbuild <nosbuild@intel.com>
> ---
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Intel-wired-lan] [PATCH 4/6] fm10k: use macro to avoid passing the array and size separately
2018-04-12 18:15 [Intel-wired-lan] [PATCH 1/6] fm10k: setup VLANs for l2 accelerated macvlan interfaces Jacob Keller
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 2/6] fm10k: reduce duplicate fm10k_stat macro code Jacob Keller
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 3/6] fm10k: use variadic arguments to fm10k_add_stat_strings Jacob Keller
@ 2018-04-12 18:15 ` Jacob Keller
2018-05-01 21:24 ` Singh, Krishneil K
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 5/6] fm10k: warn if the stat size is unknown Jacob Keller
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Jacob Keller @ 2018-04-12 18:15 UTC (permalink / raw)
To: intel-wired-lan
Avoid potential bugs with fm10k_add_stat_strings and
fm10k_add_ethtool_stats by using a macro to calculate the ARRAY_SIZE
when passing. This helps ensure that the size is always correct.
Note that it assumes we only pass static const fm10k_stat arrays, and
that evaluation of the argument won't have side effects.
Change-Id: Id9396eef12cbab51a2559db80782e33fb20df274
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Title: use macro to avoid passing the array and size separately
Change-type: ImplementationChange
Reviewed-on: https://git-amr-1.devtools.intel.com/gerrit/198023
---
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 48 +++++++++++-------------
1 file changed, 21 insertions(+), 27 deletions(-)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index 26bf2322f457..e7e0e3c82fb2 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -152,8 +152,8 @@ enum {
static const char fm10k_prv_flags[FM10K_PRV_FLAG_LEN][ETH_GSTRING_LEN] = {
};
-static void fm10k_add_stat_strings(u8 **p, const struct fm10k_stats stats[],
- const unsigned int size, ...)
+static void __fm10k_add_stat_strings(u8 **p, const struct fm10k_stats stats[],
+ const unsigned int size, ...)
{
unsigned int i;
@@ -167,31 +167,28 @@ static void fm10k_add_stat_strings(u8 **p, const struct fm10k_stats stats[],
}
}
+#define fm10k_add_stat_strings(p, stats, ...) \
+ __fm10k_add_stat_strings(p, stats, ARRAY_SIZE(stats), ## __VA_ARGS__)
+
static void fm10k_get_stat_strings(struct net_device *dev, u8 *data)
{
struct fm10k_intfc *interface = netdev_priv(dev);
unsigned int i;
- fm10k_add_stat_strings(&data, fm10k_gstrings_net_stats,
- FM10K_NETDEV_STATS_LEN);
+ fm10k_add_stat_strings(&data, fm10k_gstrings_net_stats);
- fm10k_add_stat_strings(&data, fm10k_gstrings_global_stats,
- FM10K_GLOBAL_STATS_LEN);
+ fm10k_add_stat_strings(&data, fm10k_gstrings_global_stats);
- fm10k_add_stat_strings(&data, fm10k_gstrings_mbx_stats,
- FM10K_MBX_STATS_LEN);
+ fm10k_add_stat_strings(&data, fm10k_gstrings_mbx_stats);
if (interface->hw.mac.type != fm10k_mac_vf)
- fm10k_add_stat_strings(&data, fm10k_gstrings_pf_stats,
- FM10K_PF_STATS_LEN);
+ fm10k_add_stat_strings(&data, fm10k_gstrings_pf_stats);
for (i = 0; i < interface->hw.mac.max_queues; i++) {
fm10k_add_stat_strings(&data, fm10k_gstrings_queue_stats,
- FM10K_QUEUE_STATS_LEN,
"tx", i);
fm10k_add_stat_strings(&data, fm10k_gstrings_queue_stats,
- FM10K_QUEUE_STATS_LEN,
"rx", i);
}
}
@@ -237,9 +234,9 @@ static int fm10k_get_sset_count(struct net_device *dev, int sset)
}
}
-static void fm10k_add_ethtool_stats(u64 **data, void *pointer,
- const struct fm10k_stats stats[],
- const unsigned int size)
+static void __fm10k_add_ethtool_stats(u64 **data, void *pointer,
+ const struct fm10k_stats stats[],
+ const unsigned int size)
{
unsigned int i;
char *p;
@@ -273,6 +270,9 @@ static void fm10k_add_ethtool_stats(u64 **data, void *pointer,
}
}
+#define fm10k_add_ethtool_stats(data, pointer, stats) \
+ __fm10k_add_ethtool_stats(data, pointer, stats, ARRAY_SIZE(stats))
+
static void fm10k_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats __always_unused *stats,
u64 *data)
@@ -283,20 +283,16 @@ static void fm10k_get_ethtool_stats(struct net_device *netdev,
fm10k_update_stats(interface);
- fm10k_add_ethtool_stats(&data, net_stats, fm10k_gstrings_net_stats,
- FM10K_NETDEV_STATS_LEN);
+ fm10k_add_ethtool_stats(&data, net_stats, fm10k_gstrings_net_stats);
- fm10k_add_ethtool_stats(&data, interface, fm10k_gstrings_global_stats,
- FM10K_GLOBAL_STATS_LEN);
+ fm10k_add_ethtool_stats(&data, interface, fm10k_gstrings_global_stats);
fm10k_add_ethtool_stats(&data, &interface->hw.mbx,
- fm10k_gstrings_mbx_stats,
- FM10K_MBX_STATS_LEN);
+ fm10k_gstrings_mbx_stats);
if (interface->hw.mac.type != fm10k_mac_vf) {
fm10k_add_ethtool_stats(&data, interface,
- fm10k_gstrings_pf_stats,
- FM10K_PF_STATS_LEN);
+ fm10k_gstrings_pf_stats);
}
for (i = 0; i < interface->hw.mac.max_queues; i++) {
@@ -304,13 +300,11 @@ static void fm10k_get_ethtool_stats(struct net_device *netdev,
ring = interface->tx_ring[i];
fm10k_add_ethtool_stats(&data, ring,
- fm10k_gstrings_queue_stats,
- FM10K_QUEUE_STATS_LEN);
+ fm10k_gstrings_queue_stats);
ring = interface->rx_ring[i];
fm10k_add_ethtool_stats(&data, ring,
- fm10k_gstrings_queue_stats,
- FM10K_QUEUE_STATS_LEN);
+ fm10k_gstrings_queue_stats);
}
}
--
2.15.1.478.ga1e07cd25f8b
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-wired-lan] [PATCH 4/6] fm10k: use macro to avoid passing the array and size separately
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 4/6] fm10k: use macro to avoid passing the array and size separately Jacob Keller
@ 2018-05-01 21:24 ` Singh, Krishneil K
0 siblings, 0 replies; 12+ messages in thread
From: Singh, Krishneil K @ 2018-05-01 21:24 UTC (permalink / raw)
To: intel-wired-lan
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of
> Jacob Keller
> Sent: Thursday, April 12, 2018 11:16 AM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 4/6] fm10k: use macro to avoid passing the
> array and size separately
>
> Avoid potential bugs with fm10k_add_stat_strings and
> fm10k_add_ethtool_stats by using a macro to calculate the ARRAY_SIZE
> when passing. This helps ensure that the size is always correct.
>
> Note that it assumes we only pass static const fm10k_stat arrays, and
> that evaluation of the argument won't have side effects.
>
> Change-Id: Id9396eef12cbab51a2559db80782e33fb20df274
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Title: use macro to avoid passing the array and size separately
> Change-type: ImplementationChange
> Reviewed-on: https://git-amr-1.devtools.intel.com/gerrit/198023
> ---
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Intel-wired-lan] [PATCH 5/6] fm10k: warn if the stat size is unknown
2018-04-12 18:15 [Intel-wired-lan] [PATCH 1/6] fm10k: setup VLANs for l2 accelerated macvlan interfaces Jacob Keller
` (2 preceding siblings ...)
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 4/6] fm10k: use macro to avoid passing the array and size separately Jacob Keller
@ 2018-04-12 18:15 ` Jacob Keller
2018-05-01 21:25 ` Singh, Krishneil K
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 6/6] fm10k: don't protect fm10k_queue_mac_request by fm10k_host_mbx_ready Jacob Keller
2018-05-01 21:23 ` [Intel-wired-lan] [PATCH 1/6] fm10k: setup VLANs for l2 accelerated macvlan interfaces Singh, Krishneil K
5 siblings, 1 reply; 12+ messages in thread
From: Jacob Keller @ 2018-04-12 18:15 UTC (permalink / raw)
To: intel-wired-lan
Change-Id: I80172c86be68bdd1e1df00b650877b686c718b0f
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Title: warn if the stat size is unknown
Change-type: DefectResolution
Reviewed-on: https://git-amr-1.devtools.intel.com/gerrit/198024
Tested-by: nosbuild <nosbuild@intel.com>
---
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index e7e0e3c82fb2..e5a1da7ac711 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -265,6 +265,8 @@ static void __fm10k_add_ethtool_stats(u64 **data, void *pointer,
*((*data)++) = *(u8 *)p;
break;
default:
+ WARN_ONCE(1, "unexpected stat size for %s",
+ stats[i].stat_string);
*((*data)++) = 0;
}
}
--
2.15.1.478.ga1e07cd25f8b
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-wired-lan] [PATCH 6/6] fm10k: don't protect fm10k_queue_mac_request by fm10k_host_mbx_ready
2018-04-12 18:15 [Intel-wired-lan] [PATCH 1/6] fm10k: setup VLANs for l2 accelerated macvlan interfaces Jacob Keller
` (3 preceding siblings ...)
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 5/6] fm10k: warn if the stat size is unknown Jacob Keller
@ 2018-04-12 18:15 ` Jacob Keller
2018-05-01 21:25 ` Singh, Krishneil K
2018-05-01 21:23 ` [Intel-wired-lan] [PATCH 1/6] fm10k: setup VLANs for l2 accelerated macvlan interfaces Singh, Krishneil K
5 siblings, 1 reply; 12+ messages in thread
From: Jacob Keller @ 2018-04-12 18:15 UTC (permalink / raw)
To: intel-wired-lan
We don't actually need to check if the host mbx is ready when queuing
MAC requests, because these are not handled by a special queue which
queues up requests until the mailbox is capable of handling them.
Pull these requests outside the fm10k_host_mbx_ready() check, as it is
not necessary.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index 36200dec941d..11204fdbb484 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1555,12 +1555,12 @@ static void *fm10k_dfwd_add_station(struct net_device *dev,
glort = l2_accel->dglort + 1 + i;
- if (fm10k_host_mbx_ready(interface)) {
+ if (fm10k_host_mbx_ready(interface))
hw->mac.ops.update_xcast_mode(hw, glort,
FM10K_XCAST_MODE_NONE);
- fm10k_queue_mac_request(interface, glort, sdev->dev_addr,
- hw->mac.default_vid, true);
- }
+
+ fm10k_queue_mac_request(interface, glort, sdev->dev_addr,
+ hw->mac.default_vid, true);
for (vid = fm10k_find_next_vlan(interface, 0);
vid < VLAN_N_VID;
@@ -1601,12 +1601,12 @@ static void fm10k_dfwd_del_station(struct net_device *dev, void *priv)
glort = l2_accel->dglort + 1 + i;
- if (fm10k_host_mbx_ready(interface)) {
+ if (fm10k_host_mbx_ready(interface))
hw->mac.ops.update_xcast_mode(hw, glort,
FM10K_XCAST_MODE_NONE);
- fm10k_queue_mac_request(interface, glort, sdev->dev_addr,
- hw->mac.default_vid, false);
- }
+
+ fm10k_queue_mac_request(interface, glort, sdev->dev_addr,
+ hw->mac.default_vid, false);
for (vid = fm10k_find_next_vlan(interface, 0);
vid < VLAN_N_VID;
--
2.15.1.478.ga1e07cd25f8b
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-wired-lan] [PATCH 6/6] fm10k: don't protect fm10k_queue_mac_request by fm10k_host_mbx_ready
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 6/6] fm10k: don't protect fm10k_queue_mac_request by fm10k_host_mbx_ready Jacob Keller
@ 2018-05-01 21:25 ` Singh, Krishneil K
0 siblings, 0 replies; 12+ messages in thread
From: Singh, Krishneil K @ 2018-05-01 21:25 UTC (permalink / raw)
To: intel-wired-lan
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of
> Jacob Keller
> Sent: Thursday, April 12, 2018 11:16 AM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 6/6] fm10k: don't protect
> fm10k_queue_mac_request by fm10k_host_mbx_ready
>
> We don't actually need to check if the host mbx is ready when queuing
> MAC requests, because these are not handled by a special queue which
> queues up requests until the mailbox is capable of handling them.
>
> Pull these requests outside the fm10k_host_mbx_ready() check, as it is
> not necessary.
>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Intel-wired-lan] [PATCH 1/6] fm10k: setup VLANs for l2 accelerated macvlan interfaces
2018-04-12 18:15 [Intel-wired-lan] [PATCH 1/6] fm10k: setup VLANs for l2 accelerated macvlan interfaces Jacob Keller
` (4 preceding siblings ...)
2018-04-12 18:15 ` [Intel-wired-lan] [PATCH 6/6] fm10k: don't protect fm10k_queue_mac_request by fm10k_host_mbx_ready Jacob Keller
@ 2018-05-01 21:23 ` Singh, Krishneil K
5 siblings, 0 replies; 12+ messages in thread
From: Singh, Krishneil K @ 2018-05-01 21:23 UTC (permalink / raw)
To: intel-wired-lan
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of
> Jacob Keller
> Sent: Thursday, April 12, 2018 11:16 AM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 1/6] fm10k: setup VLANs for l2 accelerated
> macvlan interfaces
>
> We have support for accelerating macvlan devices via the
> .ndo_dfwd_add_station() netdev op. These accelerated macvlan MAC
> addresses are stored in the l2_accel structure, separate from the
> unicast or multicast address lists.
>
> If a VLAN is added on top of the macvlan device by the stack, traffic
> will not properly flow to the macvlan. This occurs because we fail to
> setup the VLANs for l2_accel MAC addresses.
>
> In the non-offloaded case the MAC address is added to the unicast
> address list, and thus the normal setup for enabling VLANs works as
> expected.
>
> We also need to add VLANs marked from .ndo_vlan_rx_add_vid() into the
> l2_accel MAC addresses. Otherwise, VLAN traffic will not properly be
> received by the VLAN devices attached to the offloaded macvlan devices.
>
> Fix this by adding necessary logic to setup VLANs not only for the
> unicast and multicast addresses, but also the l2_accel list. We need
> similar logic in dfwd_add_station, dfwd_del_station, fm10k_update_vid,
> and fm10k_restore_rx_state.
>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Reviewed-by: Alexander Duyck <alexander.h.duyck@intel.com>
> ---
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread