On 09/01/18 18:55, Holger Hoffstätte wrote:
than illegal values. Or instead of exposing wrong (string) values just set
them all to 0, which would "fix" the problem as well.
Maybe something like this? Yes, I know it's wrong in many ways, but since
rxe is faking it already we might as well go deeper. :)
At least now the sysfs values are all neat 0s, and the metrics collector -
or more precisely any sysfs reader in general - will not complain about
illegal values any more, so that's a start. Obviously this is not the
desired end state, but IMHO it's a bit less wrong than before.
cheers,
Holger
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index f5b1e0ad..0b2ea0a9 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -1072,6 +1072,17 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd,
return ERR_PTR(err);
}
+int rxe_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port,
+ const struct ib_wc *in_wc, const struct ib_grh *in_grh,
+ const struct ib_mad_hdr *in, size_t in_mad_size,
+ struct ib_mad_hdr *out, size_t *out_mad_size,
+ u16 *out_mad_pkey_index)
+{
+ struct ib_mad *out_mad = (struct ib_mad *)out;
+ memset(out_mad->data, 0, IB_MGMT_MAD_DATA);
+ return (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY);
+}
+
static int rxe_set_page(struct ib_mr *ibmr, u64 addr)
{
struct rxe_mem *mr = to_rmr(ibmr);
@@ -1251,6 +1262,7 @@ int rxe_register_device(struct rxe_dev *rxe)
dev->detach_mcast = rxe_detach_mcast;
dev->get_hw_stats = rxe_ib_get_hw_stats;
dev->alloc_hw_stats = rxe_ib_alloc_hw_stats;
+ dev->process_mad = rxe_ib_process_mad;
tfm = crypto_alloc_shash("crc32", 0, 0);
if (IS_ERR(tfm)) {