Skip to content

Commit b86a372

Browse files
committed
Merge branch 'Fix-2-non-critical-issues-in-SJA1105-DSA'
Vladimir Oltean says: ==================== Fix 2 non-critical issues in SJA1105 DSA 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. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 4300c7e + 99b981f commit b86a372

File tree

4 files changed

+66
-34
lines changed

4 files changed

+66
-34
lines changed

drivers/net/dsa/sja1105/sja1105.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -323,24 +323,6 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port,
323323
int sja1105pqrs_fdb_del(struct dsa_switch *ds, int port,
324324
const unsigned char *addr, u16 vid);
325325

326-
/* Common implementations for the static and dynamic configs */
327-
size_t sja1105_l2_forwarding_entry_packing(void *buf, void *entry_ptr,
328-
enum packing_op op);
329-
size_t sja1105pqrs_l2_lookup_entry_packing(void *buf, void *entry_ptr,
330-
enum packing_op op);
331-
size_t sja1105et_l2_lookup_entry_packing(void *buf, void *entry_ptr,
332-
enum packing_op op);
333-
size_t sja1105_vlan_lookup_entry_packing(void *buf, void *entry_ptr,
334-
enum packing_op op);
335-
size_t sja1105_retagging_entry_packing(void *buf, void *entry_ptr,
336-
enum packing_op op);
337-
size_t sja1105pqrs_mac_config_entry_packing(void *buf, void *entry_ptr,
338-
enum packing_op op);
339-
size_t sja1105pqrs_avb_params_entry_packing(void *buf, void *entry_ptr,
340-
enum packing_op op);
341-
size_t sja1105_vl_lookup_entry_packing(void *buf, void *entry_ptr,
342-
enum packing_op op);
343-
344326
/* From sja1105_flower.c */
345327
int sja1105_cls_flower_del(struct dsa_switch *ds, int port,
346328
struct flow_cls_offload *cls, bool ingress);

drivers/net/dsa/sja1105/sja1105_dynamic_config.c

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,15 @@
127127
#define SJA1105ET_SIZE_L2_LOOKUP_PARAMS_DYN_CMD \
128128
SJA1105_SIZE_DYN_CMD
129129

130+
#define SJA1105PQRS_SIZE_L2_LOOKUP_PARAMS_DYN_CMD \
131+
(SJA1105_SIZE_DYN_CMD + SJA1105PQRS_SIZE_L2_LOOKUP_PARAMS_ENTRY)
132+
130133
#define SJA1105ET_SIZE_GENERAL_PARAMS_DYN_CMD \
131134
SJA1105_SIZE_DYN_CMD
132135

136+
#define SJA1105PQRS_SIZE_GENERAL_PARAMS_DYN_CMD \
137+
(SJA1105_SIZE_DYN_CMD + SJA1105PQRS_SIZE_GENERAL_PARAMS_ENTRY)
138+
133139
#define SJA1105PQRS_SIZE_AVB_PARAMS_DYN_CMD \
134140
(SJA1105_SIZE_DYN_CMD + SJA1105PQRS_SIZE_AVB_PARAMS_ENTRY)
135141

@@ -143,7 +149,7 @@
143149
(SJA1105_SIZE_DYN_CMD + SJA1105PQRS_SIZE_CBS_ENTRY)
144150

145151
#define SJA1105_MAX_DYN_CMD_SIZE \
146-
SJA1105PQRS_SIZE_MAC_CONFIG_DYN_CMD
152+
SJA1105PQRS_SIZE_GENERAL_PARAMS_DYN_CMD
147153

148154
struct sja1105_dyn_cmd {
149155
bool search;
@@ -500,6 +506,18 @@ sja1105et_l2_lookup_params_entry_packing(void *buf, void *entry_ptr,
500506
return 0;
501507
}
502508

509+
static void
510+
sja1105pqrs_l2_lookup_params_cmd_packing(void *buf,
511+
struct sja1105_dyn_cmd *cmd,
512+
enum packing_op op)
513+
{
514+
u8 *p = buf + SJA1105PQRS_SIZE_L2_LOOKUP_PARAMS_ENTRY;
515+
const int size = SJA1105_SIZE_DYN_CMD;
516+
517+
sja1105_packing(p, &cmd->valid, 31, 31, size, op);
518+
sja1105_packing(p, &cmd->rdwrset, 30, 30, size, op);
519+
}
520+
503521
static void
504522
sja1105et_general_params_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd,
505523
enum packing_op op)
@@ -522,6 +540,18 @@ sja1105et_general_params_entry_packing(void *buf, void *entry_ptr,
522540
return 0;
523541
}
524542

