[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1454496482-13961-4-git-send-email-jiri@resnulli.us>
Date: Wed, 3 Feb 2016 11:47:59 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, idosch@...lanox.com, eladr@...lanox.com,
yotamg@...lanox.com, ogerlitz@...lanox.com, yishaih@...lanox.com,
dledford@...hat.com, sean.hefty@...el.com,
hal.rosenstock@...il.com, eugenia@...lanox.com,
roopa@...ulusnetworks.com, nikolay@...ulusnetworks.com,
hadarh@...lanox.com, jhs@...atatu.com, john.fastabend@...il.com,
jeffrey.t.kirsher@...el.com, jbenc@...hat.com
Subject: [patch net-next RFC 3/6] mlxsw: Implement hardware messages notification using devlink
From: Jiri Pirko <jiri@...lanox.com>
Use devlink HW message notification facilities to pass massages going
to and from HW to userspace via Netlink multicast.
Signed-off-by: Jiri Pirko <jiri@...lanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/core.c | 15 +++++++++++----
include/uapi/linux/devlink.h | 2 +-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
index 57d9655..da4e6c9 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -65,6 +65,7 @@
#include "trap.h"
#include "emad.h"
#include "reg.h"
+#include "txheader.h"
static LIST_HEAD(mlxsw_core_driver_list);
static DEFINE_SPINLOCK(mlxsw_core_driver_list_lock);
@@ -1099,7 +1100,11 @@ static int mlxsw_core_reg_access_emad(struct mlxsw_core *mlxsw_core,
dev_dbg(mlxsw_core->bus_info->dev, "EMAD send (tid=%llx)\n",
mlxsw_core->emad.tid);
- mlxsw_core_buf_dump_dbg(mlxsw_core, skb->data, skb->len);
+ devlink_hwmsg_notify(priv_to_devlink(mlxsw_core),
+ skb->data + MLXSW_TXHDR_LEN,
+ skb->len - MLXSW_TXHDR_LEN,
+ DEVLINK_HWMSG_TYPE_MLX_EMAD,
+ DEVLINK_HWMSG_DIR_TO_HW, GFP_KERNEL);
err = mlxsw_emad_transmit(mlxsw_core, skb, &tx_info);
if (!err) {
@@ -1109,9 +1114,11 @@ static int mlxsw_core_reg_access_emad(struct mlxsw_core *mlxsw_core,
dev_dbg(mlxsw_core->bus_info->dev, "EMAD recv (tid=%llx)\n",
mlxsw_core->emad.tid - 1);
- mlxsw_core_buf_dump_dbg(mlxsw_core,
- mlxsw_core->emad.resp_skb->data,
- mlxsw_core->emad.resp_skb->len);
+ devlink_hwmsg_notify(priv_to_devlink(mlxsw_core),
+ mlxsw_core->emad.resp_skb->data,
+ mlxsw_core->emad.resp_skb->len,
+ DEVLINK_HWMSG_TYPE_MLX_EMAD,
+ DEVLINK_HWMSG_DIR_FROM_HW, GFP_KERNEL);
dev_kfree_skb(mlxsw_core->emad.resp_skb);
}
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 1d9f999..761612b 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -40,7 +40,7 @@ enum devlink_command {
};
enum devlink_hwmsg_type {
- DEVLINK_HWMSG_TYPE_TMP, /* temporary, until first message type is introduced */
+ DEVLINK_HWMSG_TYPE_MLX_EMAD, /* Mellanox EMAD packet */
};
enum devlink_hwmsg_dir {
--
1.9.3
Powered by blists - more mailing lists