@@ -386,7 +386,7 @@ static int rswitch_gwca_queue_format(struct net_device *ndev,
386386 rswitch_desc_set_dptr (& desc -> desc , gq -> ring_dma );
387387 desc -> desc .die_dt = DT_LINKFIX ;
388388
389- linkfix = & priv -> linkfix_table [gq -> index ];
389+ linkfix = & priv -> gwca . linkfix_table [gq -> index ];
390390 linkfix -> die_dt = DT_LINKFIX ;
391391 rswitch_desc_set_dptr (linkfix , gq -> ring_dma );
392392
@@ -470,7 +470,7 @@ static int rswitch_gwca_queue_ext_ts_format(struct net_device *ndev,
470470 rswitch_desc_set_dptr (& desc -> desc , gq -> ring_dma );
471471 desc -> desc .die_dt = DT_LINKFIX ;
472472
473- linkfix = & priv -> linkfix_table [gq -> index ];
473+ linkfix = & priv -> gwca . linkfix_table [gq -> index ];
474474 linkfix -> die_dt = DT_LINKFIX ;
475475 rswitch_desc_set_dptr (linkfix , gq -> ring_dma );
476476
@@ -480,28 +480,31 @@ static int rswitch_gwca_queue_ext_ts_format(struct net_device *ndev,
480480 return 0 ;
481481}
482482
483- static int rswitch_gwca_desc_alloc (struct rswitch_private * priv )
483+ static int rswitch_gwca_linkfix_alloc (struct rswitch_private * priv )
484484{
485485 int i , num_queues = priv -> gwca .num_queues ;
486+ struct rswitch_gwca * gwca = & priv -> gwca ;
486487 struct device * dev = & priv -> pdev -> dev ;
487488
488- priv -> linkfix_table_size = sizeof (struct rswitch_desc ) * num_queues ;
489- priv -> linkfix_table = dma_alloc_coherent (dev , priv -> linkfix_table_size ,
490- & priv -> linkfix_table_dma , GFP_KERNEL );
491- if (!priv -> linkfix_table )
489+ gwca -> linkfix_table_size = sizeof (struct rswitch_desc ) * num_queues ;
490+ gwca -> linkfix_table = dma_alloc_coherent (dev , gwca -> linkfix_table_size ,
491+ & gwca -> linkfix_table_dma , GFP_KERNEL );
492+ if (!gwca -> linkfix_table )
492493 return - ENOMEM ;
493494 for (i = 0 ; i < num_queues ; i ++ )
494- priv -> linkfix_table [i ].die_dt = DT_EOS ;
495+ gwca -> linkfix_table [i ].die_dt = DT_EOS ;
495496
496497 return 0 ;
497498}
498499
499- static void rswitch_gwca_desc_free (struct rswitch_private * priv )
500+ static void rswitch_gwca_linkfix_free (struct rswitch_private * priv )
500501{
501- if (priv -> linkfix_table )
502- dma_free_coherent (& priv -> pdev -> dev , priv -> linkfix_table_size ,
503- priv -> linkfix_table , priv -> linkfix_table_dma );
504- priv -> linkfix_table = NULL ;
502+ struct rswitch_gwca * gwca = & priv -> gwca ;
503+
504+ if (gwca -> linkfix_table )
505+ dma_free_coherent (& priv -> pdev -> dev , gwca -> linkfix_table_size ,
506+ gwca -> linkfix_table , gwca -> linkfix_table_dma );
507+ gwca -> linkfix_table = NULL ;
505508}
506509
507510static struct rswitch_gwca_queue * rswitch_gwca_get (struct rswitch_private * priv )
@@ -617,8 +620,8 @@ static int rswitch_gwca_hw_init(struct rswitch_private *priv)
617620
618621 iowrite32 (GWVCC_VEM_SC_TAG , priv -> addr + GWVCC );
619622 iowrite32 (0 , priv -> addr + GWTTFC );
620- iowrite32 (lower_32_bits (priv -> linkfix_table_dma ), priv -> addr + GWDCBAC1 );
621- iowrite32 (upper_32_bits (priv -> linkfix_table_dma ), priv -> addr + GWDCBAC0 );
623+ iowrite32 (lower_32_bits (priv -> gwca . linkfix_table_dma ), priv -> addr + GWDCBAC1 );
624+ iowrite32 (upper_32_bits (priv -> gwca . linkfix_table_dma ), priv -> addr + GWDCBAC0 );
622625 rswitch_gwca_set_rate_limit (priv , priv -> gwca .speed );
623626
624627 for (i = 0 ; i < RSWITCH_NUM_PORTS ; i ++ ) {
@@ -1650,7 +1653,7 @@ static int rswitch_init(struct rswitch_private *priv)
16501653 if (err < 0 )
16511654 return err ;
16521655
1653- err = rswitch_gwca_desc_alloc (priv );
1656+ err = rswitch_gwca_linkfix_alloc (priv );
16541657 if (err < 0 )
16551658 return - ENOMEM ;
16561659
@@ -1712,7 +1715,7 @@ static int rswitch_init(struct rswitch_private *priv)
17121715 rswitch_device_free (priv , i );
17131716
17141717err_device_alloc :
1715- rswitch_gwca_desc_free (priv );
1718+ rswitch_gwca_linkfix_free (priv );
17161719
17171720 return err ;
17181721}
@@ -1791,7 +1794,7 @@ static void rswitch_deinit(struct rswitch_private *priv)
17911794 rswitch_device_free (priv , i );
17921795 }
17931796
1794- rswitch_gwca_desc_free (priv );
1797+ rswitch_gwca_linkfix_free (priv );
17951798
17961799 rswitch_clock_disable (priv );
17971800}
0 commit comments