|
root / base / usr / src / cmd / fm / eversholt / files / common / nic.esc
nic.esc Plain Text 128 lines 5.2 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 * This file and its contents are supplied under the terms of the
 * Common Development and Distribution License ("CDDL"), version 1.0.
 * You may only use this file in accordance with the terms of version
 * 1.0 of the CDDL.
 *
 * A full copy of the text of the CDDL should have accompanied this
 * source.  A copy of the CDDL is also available via the Internet at
 * http://www.illumos.org/license/CDDL.
 */
/*
 * Copyright 2020, the University of Queensland
 */

#pragma dictionary "NIC"

/*
 * Rules for the generic NIC (non-driver-specific) fault events.
 */

/*
 * Transceiver events are emitted by drivers under ereport.io.nic.txr-err.
 *
 * These are emitted with detector = the PCI/PCIex function of the NIC.
 * They must always have a string property "error", set to one of the
 * generic transceiver fault type names (notsupp, whitelist, overtemp etc).
 *
 * As well as "error", they must have both the "port_index" and "txr_index"
 * properties set in the event payload (both integer types).
 *
 * It is expected that drivers will call ddi_fm_service_impact() immediately
 * after noticing a transceiver error, with an argument of DDI_SERVICE_LOST or
 * DDI_SERVICE_DEGRADED (depending on the specific error -- at time of writing
 * all the supported events expect DDI_SERVICE_LOST).
 */

asru pcifn;
fru  pcifn/port/transceiver;

asru pciexfn;
fru  pciexfn/port/transceiver;

#define	EV_DECL_TXR_FAULT(TYPE)		\
	event fault.io.nic.transceiver.TYPE@pcifn/port/transceiver \
	    FRU=pcifn/port/transceiver, ASRU=pcifn; \
	event fault.io.nic.transceiver.TYPE@pciexfn/port/transceiver \
	    FRU=pciexfn/port/transceiver, ASRU=pciexfn;

EV_DECL_TXR_FAULT(notsupp)
EV_DECL_TXR_FAULT(whitelist)
EV_DECL_TXR_FAULT(overtemp)
EV_DECL_TXR_FAULT(hwfail)
EV_DECL_TXR_FAULT(unknown)

event ereport.io.nic.txr-err@pcifn;
event ereport.io.service.lost@pcifn;

event ereport.io.nic.txr-err@pciexfn;
event ereport.io.service.lost@pciexfn;

#define	EV_PROP_TXR_FAULT(TYPE)		\
	prop fault.io.nic.transceiver.TYPE@pcifn/port[pn]/transceiver[tn] (2) -> \
	    ereport.io.nic.txr-err@pcifn { \
	      payloadprop("txr_index") == tn && \
	      payloadprop("port_index") == pn && \
	      payloadprop("error") == "TYPE" && \
	      setpayloadprop("txr_index", tn) && \
	      setpayloadprop("link-name", confprop(pcifn/port[pn], "link-name")) && \
	      setpayloadprop("primary-mac-address", confprop(pcifn/port[pn], "primary-mac-address")) && \
	      (!confprop_defined(pcifn/port[pn]/transceiver[tn], "vendor") || \
	       setpayloadprop("vendor", confprop(pcifn/port[pn]/transceiver[tn], "vendor"))) \
	    }, \
	    ereport.io.service.lost@pcifn { within(1s) }; \
	prop fault.io.nic.transceiver.TYPE@pciexfn/port[pn]/transceiver[tn] (2) -> \
	    ereport.io.nic.txr-err@pciexfn { \
	      payloadprop("txr_index") == tn && \
	      payloadprop("port_index") == pn && \
	      payloadprop("error") == "TYPE" && \
	      setpayloadprop("txr_index", tn) && \
	      setpayloadprop("link-name", confprop(pciexfn/port[pn], "link-name")) && \
	      setpayloadprop("primary-mac-address", confprop(pciexfn/port[pn], "primary-mac-address")) && \
	      (!confprop_defined(pciexfn/port[pn]/transceiver[tn], "vendor") || \
	       setpayloadprop("vendor", confprop(pciexfn/port[pn]/transceiver[tn], "vendor"))) \
	    }, \
	    ereport.io.service.lost@pciexfn { within(1s) };

EV_PROP_TXR_FAULT(notsupp)
EV_PROP_TXR_FAULT(whitelist)
EV_PROP_TXR_FAULT(overtemp)
EV_PROP_TXR_FAULT(hwfail)
EV_PROP_TXR_FAULT(unknown)

/*
 * Allow drivers (e.g. i40e) which can't tell the difference between the events
 * notsupp/unknown/whitelist to generate a single ereport covering all 3.
 *
 * If transceiver information is available in topo, we will turn it into
 * a "notsupp" fault. If it isn't, we'll turn it into an "unknown" fault
 * instead. The text in "notsupp" explicitly notes that certain drivers might
 * have difficulty telling the difference between it and "whitelist".
 *
 * If you want this for a pcifn driver rather than pciexfn, you'll have to
 * make another copy.
 */
prop fault.io.nic.transceiver.notsupp@pciexfn/port[pn]/transceiver[tn] (2) ->
    ereport.io.nic.txr-err@pciexfn {
      payloadprop("txr_index") == tn &&
      payloadprop("port_index") == pn &&
      payloadprop("error") == "notsupp/unknown" &&
      confprop_defined(pciexfn/port[pn]/transceiver[tn], "vendor") &&
      setpayloadprop("txr_index", tn) &&
      setpayloadprop("link-name", confprop(pciexfn/port[pn], "link-name")) &&
      setpayloadprop("primary-mac-address", confprop(pciexfn/port[pn], "primary-mac-address")) &&
      setpayloadprop("vendor", confprop(pciexfn/port[pn]/transceiver[tn], "vendor"))
    },
    ereport.io.service.lost@pciexfn { within(1s) };
prop fault.io.nic.transceiver.unknown@pciexfn/port[pn]/transceiver[tn] (2) ->
    ereport.io.nic.txr-err@pciexfn {
      payloadprop("txr_index") == tn &&
      payloadprop("port_index") == pn &&
      payloadprop("error") == "notsupp/unknown" &&
      !confprop_defined(pciexfn/port[pn]/transceiver[tn], "vendor") &&
      setpayloadprop("txr_index", tn) &&
      setpayloadprop("link-name", confprop(pciexfn/port[pn], "link-name")) &&
      setpayloadprop("primary-mac-address", confprop(pciexfn/port[pn], "primary-mac-address"))
    },
    ereport.io.service.lost@pciexfn { within(1s) };