@@ -815,6 +815,7 @@ enum mvpp2_prs_l3_cast {
815
815
#define MVPP22_RSS_TABLE_ENTRIES 32
816
816
817
817
/* BM constants */
818
+ #define MVPP2_BM_JUMBO_BUF_NUM 512
818
819
#define MVPP2_BM_LONG_BUF_NUM 1024
819
820
#define MVPP2_BM_SHORT_BUF_NUM 2048
820
821
#define MVPP2_BM_POOL_SIZE_MAX (16*1024 - MVPP2_BM_POOL_PTR_ALIGN/4)
@@ -826,12 +827,14 @@ enum mvpp2_prs_l3_cast {
826
827
827
828
#define MVPP2_BM_SHORT_FRAME_SIZE 512
828
829
#define MVPP2_BM_LONG_FRAME_SIZE 2048
830
+ #define MVPP2_BM_JUMBO_FRAME_SIZE 10240
829
831
/* BM short pool packet size
830
832
* These value assure that for SWF the total number
831
833
* of bytes allocated for each buffer will be 512
832
834
*/
833
835
#define MVPP2_BM_SHORT_PKT_SIZE MVPP2_RX_MAX_PKT_SIZE(MVPP2_BM_SHORT_FRAME_SIZE)
834
836
#define MVPP2_BM_LONG_PKT_SIZE MVPP2_RX_MAX_PKT_SIZE(MVPP2_BM_LONG_FRAME_SIZE)
837
+ #define MVPP2_BM_JUMBO_PKT_SIZE MVPP2_RX_MAX_PKT_SIZE(MVPP2_BM_JUMBO_FRAME_SIZE)
835
838
836
839
#define MVPP21_ADDR_SPACE_SZ 0
837
840
#define MVPP22_ADDR_SPACE_SZ SZ_64K
@@ -842,6 +845,7 @@ enum mvpp2_prs_l3_cast {
842
845
enum mvpp2_bm_pool_log_num {
843
846
MVPP2_BM_SHORT ,
844
847
MVPP2_BM_LONG ,
848
+ MVPP2_BM_JUMBO ,
845
849
MVPP2_BM_POOLS_NUM
846
850
};
847
851
@@ -4393,6 +4397,10 @@ static void mvpp2_setup_bm_pool(void)
4393
4397
/* Long pool */
4394
4398
mvpp2_pools [MVPP2_BM_LONG ].buf_num = MVPP2_BM_LONG_BUF_NUM ;
4395
4399
mvpp2_pools [MVPP2_BM_LONG ].pkt_size = MVPP2_BM_LONG_PKT_SIZE ;
4400
+
4401
+ /* Jumbo pool */
4402
+ mvpp2_pools [MVPP2_BM_JUMBO ].buf_num = MVPP2_BM_JUMBO_BUF_NUM ;
4403
+ mvpp2_pools [MVPP2_BM_JUMBO ].pkt_size = MVPP2_BM_JUMBO_PKT_SIZE ;
4396
4404
}
4397
4405
4398
4406
/* Attach long pool to rxq */
@@ -4596,28 +4604,41 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, unsigned pool, int pkt_size)
4596
4604
static int mvpp2_swf_bm_pool_init (struct mvpp2_port * port )
4597
4605
{
4598
4606
int rxq ;
4607
+ enum mvpp2_bm_pool_log_num long_log_pool , short_log_pool ;
4608
+
4609
+ /* If port pkt_size is higher than 1518B:
4610
+ * HW Long pool - SW Jumbo pool, HW Short pool - SW Long pool
4611
+ * else: HW Long pool - SW Long pool, HW Short pool - SW Short pool
4612
+ */
4613
+ if (port -> pkt_size > MVPP2_BM_LONG_PKT_SIZE ) {
4614
+ long_log_pool = MVPP2_BM_JUMBO ;
4615
+ short_log_pool = MVPP2_BM_LONG ;
4616
+ } else {
4617
+ long_log_pool = MVPP2_BM_LONG ;
4618
+ short_log_pool = MVPP2_BM_SHORT ;
4619
+ }
4599
4620
4600
4621
if (!port -> pool_long ) {
4601
4622
port -> pool_long =
4602
- mvpp2_bm_pool_use (port , MVPP2_BM_LONG ,
4603
- mvpp2_pools [MVPP2_BM_LONG ].pkt_size );
4623
+ mvpp2_bm_pool_use (port , long_log_pool ,
4624
+ mvpp2_pools [long_log_pool ].pkt_size );
4604
4625
if (!port -> pool_long )
4605
4626
return - ENOMEM ;
4606
4627
4607
- port -> pool_long -> port_map |= ( 1 << port -> id );
4628
+ port -> pool_long -> port_map |= BIT ( port -> id );
4608
4629
4609
4630
for (rxq = 0 ; rxq < port -> nrxqs ; rxq ++ )
4610
4631
mvpp2_rxq_long_pool_set (port , rxq , port -> pool_long -> id );
4611
4632
}
4612
4633
4613
4634
if (!port -> pool_short ) {
4614
4635
port -> pool_short =
4615
- mvpp2_bm_pool_use (port , MVPP2_BM_SHORT ,
4616
- mvpp2_pools [MVPP2_BM_SHORT ].pkt_size );
4636
+ mvpp2_bm_pool_use (port , short_log_pool ,
4637
+ mvpp2_pools [long_log_pool ].pkt_size );
4617
4638
if (!port -> pool_short )
4618
4639
return - ENOMEM ;
4619
4640
4620
- port -> pool_short -> port_map |= ( 1 << port -> id );
4641
+ port -> pool_short -> port_map |= BIT ( port -> id );
4621
4642
4622
4643
for (rxq = 0 ; rxq < port -> nrxqs ; rxq ++ )
4623
4644
mvpp2_rxq_short_pool_set (port , rxq ,
@@ -4630,24 +4651,49 @@ static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port)
4630
4651
static int mvpp2_bm_update_mtu (struct net_device * dev , int mtu )
4631
4652
{
4632
4653
struct mvpp2_port * port = netdev_priv (dev );
4633
- struct mvpp2_bm_pool * port_pool = port -> pool_long ;
4634
- int num , pkts_num = port_pool -> buf_num ;
4654
+ enum mvpp2_bm_pool_log_num new_long_pool ;
4655
+ int pkt_size = MVPP2_RX_PKT_SIZE ( mtu ) ;
4635
4656
4636
- /* Update BM pool with new buffer size */
4637
- mvpp2_bm_bufs_free (dev -> dev .parent , port -> priv , port_pool ,
4638
- port_pool -> buf_num );
4639
- if (port_pool -> buf_num ) {
4640
- WARN (1 , "cannot free all buffers in pool %d\n" , port_pool -> id );
4641
- return - EIO ;
4657
+ /* If port MTU is higher than 1518B:
4658
+ * HW Long pool - SW Jumbo pool, HW Short pool - SW Long pool
4659
+ * else: HW Long pool - SW Long pool, HW Short pool - SW Short pool
4660
+ */
4661
+ if (pkt_size > MVPP2_BM_LONG_PKT_SIZE )
4662
+ new_long_pool = MVPP2_BM_JUMBO ;
4663
+ else
4664
+ new_long_pool = MVPP2_BM_LONG ;
4665
+
4666
+ if (new_long_pool != port -> pool_long -> id ) {
4667
+ /* Remove port from old short & long pool */
4668
+ port -> pool_long = mvpp2_bm_pool_use (port , port -> pool_long -> id ,
4669
+ port -> pool_long -> pkt_size );
4670
+ port -> pool_long -> port_map &= ~BIT (port -> id );
4671
+ port -> pool_long = NULL ;
4672
+
4673
+ port -> pool_short = mvpp2_bm_pool_use (port , port -> pool_short -> id ,
4674
+ port -> pool_short -> pkt_size );
4675
+ port -> pool_short -> port_map &= ~BIT (port -> id );
4676
+ port -> pool_short = NULL ;
4677
+
4678
+ port -> pkt_size = pkt_size ;
4679
+
4680
+ /* Add port to new short & long pool */
4681
+ mvpp2_swf_bm_pool_init (port );
4682
+
4683
+ /* Update L4 checksum when jumbo enable/disable on port */
4684
+ if (new_long_pool == MVPP2_BM_JUMBO && port -> id != 0 ) {
4685
+ dev -> features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM );
4686
+ dev -> hw_features &= ~(NETIF_F_IP_CSUM |
4687
+ NETIF_F_IPV6_CSUM );
4688
+ } else {
4689
+ dev -> features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM ;
4690
+ dev -> hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM ;
4691
+ }
4642
4692
}
4643
4693
4644
- num = mvpp2_bm_bufs_add (port , port_pool , pkts_num );
4645
- if (num != pkts_num ) {
4646
- WARN (1 , "pool %d: %d of %d allocated\n" ,
4647
- port_pool -> id , num , pkts_num );
4648
- return - EIO ;
4649
- }
4650
4694
dev -> mtu = mtu ;
4695
+ dev -> wanted_features = dev -> features ;
4696
+
4651
4697
netdev_update_features (dev );
4652
4698
return 0 ;
4653
4699
}
@@ -8326,13 +8372,19 @@ static int mvpp2_port_probe(struct platform_device *pdev,
8326
8372
dev -> features = features | NETIF_F_RXCSUM ;
8327
8373
dev -> hw_features |= features | NETIF_F_RXCSUM | NETIF_F_GRO |
8328
8374
NETIF_F_HW_VLAN_CTAG_FILTER ;
8375
+
8376
+ if (port -> pool_long -> id == MVPP2_BM_JUMBO && port -> id != 0 ) {
8377
+ dev -> features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM );
8378
+ dev -> hw_features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM );
8379
+ }
8380
+
8329
8381
dev -> vlan_features |= features ;
8330
8382
dev -> gso_max_segs = MVPP2_MAX_TSO_SEGS ;
8331
8383
8332
- /* MTU range: 68 - 9676 */
8384
+ /* MTU range: 68 - 9704 */
8333
8385
dev -> min_mtu = ETH_MIN_MTU ;
8334
- /* 9676 == 9700 - 20 and rounding to 8 */
8335
- dev -> max_mtu = 9676 ;
8386
+ /* 9704 == 9728 - 20 and rounding to 8 */
8387
+ dev -> max_mtu = MVPP2_BM_JUMBO_PKT_SIZE ;
8336
8388
8337
8389
err = register_netdev (dev );
8338
8390
if (err < 0 ) {
0 commit comments