enum sparx5_port_max_tags {
SPX5_PORT_MAX_TAGS_NONE, /* No extra tags allowed */
SPX5_PORT_MAX_TAGS_ONE, /* Single tag allowed */
SPX5_PORT_MAX_TAGS_TWO /* Single and double tag allowed */
};
enum sparx5_vlan_port_type {
SPX5_VLAN_PORT_TYPE_UNAWARE, /* VLAN unaware port */
SPX5_VLAN_PORT_TYPE_C, /* C-port */
SPX5_VLAN_PORT_TYPE_S, /* S-port */
SPX5_VLAN_PORT_TYPE_S_CUSTOM /* S-port using custom type */
};
/* This is used in calendar configuration */ enum sparx5_cal_bw {
SPX5_CAL_SPEED_NONE = 0,
SPX5_CAL_SPEED_1G = 1,
SPX5_CAL_SPEED_2G5 = 2,
SPX5_CAL_SPEED_5G = 3,
SPX5_CAL_SPEED_10G = 4,
SPX5_CAL_SPEED_25G = 5,
SPX5_CAL_SPEED_0G5 = 6,
SPX5_CAL_SPEED_12G5 = 7
};
#define SPX5_PORTS 65 #define SPX5_PORTS_ALL 70 /* Total number of ports */
#define SPX5_PORT_CPU_0 0 /* CPU Port 0 */ #define SPX5_PORT_CPU_1 1 /* CPU Port 1 */ #define SPX5_PORT_VD0 2 /* VD0/Port used for IPMC */ #define SPX5_PORT_VD1 3 /* VD1/Port used for AFI/OAM */ #define SPX5_PORT_VD2 4 /* VD2/Port used for IPinIP*/
/* Frame DMA receive state: * For each DB, there is a SKB, and the skb data pointer is mapped in * the DB. Once a frame is received the skb is given to the upper layers * and a new skb is added to the dcb. * When the db_index reached FDMA_RX_DCB_MAX_DBS the DB is reused.
*/ struct sparx5_rx { struct fdma fdma; struct page_pool *page_pool; union { struct sk_buff *skb[FDMA_DCB_MAX][FDMA_RX_DCB_MAX_DBS]; struct page *page[FDMA_DCB_MAX][FDMA_RX_DCB_MAX_DBS];
};
dma_addr_t dma; struct napi_struct napi; struct net_device *ndev;
u64 packets;
u8 page_order;
};
/* Used to store information about TX buffers. */ struct sparx5_tx_buf { struct net_device *dev; struct sk_buff *skb;
dma_addr_t dma_addr; bool used; bool ptp;
};
/* Frame DMA transmit state: * DCBs are chained using the DCBs nextptr field.
*/ struct sparx5_tx { struct fdma fdma; struct sparx5_tx_buf *dbs;
u64 packets;
u64 dropped;
};
struct sparx5_consts {
u32 n_ports; /* Number of front ports */
u32 n_ports_all; /* Number of front ports + internal ports */
u32 n_hsch_l1_elems; /* Number of HSCH layer 1 elements */
u32 n_hsch_queues; /* Number of HSCH queues */
u32 n_lb_groups; /* Number of leacky bucket groupd */
u32 n_pgids; /* Number of PGID's */
u32 n_sio_clks; /* Number of serial IO clocks */
u32 n_own_upsids; /* Number of own UPSID's */
u32 n_auto_cals; /* Number of auto calendars */
u32 n_filters; /* Number of PSFP filters */
u32 n_gates; /* Number of PSFP gates */
u32 n_sdlbs; /* Number of service dual leaky buckets */
u32 n_dsm_cal_taxis; /* Number of DSM calendar taxis */
u32 buf_size; /* Amount of QLIM watermark memory */
u32 qres_max_prio_idx; /* Maximum QRES prio index */
u32 qres_max_colour_idx; /* Maximum QRES colour index */
u32 tod_pin; /* PTP TOD pin */ conststruct sparx5_vcap_inst *vcaps_cfg; conststruct vcap_info *vcaps; conststruct vcap_statistics *vcap_stats;
};
u32 sparx5_pool_idx_to_id(u32 idx); int sparx5_pool_put(struct sparx5_pool_entry *pool, int size, u32 id); int sparx5_pool_get(struct sparx5_pool_entry *pool, int size, u32 *id); int sparx5_pool_get_with_idx(struct sparx5_pool_entry *pool, int size, u32 idx,
u32 *id);
/* sparx5_port.c */ int sparx5_port_mux_set(struct sparx5 *sparx5, struct sparx5_port *port, struct sparx5_port_config *conf); int sparx5_get_internal_port(struct sparx5 *sparx5, int port);
/* Calculate raw offset */ staticinline __pure int spx5_offset(int id, int tinst, int tcnt, int gbase, int ginst, int gcnt, int gwidth, int raddr, int rinst, int rcnt, int rwidth)
{
WARN_ON((tinst) >= tcnt);
WARN_ON((ginst) >= gcnt);
WARN_ON((rinst) >= rcnt); return gbase + ((ginst) * gwidth) +
raddr + ((rinst) * rwidth);
}
/* Read, Write and modify registers content. * The register definition macros start at the id
*/ staticinlinevoid __iomem *spx5_addr(void __iomem *base[], int id, int tinst, int tcnt, int gbase, int ginst, int gcnt, int gwidth, int raddr, int rinst, int rcnt, int rwidth)
{
WARN_ON((tinst) >= tcnt);
WARN_ON((ginst) >= gcnt);
WARN_ON((rinst) >= rcnt); return base[id + (tinst)] +
gbase + ((ginst) * gwidth) +
raddr + ((rinst) * rwidth);
}
staticinlinevoid __iomem *spx5_inst_addr(void __iomem *base, int gbase, int ginst, int gcnt, int gwidth, int raddr, int rinst, int rcnt, int rwidth)
{
WARN_ON((ginst) >= gcnt);
WARN_ON((rinst) >= rcnt); return base +
gbase + ((ginst) * gwidth) +
raddr + ((rinst) * rwidth);
}
staticinline u32 spx5_rd(struct sparx5 *sparx5, int id, int tinst, int tcnt, int gbase, int ginst, int gcnt, int gwidth, int raddr, int rinst, int rcnt, int rwidth)
{ return readl(spx5_addr(sparx5->regs, id, tinst, tcnt, gbase, ginst,
gcnt, gwidth, raddr, rinst, rcnt, rwidth));
}
staticinline u32 spx5_inst_rd(void __iomem *iomem, int id, int tinst, int tcnt, int gbase, int ginst, int gcnt, int gwidth, int raddr, int rinst, int rcnt, int rwidth)
{ return readl(spx5_inst_addr(iomem, gbase, ginst,
gcnt, gwidth, raddr, rinst, rcnt, rwidth));
}
staticinlinevoid spx5_wr(u32 val, struct sparx5 *sparx5, int id, int tinst, int tcnt, int gbase, int ginst, int gcnt, int gwidth, int raddr, int rinst, int rcnt, int rwidth)
{
writel(val, spx5_addr(sparx5->regs, id, tinst, tcnt,
gbase, ginst, gcnt, gwidth,
raddr, rinst, rcnt, rwidth));
}
staticinlinevoid spx5_inst_wr(u32 val, void __iomem *iomem, int id, int tinst, int tcnt, int gbase, int ginst, int gcnt, int gwidth, int raddr, int rinst, int rcnt, int rwidth)
{
writel(val, spx5_inst_addr(iomem,
gbase, ginst, gcnt, gwidth,
raddr, rinst, rcnt, rwidth));
}
staticinlinevoid spx5_rmw(u32 val, u32 mask, struct sparx5 *sparx5, int id, int tinst, int tcnt, int gbase, int ginst, int gcnt, int gwidth, int raddr, int rinst, int rcnt, int rwidth)
{
u32 nval;
staticinlinevoid spx5_inst_rmw(u32 val, u32 mask, void __iomem *iomem, int id, int tinst, int tcnt, int gbase, int ginst, int gcnt, int gwidth, int raddr, int rinst, int rcnt, int rwidth)
{
u32 nval;
staticinlinevoid __iomem *spx5_inst_get(struct sparx5 *sparx5, int id, int tinst)
{ return sparx5->regs[id + tinst];
}
staticinlinevoid __iomem *spx5_reg_get(struct sparx5 *sparx5, int id, int tinst, int tcnt, int gbase, int ginst, int gcnt, int gwidth, int raddr, int rinst, int rcnt, int rwidth)
{ return spx5_addr(sparx5->regs, id, tinst, tcnt,
gbase, ginst, gcnt, gwidth,
raddr, rinst, rcnt, rwidth);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.