diff options
author | 2020-11-06 02:45:47 +0000 | |
---|---|---|
committer | 2020-11-06 02:45:47 +0000 | |
commit | df120b826899b0c39919c8e988e26f8afe26b12e (patch) | |
tree | 49abef7382706d804a5d00e2b124fd51c8e5e9bf | |
parent | Make sure IPsec flows are loaded with srcid/dstid attributes. (diff) | |
download | wireguard-openbsd-df120b826899b0c39919c8e988e26f8afe26b12e.tar.xz wireguard-openbsd-df120b826899b0c39919c8e988e26f8afe26b12e.zip |
Bail out early if the port type is not Ethernet, rather than failing later
on in the attach process with a useless error message.
tested on a ConnectX-6 card in infiniband mode by Nilson Lopes
ok dlg@
-rw-r--r-- | sys/dev/pci/if_mcx.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/pci/if_mcx.c b/sys/dev/pci/if_mcx.c index b2b949b7547..b6aea6093cf 100644 --- a/sys/dev/pci/if_mcx.c +++ b/sys/dev/pci/if_mcx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mcx.c,v 1.73 2020/10/28 07:09:37 jmatthew Exp $ */ +/* $OpenBSD: if_mcx.c,v 1.74 2020/11/06 02:45:47 jmatthew Exp $ */ /* * Copyright (c) 2017 David Gwynne <dlg@openbsd.org> @@ -839,6 +839,7 @@ struct mcx_cap_device { #define MCX_CAP_DEVICE_PORT_MODULE_EVENT \ 0x80 #define MCX_CAP_DEVICE_PORT_TYPE 0x03 +#define MCX_CAP_DEVICE_PORT_TYPE_ETH 0x01 uint8_t num_ports; uint8_t snapshot_log_max_msg; @@ -3768,6 +3769,12 @@ mcx_hca_max_caps(struct mcx_softc *sc) mb = mcx_cq_mbox(&mxm, 0); hca = mcx_cq_mbox_data(mb); + if ((hca->port_type & MCX_CAP_DEVICE_PORT_TYPE) + != MCX_CAP_DEVICE_PORT_TYPE_ETH) { + printf(", not in ethernet mode\n"); + error = -1; + goto free; + } if (hca->log_pg_sz > PAGE_SHIFT) { printf(", minimum system page shift %u is too large\n", hca->log_pg_sz); |