Skip to content

Commit a0dd890

Browse files
DanielmachonPaolo Abeni
authored andcommitted
net: sparx5: ops out function for DSM calendar calculation
The DSM (Disassembler) calendar grants each port access to internal busses. The configuration of the calendar is done differently on Sparx5 and lan969x. Therefore ops out the function that calculates the calendar. Reviewed-by: Steen Hegelund <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Signed-off-by: Daniel Machon <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 8c274d6 commit a0dd890

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

drivers/net/ethernet/microchip/sparx5/sparx5_calendar.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
#define SPX5_CALBITS_PER_PORT 3 /* Bit per port in calendar register */
1616

1717
/* DSM calendar information */
18-
#define SPX5_DSM_CAL_LEN 64
1918
#define SPX5_DSM_CAL_EMPTY 0xFFFF
20-
#define SPX5_DSM_CAL_MAX_DEVS_PER_TAXI 13
2119
#define SPX5_DSM_CAL_TAXIS 8
2220
#define SPX5_DSM_CAL_BW_LOSS 553
2321

@@ -37,19 +35,6 @@ static u32 sparx5_taxi_ports[SPX5_DSM_CAL_TAXIS][SPX5_DSM_CAL_MAX_DEVS_PER_TAXI]
3735
{64, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99},
3836
};
3937

40-
struct sparx5_calendar_data {
41-
u32 schedule[SPX5_DSM_CAL_LEN];
42-
u32 avg_dist[SPX5_DSM_CAL_MAX_DEVS_PER_TAXI];
43-
u32 taxi_ports[SPX5_DSM_CAL_MAX_DEVS_PER_TAXI];
44-
u32 taxi_speeds[SPX5_DSM_CAL_MAX_DEVS_PER_TAXI];
45-
u32 dev_slots[SPX5_DSM_CAL_MAX_DEVS_PER_TAXI];
46-
u32 new_slots[SPX5_DSM_CAL_LEN];
47-
u32 temp_sched[SPX5_DSM_CAL_LEN];
48-
u32 indices[SPX5_DSM_CAL_LEN];
49-
u32 short_list[SPX5_DSM_CAL_LEN];
50-
u32 long_list[SPX5_DSM_CAL_LEN];
51-
};
52-
5338
static u32 sparx5_target_bandwidth(struct sparx5 *sparx5)
5439
{
5540
switch (sparx5->target_ct) {
@@ -279,8 +264,8 @@ static u32 sparx5_dsm_cp_cal(u32 *sched)
279264
return SPX5_DSM_CAL_EMPTY;
280265
}
281266

282-
static int sparx5_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi,
283-
struct sparx5_calendar_data *data)
267+
int sparx5_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi,
268+
struct sparx5_calendar_data *data)
284269
{
285270
bool slow_mode;
286271
u32 gcd, idx, sum, min, factor;
@@ -566,6 +551,7 @@ static int sparx5_dsm_calendar_update(struct sparx5 *sparx5, u32 taxi,
566551
/* Configure the DSM calendar based on port configuration */
567552
int sparx5_config_dsm_calendar(struct sparx5 *sparx5)
568553
{
554+
const struct sparx5_ops *ops = sparx5->data->ops;
569555
int taxi;
570556
struct sparx5_calendar_data *data;
571557
int err = 0;
@@ -575,7 +561,7 @@ int sparx5_config_dsm_calendar(struct sparx5 *sparx5)
575561
return -ENOMEM;
576562

577563
for (taxi = 0; taxi < sparx5->data->consts->n_dsm_cal_taxis; ++taxi) {
578-
err = sparx5_dsm_calendar_calc(sparx5, taxi, data);
564+
err = ops->dsm_calendar_calc(sparx5, taxi, data);
579565
if (err) {
580566
dev_err(sparx5->dev, "DSM calendar calculation failed\n");
581567
goto cal_out;

drivers/net/ethernet/microchip/sparx5/sparx5_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,7 @@ static const struct sparx5_ops sparx5_ops = {
995995
.get_sdlb_group = &sparx5_get_sdlb_group,
996996
.set_port_mux = &sparx5_port_mux_set,
997997
.ptp_irq_handler = &sparx5_ptp_irq_handler,
998+
.dsm_calendar_calc = &sparx5_dsm_calendar_calc,
998999
};
9991000

10001001
static const struct sparx5_match_data sparx5_desc = {

drivers/net/ethernet/microchip/sparx5/sparx5_main.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,24 @@ enum sparx5_vlan_port_type {
101101
#define IFH_PDU_TYPE_IPV4_UDP_PTP 0x6
102102
#define IFH_PDU_TYPE_IPV6_UDP_PTP 0x7
103103

104+
#define SPX5_DSM_CAL_LEN 64
105+
#define SPX5_DSM_CAL_MAX_DEVS_PER_TAXI 13
106+
104107
struct sparx5;
105108

109+
struct sparx5_calendar_data {
110+
u32 schedule[SPX5_DSM_CAL_LEN];
111+
u32 avg_dist[SPX5_DSM_CAL_MAX_DEVS_PER_TAXI];
112+
u32 taxi_ports[SPX5_DSM_CAL_MAX_DEVS_PER_TAXI];
113+
u32 taxi_speeds[SPX5_DSM_CAL_MAX_DEVS_PER_TAXI];
114+
u32 dev_slots[SPX5_DSM_CAL_MAX_DEVS_PER_TAXI];
115+
u32 new_slots[SPX5_DSM_CAL_LEN];
116+
u32 temp_sched[SPX5_DSM_CAL_LEN];
117+
u32 indices[SPX5_DSM_CAL_LEN];
118+
u32 short_list[SPX5_DSM_CAL_LEN];
119+
u32 long_list[SPX5_DSM_CAL_LEN];
120+
};
121+
106122
/* Frame DMA receive state:
107123
* For each DB, there is a SKB, and the skb data pointer is mapped in
108124
* the DB. Once a frame is received the skb is given to the upper layers
@@ -271,6 +287,8 @@ struct sparx5_ops {
271287
struct sparx5_port_config *conf);
272288

273289
irqreturn_t (*ptp_irq_handler)(int irq, void *args);
290+
int (*dsm_calendar_calc)(struct sparx5 *sparx5, u32 taxi,
291+
struct sparx5_calendar_data *data);
274292
};
275293

276294
struct sparx5_main_io_resource {
@@ -418,6 +436,9 @@ void sparx5_vlan_port_apply(struct sparx5 *sparx5, struct sparx5_port *port);
418436
/* sparx5_calendar.c */
419437
int sparx5_config_auto_calendar(struct sparx5 *sparx5);
420438
int sparx5_config_dsm_calendar(struct sparx5 *sparx5);
439+
int sparx5_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi,
440+
struct sparx5_calendar_data *data);
441+
421442

422443
/* sparx5_ethtool.c */
423444
void sparx5_get_stats64(struct net_device *ndev, struct rtnl_link_stats64 *stats);

0 commit comments

Comments
 (0)