The value of 'out_bytes' can descripe the BD state. So not need to
use the marco variable. The BD state is non-zero value when the msg
recived successfully. Otherwise the BD state is zero.
Signed-off-by: Kai Ye <yekai13(a)huawei.com>
---
wd_digest.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/wd_digest.c b/wd_digest.c
index 0d79817..2a65540 100644
--- a/wd_digest.c
+++ b/wd_digest.c
@@ -21,7 +21,6 @@
#define POLL_SIZE 100000
#define POLL_TIME 1000
-#define STREAM_MODE_STATE 1
static int g_digest_mac_len[WD_DIGEST_TYPE_MAX] = {
WD_DIGEST_SM3_LEN, WD_DIGEST_MD5_LEN, WD_DIGEST_SHA1_LEN,
@@ -47,11 +46,8 @@ struct wd_digest_sess {
unsigned char key[MAX_HMAC_KEY_SIZE];
__u32 key_bytes;
void *sched_key;
- /*
- * Notify the BD state, 1 is final BD or middle BD,
- * 0 is normal mode or first BD, one session only supports one stream.
- */
- int state;
+ /* Notify the BD state */
+ int state;
/* Total of data for stream mode */
__u64 long_data_len;
};
@@ -338,8 +334,8 @@ static int send_recv_sync(struct wd_ctx_internal *ctx, struct wd_digest_sess *ds
goto out;
}
}
- if (msg->has_next && msg->result == WD_SUCCESS)
- dsess->state = STREAM_MODE_STATE;
+ if (msg->has_next)
+ dsess->state = msg->out_bytes;
} while (ret < 0);
out:
--
2.33.0