net/sfc/base: add CTPIO statistics
[dpdk.git] / drivers / net / sfc / base / mcdi_mon.c
index 8ea4216..940bd02 100644 (file)
@@ -1,31 +1,7 @@
-/*
- * Copyright (c) 2009-2016 Solarflare Communications Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
+/* SPDX-License-Identifier: BSD-3-Clause
  *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are
- * those of the authors and should not be interpreted as representing official
- * policies, either expressed or implied, of the FreeBSD Project.
+ * Copyright (c) 2009-2018 Solarflare Communications Inc.
+ * All rights reserved.
  */
 
 #include "efx.h"
@@ -159,6 +135,10 @@ static const struct mcdi_sensor_map_s {
        STAT(Px, BOARD_BACK_TEMP),      /* 0x50 BOARD_BACK_TEMP */
        STAT(Px, I1V8),                 /* 0x51 IN_I1V8 */
        STAT(Px, I2V5),                 /* 0x52 IN_I2V5 */
+       STAT(Px, I3V3),                 /* 0x53 IN_I3V3 */
+       STAT(Px, I12V0),                /* 0x54 IN_I12V0 */
+       STAT(Px, 1_3V),                 /* 0x55 IN_1V3 */
+       STAT(Px, I1V3),                 /* 0x56 IN_I1V3 */
 };
 
 #define        MCDI_STATIC_SENSOR_ASSERT(_field)                               \
@@ -396,6 +376,11 @@ efx_mcdi_sensor_info(
 
        EFSYS_ASSERT(sensor_maskp != NULL);
 
+       if (npages < 1) {
+               rc = EINVAL;
+               goto fail1;
+       }
+
        for (page = 0; page < npages; page++) {
                uint32_t mask;
 
@@ -412,7 +397,7 @@ efx_mcdi_sensor_info(
 
                if (req.emr_rc != 0) {
                        rc = req.emr_rc;
-                       goto fail1;
+                       goto fail2;
                }
 
                mask = MCDI_OUT_DWORD(req, SENSOR_INFO_OUT_MASK);
@@ -420,18 +405,20 @@ efx_mcdi_sensor_info(
                if ((page != (npages - 1)) &&
                    ((mask & (1U << MC_CMD_SENSOR_PAGE0_NEXT)) == 0)) {
                        rc = EINVAL;
-                       goto fail2;
+                       goto fail3;
                }
                sensor_maskp[page] = mask;
        }
 
        if (sensor_maskp[npages - 1] & (1U << MC_CMD_SENSOR_PAGE0_NEXT)) {
                rc = EINVAL;
-               goto fail3;
+               goto fail4;
        }
 
        return (0);
 
+fail4:
+       EFSYS_PROBE(fail4);
 fail3:
        EFSYS_PROBE(fail3);
 fail2:
@@ -493,6 +480,11 @@ mcdi_mon_cfg_build(
        case EFX_FAMILY_MEDFORD:
                encp->enc_mon_type = EFX_MON_SFC92X0;
                break;
+#endif
+#if EFSYS_OPT_MEDFORD2
+       case EFX_FAMILY_MEDFORD2:
+               encp->enc_mon_type = EFX_MON_SFC92X0;
+               break;
 #endif
        default:
                rc = EINVAL;