@@ -150,6 +150,7 @@ bool QatAccel::init(const std::string &alg) {
150150}
151151
152152int QatAccel::compress (const bufferlist &in, bufferlist &out, std::optional<int32_t > &compressor_message) {
153+ dout (20 ) << " QAT compress" << dendl;
153154 auto s = get_session (); // get a session from the pool
154155 if (!s) {
155156 return -1 ; // session initialization failed
@@ -165,7 +166,15 @@ int QatAccel::compress(const bufferlist &in, bufferlist &out, std::optional<int3
165166
166167 bufferptr ptr = buffer::create_small_page_aligned (out_len);
167168 unsigned char * c_out = (unsigned char *)ptr.c_str () + begin;
168- int rc = qzCompress (session.get (), c_in, &len, c_out, &out_len, 1 );
169+ QzSession_T *sess = session.get ();
170+ int rc = qzCompress (sess, c_in, &len, c_out, &out_len, 1 );
171+ if (sess->hw_session_stat != QZ_OK) {
172+ if (sess->hw_session_stat == QZ_NO_HW) {
173+ dout (1 ) << " QAT compressor NOT OK - Using SW: No QAT HW detected" << dendl;
174+ } else {
175+ dout (1 ) << " QAT compressor NOT OK - session state=" << sess->hw_session_stat << dendl;
176+ }
177+ }
169178 if (rc != QZ_OK)
170179 return -1 ;
171180 if (begin) {
@@ -190,6 +199,7 @@ int QatAccel::decompress(bufferlist::const_iterator &p,
190199 size_t compressed_len,
191200 bufferlist &dst,
192201 std::optional<int32_t > compressor_message) {
202+ dout (20 ) << " QAT decompress" << dendl;
193203 auto s = get_session (); // get a session from the pool
194204 if (!s) {
195205 return -1 ; // session initialization failed
@@ -219,7 +229,15 @@ int QatAccel::decompress(bufferlist::const_iterator &p,
219229 }
220230
221231 ptr = buffer::create_small_page_aligned (out_len);
222- rc = qzDecompress (session.get (), (const unsigned char *)c_in, &len_current, (unsigned char *)ptr.c_str (), &out_len);
232+ QzSession_T *sess = session.get ();
233+ rc = qzDecompress (sess, (const unsigned char *)c_in, &len_current, (unsigned char *)ptr.c_str (), &out_len);
234+ if (sess->hw_session_stat != QZ_OK) {
235+ if (sess->hw_session_stat == QZ_NO_HW) {
236+ dout (1 ) << " QAT decompress NOT OK - Using SW: No QAT HW detected" << dendl;
237+ } else {
238+ dout (1 ) << " QAT decompress NOT OK - session state=" << sess->hw_session_stat << dendl;
239+ }
240+ }
223241 ratio_idx++;
224242 } while (rc == QZ_BUF_ERROR && ratio_idx < std::size (expansion_ratio));
225243 c_in += len_current;
0 commit comments