Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: stmmac: move stmmac_fpe_cfg to stmmac_priv data

By moving the fpe_cfg field to the stmmac_priv data, stmmac_fpe_cfg
becomes platform-data eventually, instead of a run-time config.

Suggested-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Furong Xu <0x1207@gmail.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Link: https://patch.msgid.link/d9b3d7ecb308c5e39778a4c8ae9df288a2754379.1725631883.git.0x1207@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Furong Xu and committed by
Jakub Kicinski
070a5e62 525034e2

+44 -52
+2
drivers/net/ethernet/stmicro/stmmac/hwif.h
··· 28 28 struct stmmac_extra_stats; 29 29 struct stmmac_priv; 30 30 struct stmmac_safety_stats; 31 + struct stmmac_fpe_cfg; 32 + enum stmmac_mpacket_type; 31 33 struct dma_desc; 32 34 struct dma_extended_desc; 33 35 struct dma_edesc;
+29 -1
drivers/net/ethernet/stmicro/stmmac/stmmac.h
··· 146 146 u32 index; 147 147 }; 148 148 149 + /* FPE link state */ 150 + enum stmmac_fpe_state { 151 + FPE_STATE_OFF = 0, 152 + FPE_STATE_CAPABLE = 1, 153 + FPE_STATE_ENTERING_ON = 2, 154 + FPE_STATE_ON = 3, 155 + }; 156 + 157 + /* FPE link-partner hand-shaking mPacket type */ 158 + enum stmmac_mpacket_type { 159 + MPACKET_VERIFY = 0, 160 + MPACKET_RESPONSE = 1, 161 + }; 162 + 163 + enum stmmac_fpe_task_state_t { 164 + __FPE_REMOVING, 165 + __FPE_TASK_SCHED, 166 + }; 167 + 168 + struct stmmac_fpe_cfg { 169 + bool enable; /* FPE enable */ 170 + bool hs_enable; /* FPE handshake enable */ 171 + enum stmmac_fpe_state lp_fpe_state; /* Link Partner FPE state */ 172 + enum stmmac_fpe_state lo_fpe_state; /* Local station FPE state */ 173 + u32 fpe_csr; /* MAC_FPE_CTRL_STS reg cache */ 174 + }; 175 + 149 176 struct stmmac_tc_entry { 150 177 bool in_use; 151 178 bool in_hw; ··· 366 339 struct workqueue_struct *wq; 367 340 struct work_struct service_task; 368 341 369 - /* Workqueue for handling FPE hand-shaking */ 342 + /* Frame Preemption feature (FPE) */ 370 343 unsigned long fpe_task_state; 371 344 struct workqueue_struct *fpe_wq; 372 345 struct work_struct fpe_task; 373 346 char wq_name[IFNAMSIZ + 4]; 347 + struct stmmac_fpe_cfg fpe_cfg; 374 348 375 349 /* TC Handling */ 376 350 unsigned int tc_entries_max;
+10 -10
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 968 968 969 969 static void stmmac_fpe_link_state_handle(struct stmmac_priv *priv, bool is_up) 970 970 { 971 - struct stmmac_fpe_cfg *fpe_cfg = priv->plat->fpe_cfg; 971 + struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; 972 972 enum stmmac_fpe_state *lo_state = &fpe_cfg->lo_fpe_state; 973 973 enum stmmac_fpe_state *lp_state = &fpe_cfg->lp_fpe_state; 974 974 bool *hs_enable = &fpe_cfg->hs_enable; ··· 3536 3536 if (priv->dma_cap.fpesel) { 3537 3537 stmmac_fpe_start_wq(priv); 3538 3538 3539 - if (priv->plat->fpe_cfg->enable) 3539 + if (priv->fpe_cfg.enable) 3540 3540 stmmac_fpe_handshake(priv, true); 3541 3541 } 3542 3542 ··· 5982 5982 5983 5983 static void stmmac_fpe_event_status(struct stmmac_priv *priv, int status) 5984 5984 { 5985 - struct stmmac_fpe_cfg *fpe_cfg = priv->plat->fpe_cfg; 5985 + struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; 5986 5986 enum stmmac_fpe_state *lo_state = &fpe_cfg->lo_fpe_state; 5987 5987 enum stmmac_fpe_state *lp_state = &fpe_cfg->lp_fpe_state; 5988 5988 bool *hs_enable = &fpe_cfg->hs_enable; ··· 7381 7381 { 7382 7382 struct stmmac_priv *priv = container_of(work, struct stmmac_priv, 7383 7383 fpe_task); 7384 - struct stmmac_fpe_cfg *fpe_cfg = priv->plat->fpe_cfg; 7384 + struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; 7385 7385 enum stmmac_fpe_state *lo_state = &fpe_cfg->lo_fpe_state; 7386 7386 enum stmmac_fpe_state *lp_state = &fpe_cfg->lp_fpe_state; 7387 7387 bool *hs_enable = &fpe_cfg->hs_enable; ··· 7427 7427 7428 7428 void stmmac_fpe_handshake(struct stmmac_priv *priv, bool enable) 7429 7429 { 7430 - if (priv->plat->fpe_cfg->hs_enable != enable) { 7430 + if (priv->fpe_cfg.hs_enable != enable) { 7431 7431 if (enable) { 7432 7432 stmmac_fpe_send_mpacket(priv, priv->ioaddr, 7433 - priv->plat->fpe_cfg, 7433 + &priv->fpe_cfg, 7434 7434 MPACKET_VERIFY); 7435 7435 } else { 7436 - priv->plat->fpe_cfg->lo_fpe_state = FPE_STATE_OFF; 7437 - priv->plat->fpe_cfg->lp_fpe_state = FPE_STATE_OFF; 7436 + priv->fpe_cfg.lo_fpe_state = FPE_STATE_OFF; 7437 + priv->fpe_cfg.lp_fpe_state = FPE_STATE_OFF; 7438 7438 } 7439 7439 7440 - priv->plat->fpe_cfg->hs_enable = enable; 7440 + priv->fpe_cfg.hs_enable = enable; 7441 7441 } 7442 7442 } 7443 7443 ··· 7898 7898 if (priv->dma_cap.fpesel) { 7899 7899 /* Disable FPE */ 7900 7900 stmmac_fpe_configure(priv, priv->ioaddr, 7901 - priv->plat->fpe_cfg, 7901 + &priv->fpe_cfg, 7902 7902 priv->plat->tx_queues_to_use, 7903 7903 priv->plat->rx_queues_to_use, false); 7904 7904
+3 -13
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
··· 282 282 if (ret) 283 283 return -ENOMEM; 284 284 285 - if (!priv->plat->fpe_cfg) { 286 - priv->plat->fpe_cfg = devm_kzalloc(priv->device, 287 - sizeof(*priv->plat->fpe_cfg), 288 - GFP_KERNEL); 289 - if (!priv->plat->fpe_cfg) 290 - return -ENOMEM; 291 - } else { 292 - memset(priv->plat->fpe_cfg, 0, sizeof(*priv->plat->fpe_cfg)); 293 - } 294 - 295 285 /* Fail silently as we can still use remaining features, e.g. CBS */ 296 286 if (!dma_cap->frpsel) 297 287 return 0; ··· 1066 1076 /* Actual FPE register configuration will be done after FPE handshake 1067 1077 * is success. 1068 1078 */ 1069 - priv->plat->fpe_cfg->enable = fpe; 1079 + priv->fpe_cfg.enable = fpe; 1070 1080 1071 1081 ret = stmmac_est_configure(priv, priv, priv->est, 1072 1082 priv->plat->clk_ptp_rate); ··· 1099 1109 mutex_unlock(&priv->est_lock); 1100 1110 } 1101 1111 1102 - priv->plat->fpe_cfg->enable = false; 1112 + priv->fpe_cfg.enable = false; 1103 1113 stmmac_fpe_configure(priv, priv->ioaddr, 1104 - priv->plat->fpe_cfg, 1114 + &priv->fpe_cfg, 1105 1115 priv->plat->tx_queues_to_use, 1106 1116 priv->plat->rx_queues_to_use, 1107 1117 false);
-28
include/linux/stmmac.h
··· 138 138 int tbs_en; 139 139 }; 140 140 141 - /* FPE link state */ 142 - enum stmmac_fpe_state { 143 - FPE_STATE_OFF = 0, 144 - FPE_STATE_CAPABLE = 1, 145 - FPE_STATE_ENTERING_ON = 2, 146 - FPE_STATE_ON = 3, 147 - }; 148 - 149 - /* FPE link-partner hand-shaking mPacket type */ 150 - enum stmmac_mpacket_type { 151 - MPACKET_VERIFY = 0, 152 - MPACKET_RESPONSE = 1, 153 - }; 154 - 155 - enum stmmac_fpe_task_state_t { 156 - __FPE_REMOVING, 157 - __FPE_TASK_SCHED, 158 - }; 159 - 160 - struct stmmac_fpe_cfg { 161 - bool enable; /* FPE enable */ 162 - bool hs_enable; /* FPE handshake enable */ 163 - enum stmmac_fpe_state lp_fpe_state; /* Link Partner FPE state */ 164 - enum stmmac_fpe_state lo_fpe_state; /* Local station FPE state */ 165 - u32 fpe_csr; /* MAC_FPE_CTRL_STS reg cache */ 166 - }; 167 - 168 141 struct stmmac_safety_feature_cfg { 169 142 u32 tsoee; 170 143 u32 mrxpee; ··· 205 232 struct fwnode_handle *port_node; 206 233 struct device_node *mdio_node; 207 234 struct stmmac_dma_cfg *dma_cfg; 208 - struct stmmac_fpe_cfg *fpe_cfg; 209 235 struct stmmac_safety_feature_cfg *safety_feat_cfg; 210 236 int clk_csr; 211 237 int has_gmac;