summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-03-11 05:54:43 +0300
committerJakub Kicinski <kuba@kernel.org>2026-03-11 05:54:43 +0300
commit482aac8b56ca21d06c588517970579474d56736e (patch)
tree2ed1beb79083c1e5e06b95ecd829906e8a88d8f4 /include
parent1a6ca6497a40f5c7795575a35f0da7d013b79bdd (diff)
parent315bab9411f3bd3465a47a64a3e44323bfab60be (diff)
downloadlinux-482aac8b56ca21d06c588517970579474d56736e.tar.xz
Merge branch 'net-stmmac-start-to-shrink-memory-usage'
Russell King says: ==================== net: stmmac: start to shrink memory usage Start shrinking stmmac's memory usage by avoiding using "int" for members that are only used for 0/1 (boolean) values, or values that can't be larger than 255. In addition, as struct stmmac_dma_cfg is approximately a cache line, shrinks below a cache line as a result of this patch set, and is required, there is no point separately allocating this from struct plat_stmmacenet_data. Embed it into the end of this struct and set the existing pointer to avoid large wide-spread changes. Lastly, add documentation for struct stmmac_dma_cfg, and document the stmmac clocks as best we can given the driver history. ==================== Link: https://patch.msgid.link/aa6VEsmBK-S9eNYU@shell.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/stmmac.h93
1 files changed, 73 insertions, 20 deletions
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 965ada809fdf..937985276e6b 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -93,52 +93,73 @@ struct stmmac_mdio_bus_data {
};
struct stmmac_dma_cfg {
+ /* pbl: programmable burst limit
+ * txpbl: transmit programmable burst limit
+ * rxpbl: receive programmable burst limit
+ * If txpbl or rxpbl are zero, the value of pbl will be substituted.
+ * Range 0 - 63.
+ */
int pbl;
int txpbl;
int rxpbl;
+ /* pblx8: multiplies pbl, txpbl, rxpbl by a factor of 8 for dwmac >=
+ * 3.50a, or a factor of 4 for previous versions.
+ */
bool pblx8;
+ /* fixed_burst:
+ * when set, AXI bursts defined by axi_blen_regval are permitted.
+ * AHB uses SINGLE, INCR4, INCR8 or INCR16 during burst transfers.
+ * when clear, AXI and AHB use SINGLE or INCR bursts.
+ */
bool fixed_burst;
+ /* mixed_burst:
+ * when set and fixed_burst is clear, AHB uses INCR for bursts > 16
+ * and SINGLE or INCRx for bursts <= 16.
+ */
bool mixed_burst;
+ /* aal: address aligned bursts for AHB and AXI master interface */
bool aal;
+ bool dche;
bool eame;
+ /* multi_msi_en: stmmac core internal */
bool multi_msi_en;
- bool dche;
+ /* atds: stmmac core internal */
bool atds;
};
#define AXI_BLEN 7
struct stmmac_axi {
- bool axi_lpi_en;
- bool axi_xit_frm;
u32 axi_wr_osr_lmt;
u32 axi_rd_osr_lmt;
- bool axi_kbbe;
u32 axi_blen_regval;
+ bool axi_lpi_en;
+ bool axi_xit_frm;
+ bool axi_kbbe;
bool axi_fb;
bool axi_mb;
bool axi_rb;
};
struct stmmac_rxq_cfg {
- u8 mode_to_use;
u32 chan;
+ u32 prio;
+ u8 mode_to_use;
u8 pkt_route;
bool use_prio;
- u32 prio;
};
struct stmmac_txq_cfg {
u32 weight;
- bool coe_unsupported;
- u8 mode_to_use;
/* Credit Base Shaper parameters */
u32 send_slope;
u32 idle_slope;
u32 high_credit;
u32 low_credit;
- bool use_prio;
u32 prio;
int tbs_en;
+ bool use_prio;
+ bool coe_unsupported;
+ u8 mode_to_use;
};
struct stmmac_safety_feature_cfg {
@@ -229,23 +250,23 @@ struct plat_stmmacenet_data {
struct stmmac_dma_cfg *dma_cfg;
struct stmmac_safety_feature_cfg *safety_feat_cfg;
int clk_csr;
- int enh_desc;
- int tx_coe;
+ bool enh_desc;
+ bool tx_coe;
+ bool bugged_jumbo;
+ bool pmt;
+ bool force_sf_dma_mode;
+ bool force_thresh_dma_mode;
+ bool riwt_off;
int rx_coe;
- int bugged_jumbo;
- int pmt;
- int force_sf_dma_mode;
- int force_thresh_dma_mode;
- int riwt_off;
int max_speed;
int maxmtu;
int multicast_filter_bins;
int unicast_filter_entries;
int tx_fifo_size;
int rx_fifo_size;
- u32 host_dma_width;
- u32 rx_queues_to_use;
- u32 tx_queues_to_use;
+ u8 host_dma_width;
+ u8 rx_queues_to_use;
+ u8 tx_queues_to_use;
u8 rx_sched_algorithm;
u8 tx_sched_algorithm;
struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES];
@@ -279,10 +300,41 @@ struct plat_stmmacenet_data {
struct phylink_pcs *(*select_pcs)(struct stmmac_priv *priv,
phy_interface_t interface);
void *bsp_priv;
+
+ /* stmmac clocks:
+ * stmmac_clk: CSR clock (which can be hclk_i, clk_csr_i, aclk_i,
+ * or clk_app_i depending on GMAC configuration). This clock
+ * generates the MDC clock.
+ *
+ * pclk: introduced for Imagination Technologies Pistachio board -
+ * see 5f9755d26fbf ("stmmac: Add an optional register interface
+ * clock"). This is probably used for cases where separate clocks
+ * are provided for the host interface and register interface. In
+ * this case, as the MDC clock is derived from stmmac_clk, pclk
+ * can only really be the "application clock" for the "host
+ * interface" and not the "register interface" aka CSR clock as
+ * it is never used when determining the divider for the MDC
+ * clock.
+ *
+ * clk_ptp_ref: optional PTP reference clock (clk_ptp_ref_i). When
+ * present, this clock increments the timestamp value. Otherwise,
+ * the rate of stmmac_clk will be used.
+ *
+ * clk_tx_i: MAC transmit clock, which will be 2.5MHz for 10M,
+ * 25MHz for 100M, or 125MHz for 1G irrespective of the interface
+ * mode. For the DWMAC PHY interface modes:
+ *
+ * GMII/MII PHY's transmit clock for 10M (2.5MHz) or 100M (25MHz),
+ * or 125MHz local clock for 1G mode
+ * RMII 50MHz RMII clock divided by 2 or 20.
+ * RGMII 125MHz local clock divided by 1, 5, or 50.
+ * SGMII 125MHz SerDes clock divided by 1, 5, or 50.
+ * TBI/RTBI 125MHz SerDes clock
+ */
struct clk *stmmac_clk;
struct clk *pclk;
struct clk *clk_ptp_ref;
- struct clk *clk_tx_i; /* clk_tx_i to MAC core */
+ struct clk *clk_tx_i;
unsigned long clk_ptp_rate;
unsigned long clk_ref_rate;
struct clk_bulk_data *clks;
@@ -306,5 +358,6 @@ struct plat_stmmacenet_data {
int msi_tx_base_vec;
const struct dwmac4_addrs *dwmac4_addrs;
unsigned int flags;
+ struct stmmac_dma_cfg __dma_cfg;
};
#endif