@@ -21,7 +21,7 @@ static void fxgmac_read_mac_addr(struct fxgmac_pdata *pdata)
2121 struct net_device * netdev = pdata -> netdev ;
2222 struct fxgmac_hw_ops * hw_ops = & pdata -> hw_ops ;
2323
24- DPRINTK ("read mac from eFuse\n" );
24+ /* DPRINTK("read mac from eFuse\n"); */
2525
2626 /* if efuse have mac addr, use it.if not, use static mac address. */
2727 hw_ops -> read_mac_subsys_from_efuse (pdata , pdata -> mac_addr , NULL , NULL );
@@ -35,10 +35,10 @@ static void fxgmac_default_config(struct fxgmac_pdata *pdata)
3535{
3636 pdata -> tx_osp_mode = DMA_OSP_ENABLE ;
3737 pdata -> tx_sf_mode = MTL_TSF_ENABLE ;
38- pdata -> rx_sf_mode = MTL_RSF_DISABLE ; /* MTL_RSF_DISABLE 20210514 */
38+ pdata -> rx_sf_mode = MTL_RSF_ENABLE ; /* MTL_RSF_DISABLE 20210514 */
3939 pdata -> pblx8 = DMA_PBL_X8_ENABLE ; /* DMA_PBL_X8_ENABLE 20210514 */
40- pdata -> tx_pbl = DMA_PBL_32 ;
41- pdata -> rx_pbl = DMA_PBL_32 ; /* DMA_PBL_32 20210514 */
40+ pdata -> tx_pbl = DMA_PBL_16 ;
41+ pdata -> rx_pbl = DMA_PBL_4 ; /* DMA_PBL_32 20210514 */
4242 pdata -> tx_threshold = MTL_TX_THRESHOLD_128 ;
4343 pdata -> rx_threshold = MTL_RX_THRESHOLD_128 ;
4444 pdata -> tx_pause = 1 ;
@@ -66,16 +66,16 @@ static void fxgmac_default_config(struct fxgmac_pdata *pdata)
6666 strscpy (pdata -> drv_name , FXGMAC_DRV_NAME , sizeof (pdata -> drv_name ));
6767 strscpy (pdata -> drv_ver , FXGMAC_DRV_VERSION , sizeof (pdata -> drv_ver ));
6868
69- printk ( "FXGMAC_DRV_NAME:%s, FXGMAC_DRV_VERSION:%s\n" , FXGMAC_DRV_NAME ,
70- FXGMAC_DRV_VERSION );
69+ dev_info ( pdata -> dev , "FXGMAC_DRV_NAME:%s, FXGMAC_DRV_VERSION:%s\n" ,
70+ FXGMAC_DRV_NAME , FXGMAC_DRV_VERSION );
7171}
7272
7373static void fxgmac_init_all_ops (struct fxgmac_pdata * pdata )
7474{
7575 fxgmac_init_desc_ops (& pdata -> desc_ops );
7676 fxgmac_init_hw_ops (& pdata -> hw_ops );
7777
78- DPRINTK ("register desc_ops and hw ops\n" );
78+ /* DPRINTK("register desc_ops and hw ops\n"); */
7979}
8080
8181int fxgmac_init (struct fxgmac_pdata * pdata , bool save_private_reg )
@@ -152,17 +152,11 @@ int fxgmac_init(struct fxgmac_pdata *pdata, bool save_private_reg)
152152 pdata -> hw_feat .tx_q_cnt );
153153 pdata -> tx_q_count = pdata -> tx_ring_count ;
154154
155- #if !(FXGMAC_NUM_OF_TX_Q_USED )
156155 ret = netif_set_real_num_tx_queues (netdev , pdata -> tx_q_count );
157- #else
158- ret = netif_set_real_num_tx_queues (
159- netdev , FXGMAC_NUM_OF_TX_Q_USED /*pdata->tx_q_count*/ );
160- #endif
161156
162157 DPRINTK ("num_online_cpus:%u, tx_ch_cnt:%u, tx_q_cnt:%u, tx_ring_count:%u\n" ,
163158 num_online_cpus (), pdata -> hw_feat .tx_ch_cnt ,
164159 pdata -> hw_feat .tx_q_cnt , pdata -> tx_ring_count );
165-
166160 if (ret ) {
167161 dev_err (pdata -> dev , "error setting real tx queue count\n" );
168162 return ret ;
@@ -192,7 +186,7 @@ int fxgmac_init(struct fxgmac_pdata *pdata, bool save_private_reg)
192186 netif_get_num_default_rss_queues (), pdata -> hw_feat .rx_ch_cnt ,
193187 pdata -> hw_feat .rx_q_cnt , pdata -> rx_ring_count );
194188 DPRINTK ("channel_count:%u, netdev tx channel_num=%u\n" ,
195- pdata -> channel_count , netdev -> num_tx_queues );
189+ pdata -> channel_count , netdev -> real_num_tx_queues );
196190
197191 /* Initialize RSS hash key and lookup table */
198192#if FXGMAC_RSS_HASH_KEY_LINUX
@@ -306,6 +300,8 @@ int fxgmac_init(struct fxgmac_pdata *pdata, bool save_private_reg)
306300 pdata -> rx_usecs = FXGMAC_INIT_DMA_RX_USECS ;
307301 pdata -> rx_frames = FXGMAC_INIT_DMA_RX_FRAMES ;
308302
303+ mutex_init (& pdata -> expansion .mutex );
304+
309305 DPRINTK ("fxgmac_init callout, ok.\n" );
310306
311307 return 0 ;
@@ -320,14 +316,14 @@ static void fxgmac_init_interrupt_scheme(struct fxgmac_pdata *pdata)
320316 * otherwise, just roll back to legacy
321317 */
322318 vectors = num_online_cpus ();
323- DPRINTK ("num of cpu=%d\n" , vectors );
324319 if (vectors >= FXGMAC_MAX_DMA_CHANNELS ) {
325320 /* 0-3 for rx, 4 for tx, 5 for phy */
326321 req_vectors = FXGMAC_MSIX_INT_NUMS ;
327322 pdata -> expansion .msix_entries = kcalloc (
328323 req_vectors , sizeof (struct msix_entry ), GFP_KERNEL );
329324 if (!pdata -> expansion .msix_entries ) {
330- DPRINTK ("MSIx, kcalloc err for msix entries, rollback to MSI..\n" );
325+ dev_err (pdata -> dev , "MSIx, kcalloc err for msix entries, \
326+ rollback to MSI\n" );
331327 goto enable_msi_interrupt ;
332328 } else {
333329 for (i = 0 ; i < req_vectors ; i ++ )
@@ -337,14 +333,14 @@ static void fxgmac_init_interrupt_scheme(struct fxgmac_pdata *pdata)
337333 pdata -> pdev , pdata -> expansion .msix_entries ,
338334 req_vectors , req_vectors );
339335 if (rc < 0 ) {
340- DPRINTK ( "enable MSIx failed,%d.\n" , rc );
336+ dev_err ( pdata -> dev , "enable MSIx failed,%d.\n" , rc );
341337 req_vectors = 0 ; /* indicate failure */
342338 } else {
343339 req_vectors = rc ;
344340 }
345341
346342 if (req_vectors >= FXGMAC_MAX_DMA_CHANNELS_PLUS_1TX ) {
347- DPRINTK ( "enable MSIx ok, cpu=%d, vectors=%d.\n" ,
343+ dev_info ( pdata -> dev , "enable MSIx ok, cpu=%d,vectors=%d.\n" ,
348344 vectors , req_vectors );
349345 pdata -> expansion .int_flags =
350346 FXGMAC_SET_REG_BITS (
@@ -353,21 +349,22 @@ static void fxgmac_init_interrupt_scheme(struct fxgmac_pdata *pdata)
353349 FXGMAC_FLAG_INTERRUPT_LEN ,
354350 FXGMAC_FLAG_MSIX_ENABLED );
355351 pdata -> per_channel_irq = 1 ;
356- pdata -> expansion .phy_irq =
352+ pdata -> expansion .misc_irq =
357353 pdata -> expansion
358354 .msix_entries [MSI_ID_PHY_OTHER ]
359355 .vector ;
360356 return ;
361357 } else if (req_vectors ) {
362- DPRINTK ("enable MSIx with only %d vector, while we need %d, rollback to MSI.\n" ,
363- req_vectors , vectors );
358+ dev_err (pdata -> dev , "enable MSIx with only %d vector, \
359+ + while we need %d, rollback to MSI.\n" ,
360+ + req_vectors , vectors );
364361 /* roll back to msi */
365362 pci_disable_msix (pdata -> pdev );
366363 kfree (pdata -> expansion .msix_entries );
367364 pdata -> expansion .msix_entries = NULL ;
368365 req_vectors = 0 ;
369366 } else {
370- DPRINTK ( "enable MSIx failure and clear msix entries.\n" );
367+ dev_err ( pdata -> dev , "enable MSIx failure and clear msix entries.\n" );
371368 /* roll back to msi */
372369 kfree (pdata -> expansion .msix_entries );
373370 pdata -> expansion .msix_entries = NULL ;
@@ -382,13 +379,13 @@ static void fxgmac_init_interrupt_scheme(struct fxgmac_pdata *pdata)
382379 pdata -> expansion .int_flags = FXGMAC_SET_REG_BITS (
383380 pdata -> expansion .int_flags , FXGMAC_FLAG_INTERRUPT_POS ,
384381 FXGMAC_FLAG_INTERRUPT_LEN , FXGMAC_FLAG_LEGACY_ENABLED );
385- DPRINTK ( "enable MSI failure, rollback to LEGACY.\n" );
382+ dev_err ( pdata -> dev , "dev_err MSI failure, rollback to LEGACY.\n" );
386383 } else {
387384 pdata -> expansion .int_flags = FXGMAC_SET_REG_BITS (
388385 pdata -> expansion .int_flags , FXGMAC_FLAG_INTERRUPT_POS ,
389386 FXGMAC_FLAG_INTERRUPT_LEN , FXGMAC_FLAG_MSI_ENABLED );
390387 pdata -> dev_irq = pdata -> pdev -> irq ;
391- DPRINTK ( "enable MSI ok, irq=%d.\n" , pdata -> pdev -> irq );
388+ dev_info ( pdata -> dev , "enable MSI ok, cpu=%d, irq=%d.\n" , vectors , pdata -> pdev -> irq );
392389 }
393390#else
394391 pdata = pdata ;
@@ -417,20 +414,16 @@ int fxgmac_drv_probe(struct device *dev, struct fxgmac_resources *res)
417414 pdata -> netdev = netdev ;
418415
419416 pdata -> dev_irq = res -> irq ;
420-
417+ pdata -> msg_enable = NETIF_MSG_DRV ;
418+ pdata -> expansion .dev_state = FXGMAC_DEV_PROBE ;
421419 /* default to legacy interrupt */
422420 pdata -> expansion .int_flags = FXGMAC_SET_REG_BITS (
423421 pdata -> expansion .int_flags , FXGMAC_FLAG_INTERRUPT_POS ,
424422 FXGMAC_FLAG_INTERRUPT_LEN , FXGMAC_FLAG_LEGACY_ENABLED );
425- pdata -> expansion .phy_irq = pdata -> dev_irq ;
423+ pdata -> expansion .misc_irq = pdata -> dev_irq ;
426424
427425 fxgmac_init_interrupt_scheme (pdata );
428426
429- pdata -> expansion .current_state = CURRENT_STATE_INIT ;
430-
431- pdata -> msg_enable = NETIF_MSG_DRV ;
432- DPRINTK ("netif msg_enable init to %08x\n" , pdata -> msg_enable );
433-
434427 pdata -> mac_regs = res -> addr ;
435428 pdata -> base_mem = res -> addr ;
436429 pdata -> mac_regs = pdata -> mac_regs + FUXI_MAC_REGS_OFFSET ;
@@ -451,7 +444,7 @@ int fxgmac_drv_probe(struct device *dev, struct fxgmac_resources *res)
451444 }
452445 if (netif_msg_drv (pdata ))
453446 DPRINTK ("fxgamc_drv_prob callout, netdev num_tx_q=%u\n" ,
454- netdev -> num_tx_queues );
447+ netdev -> real_num_tx_queues );
455448
456449#ifdef HAVE_FXGMAC_DEBUG_FS
457450 fxgmac_dbg_init (pdata );
@@ -715,7 +708,7 @@ void fxgmac_get_all_hw_features(struct fxgmac_pdata *pdata)
715708 hw_feat -> tc_cnt ++ ;
716709
717710 hw_feat -> hwfr3 = mac_hfr3 ;
718- DPRINTK ("HWFR3: %u\n" , mac_hfr3 );
711+ /* DPRINTK("HWFR3: %u\n", mac_hfr3); */
719712}
720713
721714void fxgmac_print_all_hw_features (struct fxgmac_pdata * pdata )
0 commit comments