Add a statistic for TLS record decryption errors.
Since devices are supposed to pass records as-is when they
encounter errors this statistic will count bad records in
both pure software and inline crypto configurations.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
 
 - ``TlsTxDevice``, ``TlsRxDevice`` -
   number of TX and RX sessions opened with NIC cryptography
+
+- ``TlsDecryptError`` -
+  record decryption failed (e.g. due to incorrect authentication tag)
 
        LINUX_MIB_TLSRXSW,                      /* TlsRxSw */
        LINUX_MIB_TLSTXDEVICE,                  /* TlsTxDevice */
        LINUX_MIB_TLSRXDEVICE,                  /* TlsRxDevice */
+       LINUX_MIB_TLSDECRYPTERROR,              /* TlsDecryptError */
        __LINUX_MIB_TLSMAX
 };
 
 
        SNMP_MIB_ITEM("TlsRxSw", LINUX_MIB_TLSRXSW),
        SNMP_MIB_ITEM("TlsTxDevice", LINUX_MIB_TLSTXDEVICE),
        SNMP_MIB_ITEM("TlsRxDevice", LINUX_MIB_TLSRXDEVICE),
+       SNMP_MIB_ITEM("TlsDecryptError", LINUX_MIB_TLSDECRYPTERROR),
        SNMP_MIB_SENTINEL
 };
 
 
 
        /* Propagate if there was an err */
        if (err) {
+               if (err == -EBADMSG)
+                       TLS_INC_STATS(sock_net(skb->sk),
+                                     LINUX_MIB_TLSDECRYPTERROR);
                ctx->async_wait.err = err;
                tls_err_abort(skb->sk, err);
        } else {
                        return ret;
 
                ret = crypto_wait_req(ret, &ctx->async_wait);
+       } else if (ret == -EBADMSG) {
+               TLS_INC_STATS(sock_net(sk), LINUX_MIB_TLSDECRYPTERROR);
        }
 
        if (async)