@@ -77,10 +77,6 @@ module_param(apst_secondary_latency_tol_us, ulong, 0644);
77
77
MODULE_PARM_DESC (apst_secondary_latency_tol_us ,
78
78
"secondary APST latency tolerance in us" );
79
79
80
- static bool streams ;
81
- module_param (streams , bool , 0644 );
82
- MODULE_PARM_DESC (streams , "turn on support for Streams write directives" );
83
-
84
80
/*
85
81
* nvme_wq - hosts nvme related works that are not reset or delete
86
82
* nvme_reset_wq - hosts nvme reset works
@@ -748,108 +744,6 @@ bool __nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
748
744
}
749
745
EXPORT_SYMBOL_GPL (__nvme_check_ready );
750
746
751
- static int nvme_toggle_streams (struct nvme_ctrl * ctrl , bool enable )
752
- {
753
- struct nvme_command c = { };
754
-
755
- c .directive .opcode = nvme_admin_directive_send ;
756
- c .directive .nsid = cpu_to_le32 (NVME_NSID_ALL );
757
- c .directive .doper = NVME_DIR_SND_ID_OP_ENABLE ;
758
- c .directive .dtype = NVME_DIR_IDENTIFY ;
759
- c .directive .tdtype = NVME_DIR_STREAMS ;
760
- c .directive .endir = enable ? NVME_DIR_ENDIR : 0 ;
761
-
762
- return nvme_submit_sync_cmd (ctrl -> admin_q , & c , NULL , 0 );
763
- }
764
-
765
- static int nvme_disable_streams (struct nvme_ctrl * ctrl )
766
- {
767
- return nvme_toggle_streams (ctrl , false);
768
- }
769
-
770
- static int nvme_enable_streams (struct nvme_ctrl * ctrl )
771
- {
772
- return nvme_toggle_streams (ctrl , true);
773
- }
774
-
775
- static int nvme_get_stream_params (struct nvme_ctrl * ctrl ,
776
- struct streams_directive_params * s , u32 nsid )
777
- {
778
- struct nvme_command c = { };
779
-
780
- memset (s , 0 , sizeof (* s ));
781
-
782
- c .directive .opcode = nvme_admin_directive_recv ;
783
- c .directive .nsid = cpu_to_le32 (nsid );
784
- c .directive .numd = cpu_to_le32 (nvme_bytes_to_numd (sizeof (* s )));
785
- c .directive .doper = NVME_DIR_RCV_ST_OP_PARAM ;
786
- c .directive .dtype = NVME_DIR_STREAMS ;
787
-
788
- return nvme_submit_sync_cmd (ctrl -> admin_q , & c , s , sizeof (* s ));
789
- }
790
-
791
- static int nvme_configure_directives (struct nvme_ctrl * ctrl )
792
- {
793
- struct streams_directive_params s ;
794
- u16 nssa ;
795
- int ret ;
796
-
797
- if (!(ctrl -> oacs & NVME_CTRL_OACS_DIRECTIVES ))
798
- return 0 ;
799
- if (!streams )
800
- return 0 ;
801
-
802
- ret = nvme_enable_streams (ctrl );
803
- if (ret )
804
- return ret ;
805
-
806
- ret = nvme_get_stream_params (ctrl , & s , NVME_NSID_ALL );
807
- if (ret )
808
- goto out_disable_stream ;
809
-
810
- nssa = le16_to_cpu (s .nssa );
811
- if (nssa < BLK_MAX_WRITE_HINTS - 1 ) {
812
- dev_info (ctrl -> device , "too few streams (%u) available\n" ,
813
- nssa );
814
- /* this condition is not an error: streams are optional */
815
- ret = 0 ;
816
- goto out_disable_stream ;
817
- }
818
-
819
- ctrl -> nr_streams = min_t (u16 , nssa , BLK_MAX_WRITE_HINTS - 1 );
820
- dev_info (ctrl -> device , "Using %u streams\n" , ctrl -> nr_streams );
821
- return 0 ;
822
-
823
- out_disable_stream :
824
- nvme_disable_streams (ctrl );
825
- return ret ;
826
- }
827
-
828
- /*
829
- * Check if 'req' has a write hint associated with it. If it does, assign
830
- * a valid namespace stream to the write.
831
- */
832
- static void nvme_assign_write_stream (struct nvme_ctrl * ctrl ,
833
- struct request * req , u16 * control ,
834
- u32 * dsmgmt )
835
- {
836
- enum rw_hint streamid = req -> write_hint ;
837
-
838
- if (streamid == WRITE_LIFE_NOT_SET || streamid == WRITE_LIFE_NONE )
839
- streamid = 0 ;
840
- else {
841
- streamid -- ;
842
- if (WARN_ON_ONCE (streamid > ctrl -> nr_streams ))
843
- return ;
844
-
845
- * control |= NVME_RW_DTYPE_STREAMS ;
846
- * dsmgmt |= streamid << 16 ;
847
- }
848
-
849
- if (streamid < ARRAY_SIZE (req -> q -> write_hints ))
850
- req -> q -> write_hints [streamid ] += blk_rq_bytes (req ) >> 9 ;
851
- }
852
-
853
747
static inline void nvme_setup_flush (struct nvme_ns * ns ,
854
748
struct nvme_command * cmnd )
855
749
{
@@ -953,7 +847,6 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
953
847
struct request * req , struct nvme_command * cmnd ,
954
848
enum nvme_opcode op )
955
849
{
956
- struct nvme_ctrl * ctrl = ns -> ctrl ;
957
850
u16 control = 0 ;
958
851
u32 dsmgmt = 0 ;
959
852
@@ -976,9 +869,6 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
976
869
cmnd -> rw .apptag = 0 ;
977
870
cmnd -> rw .appmask = 0 ;
978
871
979
- if (req_op (req ) == REQ_OP_WRITE && ctrl -> nr_streams )
980
- nvme_assign_write_stream (ctrl , req , & control , & dsmgmt );
981
-
982
872
if (ns -> ms ) {
983
873
/*
984
874
* If formated with metadata, the block layer always provides a
@@ -1697,9 +1587,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
1697
1587
return ;
1698
1588
}
1699
1589
1700
- if (ctrl -> nr_streams && ns -> sws && ns -> sgs )
1701
- size *= ns -> sws * ns -> sgs ;
1702
-
1703
1590
BUILD_BUG_ON (PAGE_SIZE / sizeof (struct nvme_dsm_range ) <
1704
1591
NVME_DSM_MAX_RANGES );
1705
1592
@@ -1725,31 +1612,6 @@ static bool nvme_ns_ids_equal(struct nvme_ns_ids *a, struct nvme_ns_ids *b)
1725
1612
a -> csi == b -> csi ;
1726
1613
}
1727
1614
1728
- static int nvme_setup_streams_ns (struct nvme_ctrl * ctrl , struct nvme_ns * ns ,
1729
- u32 * phys_bs , u32 * io_opt )
1730
- {
1731
- struct streams_directive_params s ;
1732
- int ret ;
1733
-
1734
- if (!ctrl -> nr_streams )
1735
- return 0 ;
1736
-
1737
- ret = nvme_get_stream_params (ctrl , & s , ns -> head -> ns_id );
1738
- if (ret )
1739
- return ret ;
1740
-
1741
- ns -> sws = le32_to_cpu (s .sws );
1742
- ns -> sgs = le16_to_cpu (s .sgs );
1743
-
1744
- if (ns -> sws ) {
1745
- * phys_bs = ns -> sws * (1 << ns -> lba_shift );
1746
- if (ns -> sgs )
1747
- * io_opt = * phys_bs * ns -> sgs ;
1748
- }
1749
-
1750
- return 0 ;
1751
- }
1752
-
1753
1615
static void nvme_configure_metadata (struct nvme_ns * ns , struct nvme_id_ns * id )
1754
1616
{
1755
1617
struct nvme_ctrl * ctrl = ns -> ctrl ;
@@ -1841,7 +1703,6 @@ static void nvme_update_disk_info(struct gendisk *disk,
1841
1703
blk_integrity_unregister (disk );
1842
1704
1843
1705
atomic_bs = phys_bs = bs ;
1844
- nvme_setup_streams_ns (ns -> ctrl , ns , & phys_bs , & io_opt );
1845
1706
if (id -> nabo == 0 ) {
1846
1707
/*
1847
1708
* Bit 1 indicates whether NAWUPF is defined for this namespace
@@ -3131,10 +2992,6 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl)
3131
2992
if (ret < 0 )
3132
2993
return ret ;
3133
2994
3134
- ret = nvme_configure_directives (ctrl );
3135
- if (ret < 0 )
3136
- return ret ;
3137
-
3138
2995
ret = nvme_configure_acre (ctrl );
3139
2996
if (ret < 0 )
3140
2997
return ret ;
0 commit comments