543+
static void
544+
sja1105pqrs_general_params_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd,
545+
enum packing_op op)
546+
{
547+
u8 *p = buf + SJA1105PQRS_SIZE_GENERAL_PARAMS_ENTRY;
548+
const int size = SJA1105_SIZE_DYN_CMD;
549+
550+
sja1105_packing(p, &cmd->valid, 31, 31, size, op);
551+
sja1105_packing(p, &cmd->errors, 30, 30, size, op);
552+
sja1105_packing(p, &cmd->rdwrset, 28, 28, size, op);
553+
}
554+
525555
static void
526556
sja1105pqrs_avb_params_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd,
527557
enum packing_op op)
@@ -761,12 +791,12 @@ struct sja1105_dynamic_table_ops sja1105pqrs_dyn_ops[BLK_IDX_MAX_DYN] = {
761791
[BLK_IDX_SCHEDULE_ENTRY_POINTS_PARAMS] = {0},
762792
[BLK_IDX_VL_FORWARDING_PARAMS] = {0},
763793
[BLK_IDX_L2_LOOKUP_PARAMS] = {
764-
.entry_packing = sja1105et_l2_lookup_params_entry_packing,
765-
.cmd_packing = sja1105et_l2_lookup_params_cmd_packing,
794+
.entry_packing = sja1105pqrs_l2_lookup_params_entry_packing,
795+
.cmd_packing = sja1105pqrs_l2_lookup_params_cmd_packing,
766796
.max_entry_count = SJA1105_MAX_L2_LOOKUP_PARAMS_COUNT,
767797
.access = (OP_READ | OP_WRITE),
768-
.packed_size = SJA1105ET_SIZE_L2_LOOKUP_PARAMS_DYN_CMD,
769-
.addr = 0x38,
798+
.packed_size = SJA1105PQRS_SIZE_L2_LOOKUP_PARAMS_DYN_CMD,
799+
.addr = 0x54,
770800
},
771801
[BLK_IDX_L2_FORWARDING_PARAMS] = {0},
772802
[BLK_IDX_AVB_PARAMS] = {
@@ -778,12 +808,12 @@ struct sja1105_dynamic_table_ops sja1105pqrs_dyn_ops[BLK_IDX_MAX_DYN] = {
778808
.addr = 0x8003,
779809
},
780810
[BLK_IDX_GENERAL_PARAMS] = {
781-
.entry_packing = sja1105et_general_params_entry_packing,
782-
.cmd_packing = sja1105et_general_params_cmd_packing,
811+
.entry_packing = sja1105pqrs_general_params_entry_packing,
812+
.cmd_packing = sja1105pqrs_general_params_cmd_packing,
783813
.max_entry_count = SJA1105_MAX_GENERAL_PARAMS_COUNT,
784-
.access = OP_WRITE,
785-
.packed_size = SJA1105ET_SIZE_GENERAL_PARAMS_DYN_CMD,
786-
.addr = 0x34,
814+
.access = (OP_READ | OP_WRITE),
815+
.packed_size = SJA1105PQRS_SIZE_GENERAL_PARAMS_DYN_CMD,
816+
.addr = 0x3B,
787817
},
788818
[BLK_IDX_RETAGGING] = {
789819
.entry_packing = sja1105_retagging_entry_packing,

drivers/net/dsa/sja1105/sja1105_static_config.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ static size_t sja1105et_general_params_entry_packing(void *buf, void *entry_ptr,
146146
/* TPID and TPID2 are intentionally reversed so that semantic
147147
* compatibility with E/T is kept.
148148
*/
149-
static size_t
150-
sja1105pqrs_general_params_entry_packing(void *buf, void *entry_ptr,
151-
enum packing_op op)
149+
size_t sja1105pqrs_general_params_entry_packing(void *buf, void *entry_ptr,
150+
enum packing_op op)
152151
{
153152
const size_t size = SJA1105PQRS_SIZE_GENERAL_PARAMS_ENTRY;
154153
struct sja1105_general_params_entry *entry = entry_ptr;
@@ -228,9 +227,8 @@ sja1105et_l2_lookup_params_entry_packing(void *buf, void *entry_ptr,
228227
return size;
229228
}
230229

231-
static size_t
232-
sja1105pqrs_l2_lookup_params_entry_packing(void *buf, void *entry_ptr,
233-
enum packing_op op)
230+
size_t sja1105pqrs_l2_lookup_params_entry_packing(void *buf, void *entry_ptr,
231+
enum packing_op op)
234232
{
235233
const size_t size = SJA1105PQRS_SIZE_L2_LOOKUP_PARAMS_ENTRY;
236234
struct sja1105_l2_lookup_params_entry *entry = entry_ptr;

drivers/net/dsa/sja1105/sja1105_static_config.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,4 +430,26 @@ void sja1105_unpack(const void *buf, u64 *val, int start, int end, size_t len);
430430
void sja1105_packing(void *buf, u64 *val, int start, int end,
431431
size_t len, enum packing_op op);
432432

433+
/* Common implementations for the static and dynamic configs */
434+
size_t sja1105pqrs_general_params_entry_packing(void *buf, void *entry_ptr,
435+
enum packing_op op);
436+
size_t sja1105pqrs_l2_lookup_params_entry_packing(void *buf, void *entry_ptr,
437+
enum packing_op op);
438+
size_t sja1105_l2_forwarding_entry_packing(void *buf, void *entry_ptr,
439+
enum packing_op op);
440+
size_t sja1105pqrs_l2_lookup_entry_packing(void *buf, void *entry_ptr,
441+
enum packing_op op);
442+
size_t sja1105et_l2_lookup_entry_packing(void *buf, void *entry_ptr,
443+
enum packing_op op);
444+
size_t sja1105_vlan_lookup_entry_packing(void *buf, void *entry_ptr,
445+
enum packing_op op);
446+
size_t sja1105_retagging_entry_packing(void *buf, void *entry_ptr,
447+
enum packing_op op);
448+
size_t sja1105pqrs_mac_config_entry_packing(void *buf, void *entry_ptr,
449+
enum packing_op op);
450+
size_t sja1105pqrs_avb_params_entry_packing(void *buf, void *entry_ptr,
451+
enum packing_op op);
452+
size_t sja1105_vl_lookup_entry_packing(void *buf, void *entry_ptr,
453+
enum packing_op op);
454+
433455
#endif

0 commit comments

Comments
 (0)