* [PATCH net-next 0/2] Fix 2 non-critical issues in SJA1105 DSA
@ 2020-05-30 10:29 Vladimir Oltean
2020-05-30 10:29 ` [PATCH net-next 1/2] net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_static_config.c Vladimir Oltean
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Vladimir Oltean @ 2020-05-30 10:29 UTC (permalink / raw)
To: andrew, f.fainelli, vivien.didelot, davem; +Cc: netdev
From: Vladimir Oltean <vladimir.oltean@nxp.com>
This small series suppresses the W=1 warnings in the sja1105 driver and
it corrects some register offsets. I would like to target it against
net-next since it would have non-trivial conflicts with net, and the
problems it solves are not that big of a deal.
Vladimir Oltean (2):
net: dsa: sja1105: suppress -Wmissing-prototypes in
sja1105_static_config.c
net: dsa: sja1105: fix port mirroring for P/Q/R/S
drivers/net/dsa/sja1105/sja1105.h | 18 -------
.../net/dsa/sja1105/sja1105_dynamic_config.c | 50 +++++++++++++++----
.../net/dsa/sja1105/sja1105_static_config.c | 10 ++--
.../net/dsa/sja1105/sja1105_static_config.h | 22 ++++++++
4 files changed, 66 insertions(+), 34 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 1/2] net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_static_config.c
2020-05-30 10:29 [PATCH net-next 0/2] Fix 2 non-critical issues in SJA1105 DSA Vladimir Oltean
@ 2020-05-30 10:29 ` Vladimir Oltean
2020-05-30 18:40 ` Florian Fainelli
2020-05-31 0:38 ` Andrew Lunn
2020-05-30 10:29 ` [PATCH net-next 2/2] net: dsa: sja1105: fix port mirroring for P/Q/R/S Vladimir Oltean
2020-05-31 1:01 ` [PATCH net-next 0/2] Fix 2 non-critical issues in SJA1105 DSA David Miller
2 siblings, 2 replies; 6+ messages in thread
From: Vladimir Oltean @ 2020-05-30 10:29 UTC (permalink / raw)
To: andrew, f.fainelli, vivien.didelot, davem; +Cc: netdev
From: Vladimir Oltean <vladimir.oltean@nxp.com>
Newer compilers complain with W=1 builds that there are non-static
functions defined in sja1105_static_config.c that don't have a
prototype, because their prototype is defined in sja1105.h which this
translation unit does not include.
I don't entirely understand what is the point of these warnings, since
in principle there's nothing wrong with that. But let's move the
prototypes to a header file that _is_ included by
sja1105_static_config.c, since that will make these warnings go away.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
drivers/net/dsa/sja1105/sja1105.h | 18 ------------------
.../net/dsa/sja1105/sja1105_static_config.h | 18 ++++++++++++++++++
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/net/dsa/sja1105/sja1105.h b/drivers/net/dsa/sja1105/sja1105.h
index cb3c81a49fbc..29ed21687295 100644
--- a/drivers/net/dsa/sja1105/sja1105.h
+++ b/drivers/net/dsa/sja1105/sja1105.h
@@ -323,24 +323,6 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port,
int sja1105pqrs_fdb_del(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid);
-/* Common implementations for the static and dynamic configs */
-size_t sja1105_l2_forwarding_entry_packing(void *buf, void *entry_ptr,
- enum packing_op op);
-size_t sja1105pqrs_l2_lookup_entry_packing(void *buf, void *entry_ptr,
- enum packing_op op);
-size_t sja1105et_l2_lookup_entry_packing(void *buf, void *entry_ptr,
- enum packing_op op);
-size_t sja1105_vlan_lookup_entry_packing(void *buf, void *entry_ptr,
- enum packing_op op);
-size_t sja1105_retagging_entry_packing(void *buf, void *entry_ptr,
- enum packing_op op);
-size_t sja1105pqrs_mac_config_entry_packing(void *buf, void *entry_ptr,
- enum packing_op op);
-size_t sja1105pqrs_avb_params_entry_packing(void *buf, void *entry_ptr,
- enum packing_op op);
-size_t sja1105_vl_lookup_entry_packing(void *buf, void *entry_ptr,
- enum packing_op op);
-
/* From sja1105_flower.c */
int sja1105_cls_flower_del(struct dsa_switch *ds, int port,
struct flow_cls_offload *cls, bool ingress);
diff --git a/drivers/net/dsa/sja1105/sja1105_static_config.h b/drivers/net/dsa/sja1105/sja1105_static_config.h
index 9b62b9b5549d..8279f4f31eff 100644
--- a/drivers/net/dsa/sja1105/sja1105_static_config.h
+++ b/drivers/net/dsa/sja1105/sja1105_static_config.h
@@ -430,4 +430,22 @@ void sja1105_unpack(const void *buf, u64 *val, int start, int end, size_t len);
void sja1105_packing(void *buf, u64 *val, int start, int end,
size_t len, enum packing_op op);
+/* Common implementations for the static and dynamic configs */
+size_t sja1105_l2_forwarding_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op);
+size_t sja1105pqrs_l2_lookup_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op);
+size_t sja1105et_l2_lookup_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op);
+size_t sja1105_vlan_lookup_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op);
+size_t sja1105_retagging_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op);
+size_t sja1105pqrs_mac_config_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op);
+size_t sja1105pqrs_avb_params_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op);
+size_t sja1105_vl_lookup_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op);
+
#endif
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/2] net: dsa: sja1105: fix port mirroring for P/Q/R/S
2020-05-30 10:29 [PATCH net-next 0/2] Fix 2 non-critical issues in SJA1105 DSA Vladimir Oltean
2020-05-30 10:29 ` [PATCH net-next 1/2] net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_static_config.c Vladimir Oltean
@ 2020-05-30 10:29 ` Vladimir Oltean
2020-05-31 1:01 ` [PATCH net-next 0/2] Fix 2 non-critical issues in SJA1105 DSA David Miller
2 siblings, 0 replies; 6+ messages in thread
From: Vladimir Oltean @ 2020-05-30 10:29 UTC (permalink / raw)
To: andrew, f.fainelli, vivien.didelot, davem; +Cc: netdev
From: Vladimir Oltean <vladimir.oltean@nxp.com>
The dynamic configuration interface for the General Params and the L2
Lookup Params tables was copy-pasted between E/T devices and P/Q/R/S
devices. Nonetheless, these interfaces are bitwise different.
The driver is using dynamic reconfiguration of the General Parameters
table for the port mirroring feature, which was therefore broken on
P/Q/R/S.
Note that this patch can't be backported easily very far to stable trees
(since it conflicts with some other development done since the
introduction of the driver). So the Fixes: tag is purely informational.
Fixes: 8aa9ebccae87 ("net: dsa: Introduce driver for NXP SJA1105 5-port L2 switch")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
.../net/dsa/sja1105/sja1105_dynamic_config.c | 50 +++++++++++++++----
.../net/dsa/sja1105/sja1105_static_config.c | 10 ++--
.../net/dsa/sja1105/sja1105_static_config.h | 4 ++
3 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/drivers/net/dsa/sja1105/sja1105_dynamic_config.c b/drivers/net/dsa/sja1105/sja1105_dynamic_config.c
index 7516f2ffdd4e..4471eeccc293 100644
--- a/drivers/net/dsa/sja1105/sja1105_dynamic_config.c
+++ b/drivers/net/dsa/sja1105/sja1105_dynamic_config.c
@@ -127,9 +127,15 @@
#define SJA1105ET_SIZE_L2_LOOKUP_PARAMS_DYN_CMD \
SJA1105_SIZE_DYN_CMD
+#define SJA1105PQRS_SIZE_L2_LOOKUP_PARAMS_DYN_CMD \
+ (SJA1105_SIZE_DYN_CMD + SJA1105PQRS_SIZE_L2_LOOKUP_PARAMS_ENTRY)
+
#define SJA1105ET_SIZE_GENERAL_PARAMS_DYN_CMD \
SJA1105_SIZE_DYN_CMD
+#define SJA1105PQRS_SIZE_GENERAL_PARAMS_DYN_CMD \
+ (SJA1105_SIZE_DYN_CMD + SJA1105PQRS_SIZE_GENERAL_PARAMS_ENTRY)
+
#define SJA1105PQRS_SIZE_AVB_PARAMS_DYN_CMD \
(SJA1105_SIZE_DYN_CMD + SJA1105PQRS_SIZE_AVB_PARAMS_ENTRY)
@@ -143,7 +149,7 @@
(SJA1105_SIZE_DYN_CMD + SJA1105PQRS_SIZE_CBS_ENTRY)
#define SJA1105_MAX_DYN_CMD_SIZE \
- SJA1105PQRS_SIZE_MAC_CONFIG_DYN_CMD
+ SJA1105PQRS_SIZE_GENERAL_PARAMS_DYN_CMD
struct sja1105_dyn_cmd {
bool search;
@@ -500,6 +506,18 @@ sja1105et_l2_lookup_params_entry_packing(void *buf, void *entry_ptr,
return 0;
}
+static void
+sja1105pqrs_l2_lookup_params_cmd_packing(void *buf,
+ struct sja1105_dyn_cmd *cmd,
+ enum packing_op op)
+{
+ u8 *p = buf + SJA1105PQRS_SIZE_L2_LOOKUP_PARAMS_ENTRY;
+ const int size = SJA1105_SIZE_DYN_CMD;
+
+ sja1105_packing(p, &cmd->valid, 31, 31, size, op);
+ sja1105_packing(p, &cmd->rdwrset, 30, 30, size, op);
+}
+
static void
sja1105et_general_params_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd,
enum packing_op op)
@@ -522,6 +540,18 @@ sja1105et_general_params_entry_packing(void *buf, void *entry_ptr,
return 0;
}
+static void
+sja1105pqrs_general_params_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd,
+ enum packing_op op)
+{
+ u8 *p = buf + SJA1105PQRS_SIZE_GENERAL_PARAMS_ENTRY;
+ const int size = SJA1105_SIZE_DYN_CMD;
+
+ sja1105_packing(p, &cmd->valid, 31, 31, size, op);
+ sja1105_packing(p, &cmd->errors, 30, 30, size, op);
+ sja1105_packing(p, &cmd->rdwrset, 28, 28, size, op);
+}
+
static void
sja1105pqrs_avb_params_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd,
enum packing_op op)
@@ -761,12 +791,12 @@ struct sja1105_dynamic_table_ops sja1105pqrs_dyn_ops[BLK_IDX_MAX_DYN] = {
[BLK_IDX_SCHEDULE_ENTRY_POINTS_PARAMS] = {0},
[BLK_IDX_VL_FORWARDING_PARAMS] = {0},
[BLK_IDX_L2_LOOKUP_PARAMS] = {
- .entry_packing = sja1105et_l2_lookup_params_entry_packing,
- .cmd_packing = sja1105et_l2_lookup_params_cmd_packing,
+ .entry_packing = sja1105pqrs_l2_lookup_params_entry_packing,
+ .cmd_packing = sja1105pqrs_l2_lookup_params_cmd_packing,
.max_entry_count = SJA1105_MAX_L2_LOOKUP_PARAMS_COUNT,
.access = (OP_READ | OP_WRITE),
- .packed_size = SJA1105ET_SIZE_L2_LOOKUP_PARAMS_DYN_CMD,
- .addr = 0x38,
+ .packed_size = SJA1105PQRS_SIZE_L2_LOOKUP_PARAMS_DYN_CMD,
+ .addr = 0x54,
},
[BLK_IDX_L2_FORWARDING_PARAMS] = {0},
[BLK_IDX_AVB_PARAMS] = {
@@ -778,12 +808,12 @@ struct sja1105_dynamic_table_ops sja1105pqrs_dyn_ops[BLK_IDX_MAX_DYN] = {
.addr = 0x8003,
},
[BLK_IDX_GENERAL_PARAMS] = {
- .entry_packing = sja1105et_general_params_entry_packing,
- .cmd_packing = sja1105et_general_params_cmd_packing,
+ .entry_packing = sja1105pqrs_general_params_entry_packing,
+ .cmd_packing = sja1105pqrs_general_params_cmd_packing,
.max_entry_count = SJA1105_MAX_GENERAL_PARAMS_COUNT,
- .access = OP_WRITE,
- .packed_size = SJA1105ET_SIZE_GENERAL_PARAMS_DYN_CMD,
- .addr = 0x34,
+ .access = (OP_READ | OP_WRITE),
+ .packed_size = SJA1105PQRS_SIZE_GENERAL_PARAMS_DYN_CMD,
+ .addr = 0x3B,
},
[BLK_IDX_RETAGGING] = {
.entry_packing = sja1105_retagging_entry_packing,
diff --git a/drivers/net/dsa/sja1105/sja1105_static_config.c b/drivers/net/dsa/sja1105/sja1105_static_config.c
index 780aca034cdc..ff3fe471efc2 100644
--- a/drivers/net/dsa/sja1105/sja1105_static_config.c
+++ b/drivers/net/dsa/sja1105/sja1105_static_config.c
@@ -146,9 +146,8 @@ static size_t sja1105et_general_params_entry_packing(void *buf, void *entry_ptr,
/* TPID and TPID2 are intentionally reversed so that semantic
* compatibility with E/T is kept.
*/
-static size_t
-sja1105pqrs_general_params_entry_packing(void *buf, void *entry_ptr,
- enum packing_op op)
+size_t sja1105pqrs_general_params_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op)
{
const size_t size = SJA1105PQRS_SIZE_GENERAL_PARAMS_ENTRY;
struct sja1105_general_params_entry *entry = entry_ptr;
@@ -228,9 +227,8 @@ sja1105et_l2_lookup_params_entry_packing(void *buf, void *entry_ptr,
return size;
}
-static size_t
-sja1105pqrs_l2_lookup_params_entry_packing(void *buf, void *entry_ptr,
- enum packing_op op)
+size_t sja1105pqrs_l2_lookup_params_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op)
{
const size_t size = SJA1105PQRS_SIZE_L2_LOOKUP_PARAMS_ENTRY;
struct sja1105_l2_lookup_params_entry *entry = entry_ptr;
diff --git a/drivers/net/dsa/sja1105/sja1105_static_config.h b/drivers/net/dsa/sja1105/sja1105_static_config.h
index 8279f4f31eff..ee0f10062763 100644
--- a/drivers/net/dsa/sja1105/sja1105_static_config.h
+++ b/drivers/net/dsa/sja1105/sja1105_static_config.h
@@ -431,6 +431,10 @@ void sja1105_packing(void *buf, u64 *val, int start, int end,
size_t len, enum packing_op op);
/* Common implementations for the static and dynamic configs */
+size_t sja1105pqrs_general_params_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op);
+size_t sja1105pqrs_l2_lookup_params_entry_packing(void *buf, void *entry_ptr,
+ enum packing_op op);
size_t sja1105_l2_forwarding_entry_packing(void *buf, void *entry_ptr,
enum packing_op op);
size_t sja1105pqrs_l2_lookup_entry_packing(void *buf, void *entry_ptr,
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_static_config.c
2020-05-30 10:29 ` [PATCH net-next 1/2] net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_static_config.c Vladimir Oltean
@ 2020-05-30 18:40 ` Florian Fainelli
2020-05-31 0:38 ` Andrew Lunn
1 sibling, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2020-05-30 18:40 UTC (permalink / raw)
To: Vladimir Oltean, andrew, vivien.didelot, davem; +Cc: netdev
On 5/30/2020 3:29 AM, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
>
> Newer compilers complain with W=1 builds that there are non-static
> functions defined in sja1105_static_config.c that don't have a
> prototype, because their prototype is defined in sja1105.h which this
> translation unit does not include.
>
> I don't entirely understand what is the point of these warnings, since
> in principle there's nothing wrong with that. But let's move the
> prototypes to a header file that _is_ included by
> sja1105_static_config.c, since that will make these warnings go away.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_static_config.c
2020-05-30 10:29 ` [PATCH net-next 1/2] net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_static_config.c Vladimir Oltean
2020-05-30 18:40 ` Florian Fainelli
@ 2020-05-31 0:38 ` Andrew Lunn
1 sibling, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2020-05-31 0:38 UTC (permalink / raw)
To: Vladimir Oltean; +Cc: f.fainelli, vivien.didelot, davem, netdev
On Sat, May 30, 2020 at 01:29:52PM +0300, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
>
> Newer compilers complain with W=1 builds that there are non-static
> functions defined in sja1105_static_config.c that don't have a
> prototype, because their prototype is defined in sja1105.h which this
> translation unit does not include.
>
> I don't entirely understand what is the point of these warnings, since
> in principle there's nothing wrong with that.
Hi Vladimir
The issue here is that the header might have a typo and have a
different signature than the function itself. The caller than passes
the parameters in the wrong way. Best case it segfault/Opps, but it
can introduce subtle bugs which are hard to find.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/2] Fix 2 non-critical issues in SJA1105 DSA
2020-05-30 10:29 [PATCH net-next 0/2] Fix 2 non-critical issues in SJA1105 DSA Vladimir Oltean
2020-05-30 10:29 ` [PATCH net-next 1/2] net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_static_config.c Vladimir Oltean
2020-05-30 10:29 ` [PATCH net-next 2/2] net: dsa: sja1105: fix port mirroring for P/Q/R/S Vladimir Oltean
@ 2020-05-31 1:01 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-05-31 1:01 UTC (permalink / raw)
To: olteanv; +Cc: andrew, f.fainelli, vivien.didelot, netdev
From: Vladimir Oltean <olteanv@gmail.com>
Date: Sat, 30 May 2020 13:29:51 +0300
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
>
> This small series suppresses the W=1 warnings in the sja1105 driver and
> it corrects some register offsets. I would like to target it against
> net-next since it would have non-trivial conflicts with net, and the
> problems it solves are not that big of a deal.
Series applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-05-31 1:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-30 10:29 [PATCH net-next 0/2] Fix 2 non-critical issues in SJA1105 DSA Vladimir Oltean
2020-05-30 10:29 ` [PATCH net-next 1/2] net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_static_config.c Vladimir Oltean
2020-05-30 18:40 ` Florian Fainelli
2020-05-31 0:38 ` Andrew Lunn
2020-05-30 10:29 ` [PATCH net-next 2/2] net: dsa: sja1105: fix port mirroring for P/Q/R/S Vladimir Oltean
2020-05-31 1:01 ` [PATCH net-next 0/2] Fix 2 non-critical issues in SJA1105 DSA David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).