crypto: chelsio - Reset counters on cxgb4 Detach
authorHarsh Jain <harsh@chelsio.com>
Tue, 11 Dec 2018 10:51:41 +0000 (16:21 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sun, 23 Dec 2018 03:52:43 +0000 (11:52 +0800)
Reset the counters on receiving detach from Cxgb4.

Signed-off-by: Atul Gupta <atul.gupta@chelsio.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/chelsio/chcr_core.c

index f71a9793941849eab9d392391d7b6454c7362b7d..e04b3e8fa62341a0e5c66de4d19acd4eab81e195 100644 (file)
@@ -132,6 +132,8 @@ static void chcr_dev_init(struct uld_ctx *u_ctx)
 
 static int chcr_dev_move(struct uld_ctx *u_ctx)
 {
+       struct adapter *adap;
+
         mutex_lock(&drv_data.drv_mutex);
        if (drv_data.last_dev == u_ctx) {
                if (list_is_last(&drv_data.last_dev->entry, &drv_data.act_dev))
@@ -144,6 +146,8 @@ static int chcr_dev_move(struct uld_ctx *u_ctx)
        list_move(&u_ctx->entry, &drv_data.inact_dev);
        if (list_empty(&drv_data.act_dev))
                drv_data.last_dev = NULL;
+       adap = padap(&u_ctx->dev);
+       memset(&adap->chcr_stats, 0, sizeof(adap->chcr_stats));
        atomic_dec(&drv_data.dev_count);
        mutex_unlock(&drv_data.drv_mutex);