@@ -1163,6 +1163,12 @@ mpi3mr_revalidate_factsdata(struct mpi3mr_ioc *mrioc)
11631163 return - EPERM ;
11641164 }
11651165
1166+ if (mrioc -> shost -> max_sectors != (mrioc -> facts .max_data_length / 512 ))
1167+ ioc_err (mrioc , "Warning: The maximum data transfer length\n"
1168+ "\tchanged after reset: previous(%d), new(%d),\n"
1169+ "the driver cannot change this at run time\n" ,
1170+ mrioc -> shost -> max_sectors * 512 , mrioc -> facts .max_data_length );
1171+
11661172 if ((mrioc -> sas_transport_enabled ) && (mrioc -> facts .ioc_capabilities &
11671173 MPI3_IOCFACTS_CAPABILITY_MULTIPATH_ENABLED ))
11681174 ioc_err (mrioc ,
@@ -2343,8 +2349,8 @@ static int mpi3mr_sync_timestamp(struct mpi3mr_ioc *mrioc)
23432349 ioc_err (mrioc , "Issue IOUCTL time_stamp: command timed out\n" );
23442350 mrioc -> init_cmds .is_waiting = 0 ;
23452351 if (!(mrioc -> init_cmds .state & MPI3MR_CMD_RESET ))
2346- mpi3mr_soft_reset_handler (mrioc ,
2347- MPI3MR_RESET_FROM_TSU_TIMEOUT , 1 );
2352+ mpi3mr_check_rh_fault_ioc (mrioc ,
2353+ MPI3MR_RESET_FROM_TSU_TIMEOUT );
23482354 retval = -1 ;
23492355 goto out_unlock ;
23502356 }
@@ -2856,6 +2862,7 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc,
28562862 le16_to_cpu (facts_data -> max_pcie_switches );
28572863 mrioc -> facts .max_sasexpanders =
28582864 le16_to_cpu (facts_data -> max_sas_expanders );
2865+ mrioc -> facts .max_data_length = le16_to_cpu (facts_data -> max_data_length );
28592866 mrioc -> facts .max_sasinitiators =
28602867 le16_to_cpu (facts_data -> max_sas_initiators );
28612868 mrioc -> facts .max_enclosures = le16_to_cpu (facts_data -> max_enclosures );
@@ -2893,13 +2900,18 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc,
28932900 mrioc -> facts .io_throttle_high =
28942901 le16_to_cpu (facts_data -> io_throttle_high );
28952902
2903+ if (mrioc -> facts .max_data_length ==
2904+ MPI3_IOCFACTS_MAX_DATA_LENGTH_NOT_REPORTED )
2905+ mrioc -> facts .max_data_length = MPI3MR_DEFAULT_MAX_IO_SIZE ;
2906+ else
2907+ mrioc -> facts .max_data_length *= MPI3MR_PAGE_SIZE_4K ;
28962908 /* Store in 512b block count */
28972909 if (mrioc -> facts .io_throttle_data_length )
28982910 mrioc -> io_throttle_data_length =
28992911 (mrioc -> facts .io_throttle_data_length * 2 * 4 );
29002912 else
29012913 /* set the length to 1MB + 1K to disable throttle */
2902- mrioc -> io_throttle_data_length = MPI3MR_MAX_SECTORS + 2 ;
2914+ mrioc -> io_throttle_data_length = ( mrioc -> facts . max_data_length / 512 ) + 2 ;
29032915
29042916 mrioc -> io_throttle_high = (mrioc -> facts .io_throttle_high * 2 * 1024 );
29052917 mrioc -> io_throttle_low = (mrioc -> facts .io_throttle_low * 2 * 1024 );
@@ -2914,9 +2926,9 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc,
29142926 ioc_info (mrioc , "SGEModMask 0x%x SGEModVal 0x%x SGEModShift 0x%x " ,
29152927 mrioc -> facts .sge_mod_mask , mrioc -> facts .sge_mod_value ,
29162928 mrioc -> facts .sge_mod_shift );
2917- ioc_info (mrioc , "DMA mask %d InitialPE status 0x%x\n" ,
2929+ ioc_info (mrioc , "DMA mask %d InitialPE status 0x%x max_data_len (%d) \n" ,
29182930 mrioc -> facts .dma_mask , (facts_flags &
2919- MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK ));
2931+ MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK ), mrioc -> facts . max_data_length );
29202932 ioc_info (mrioc ,
29212933 "max_dev_per_throttle_group(%d), max_throttle_groups(%d)\n" ,
29222934 mrioc -> facts .max_dev_per_tg , mrioc -> facts .max_io_throttle_group );
@@ -3359,8 +3371,8 @@ int mpi3mr_process_event_ack(struct mpi3mr_ioc *mrioc, u8 event,
33593371 if (!(mrioc -> init_cmds .state & MPI3MR_CMD_COMPLETE )) {
33603372 ioc_err (mrioc , "Issue EvtNotify: command timed out\n" );
33613373 if (!(mrioc -> init_cmds .state & MPI3MR_CMD_RESET ))
3362- mpi3mr_soft_reset_handler (mrioc ,
3363- MPI3MR_RESET_FROM_EVTACK_TIMEOUT , 1 );
3374+ mpi3mr_check_rh_fault_ioc (mrioc ,
3375+ MPI3MR_RESET_FROM_EVTACK_TIMEOUT );
33643376 retval = -1 ;
33653377 goto out_unlock ;
33663378 }
@@ -3414,7 +3426,14 @@ static int mpi3mr_alloc_chain_bufs(struct mpi3mr_ioc *mrioc)
34143426 if (!mrioc -> chain_sgl_list )
34153427 goto out_failed ;
34163428
3417- sz = MPI3MR_PAGE_SIZE_4K ;
3429+ if (mrioc -> max_sgl_entries > (mrioc -> facts .max_data_length /
3430+ MPI3MR_PAGE_SIZE_4K ))
3431+ mrioc -> max_sgl_entries = mrioc -> facts .max_data_length /
3432+ MPI3MR_PAGE_SIZE_4K ;
3433+ sz = mrioc -> max_sgl_entries * sizeof (struct mpi3_sge_common );
3434+ ioc_info (mrioc , "number of sgl entries=%d chain buffer size=%dKB\n" ,
3435+ mrioc -> max_sgl_entries , sz /1024 );
3436+
34183437 mrioc -> chain_buf_pool = dma_pool_create ("chain_buf pool" ,
34193438 & mrioc -> pdev -> dev , sz , 16 , 0 );
34203439 if (!mrioc -> chain_buf_pool ) {
@@ -3813,7 +3832,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
38133832 }
38143833
38153834 mrioc -> max_host_ios = mrioc -> facts .max_reqs - MPI3MR_INTERNAL_CMDS_RESVD ;
3816-
3835+ mrioc -> shost -> max_sectors = mrioc -> facts . max_data_length / 512 ;
38173836 mrioc -> num_io_throttle_group = mrioc -> facts .max_io_throttle_group ;
38183837 atomic_set (& mrioc -> pend_large_data_sz , 0 );
38193838
0 commit comments