Re: [PATCH net-next RFC 6/7] devlink: Add a boolean generic port parameter

2018-12-05 Thread Jiri Pirko
Wed, Dec 05, 2018 at 06:56:59AM CET, vasundhara-v.vo...@broadcom.com wrote:
>wake-on-lan - Enables Wake on Lan for this port when magic packet
>is received with this port's MAC address using ACPI pattern.
>If enabled, the controller asserts a wake pin upon reception of
>WoL packet.  ACPI (Advanced Configuration and Power Interface)
>is an industry specification for the efficient handling of power
>consumption in desktop and mobile computers.
>
>Cc: Jiri Pirko 
>Signed-off-by: Vasundhara Volam 
>---
> include/net/devlink.h | 17 +
> net/core/devlink.c|  8 +++-
> 2 files changed, 24 insertions(+), 1 deletion(-)
>
>diff --git a/include/net/devlink.h b/include/net/devlink.h
>index abb5b3a..7409076 100644
>--- a/include/net/devlink.h
>+++ b/include/net/devlink.h
>@@ -421,12 +421,29 @@ enum devlink_param_generic_id {
> }
> 
> enum devlink_port_param_generic_id {
>+  DEVLINK_PORT_PARAM_GENERIC_ID_WOL,
>+
>   /* add new param generic ids above here */
>   __DEVLINK_PORT_PARAM_GENERIC_ID_MAX,
>   DEVLINK_PORT_PARAM_GENERIC_ID_MAX =
>  __DEVLINK_PORT_PARAM_GENERIC_ID_MAX - 1,
> };
> 
>+#define DEVLINK_PORT_PARAM_GENERIC_WOL_NAME "wake-on-lan"
>+#define DEVLINK_PORT_PARAM_GENERIC_WOL_TYPE DEVLINK_PARAM_TYPE_BOOL
>+
>+#define DEVLINK_PORT_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate)   
>\
>+{ \
>+  .id = DEVLINK_PORT_PARAM_GENERIC_ID_##_id,  \
>+  .name = DEVLINK_PORT_PARAM_GENERIC_##_id##_NAME,\
>+  .type = DEVLINK_PORT_PARAM_GENERIC_##_id##_TYPE,\
>+  .generic = true,\
>+  .supported_cmodes = _cmodes,\
>+  .get = _get,\
>+  .set = _set,\
>+  .validate = _validate,  \
>+}

Just use DEVLINK_PARAM_GENERIC


>+
> struct devlink_region;
> 
> typedef void devlink_snapshot_data_dest_t(const void *data);
>diff --git a/net/core/devlink.c b/net/core/devlink.c
>index 7598da1..24c2b9e 100644
>--- a/net/core/devlink.c
>+++ b/net/core/devlink.c
>@@ -3210,7 +3210,13 @@ static void devlink_param_unregister_one(struct devlink 
>*devlink,
>   kfree(param_item);
> }
> 
>-static const struct devlink_param devlink_port_param_generic[] = {};
>+static const struct devlink_param devlink_port_param_generic[] = {
>+  {
>+  .id = DEVLINK_PORT_PARAM_GENERIC_ID_WOL,
>+  .name = DEVLINK_PORT_PARAM_GENERIC_WOL_NAME,
>+  .type = DEVLINK_PORT_PARAM_GENERIC_WOL_TYPE,
>+  },
>+};
> 
> static int devlink_port_param_generic_verify(const struct devlink_param 
> *param)
> {
>-- 
>1.8.3.1
>


[PATCH net-next RFC 6/7] devlink: Add a boolean generic port parameter

2018-12-04 Thread Vasundhara Volam
wake-on-lan - Enables Wake on Lan for this port when magic packet
is received with this port's MAC address using ACPI pattern.
If enabled, the controller asserts a wake pin upon reception of
WoL packet.  ACPI (Advanced Configuration and Power Interface)
is an industry specification for the efficient handling of power
consumption in desktop and mobile computers.

Cc: Jiri Pirko 
Signed-off-by: Vasundhara Volam 
---
 include/net/devlink.h | 17 +
 net/core/devlink.c|  8 +++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/include/net/devlink.h b/include/net/devlink.h
index abb5b3a..7409076 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -421,12 +421,29 @@ enum devlink_param_generic_id {
 }
 
 enum devlink_port_param_generic_id {
+   DEVLINK_PORT_PARAM_GENERIC_ID_WOL,
+
/* add new param generic ids above here */
__DEVLINK_PORT_PARAM_GENERIC_ID_MAX,
DEVLINK_PORT_PARAM_GENERIC_ID_MAX =
   __DEVLINK_PORT_PARAM_GENERIC_ID_MAX - 1,
 };
 
+#define DEVLINK_PORT_PARAM_GENERIC_WOL_NAME "wake-on-lan"
+#define DEVLINK_PORT_PARAM_GENERIC_WOL_TYPE DEVLINK_PARAM_TYPE_BOOL
+
+#define DEVLINK_PORT_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate)
\
+{  \
+   .id = DEVLINK_PORT_PARAM_GENERIC_ID_##_id,  \
+   .name = DEVLINK_PORT_PARAM_GENERIC_##_id##_NAME,\
+   .type = DEVLINK_PORT_PARAM_GENERIC_##_id##_TYPE,\
+   .generic = true,\
+   .supported_cmodes = _cmodes,\
+   .get = _get,\
+   .set = _set,\
+   .validate = _validate,  \
+}
+
 struct devlink_region;
 
 typedef void devlink_snapshot_data_dest_t(const void *data);
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 7598da1..24c2b9e 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -3210,7 +3210,13 @@ static void devlink_param_unregister_one(struct devlink 
*devlink,
kfree(param_item);
 }
 
-static const struct devlink_param devlink_port_param_generic[] = {};
+static const struct devlink_param devlink_port_param_generic[] = {
+   {
+   .id = DEVLINK_PORT_PARAM_GENERIC_ID_WOL,
+   .name = DEVLINK_PORT_PARAM_GENERIC_WOL_NAME,
+   .type = DEVLINK_PORT_PARAM_GENERIC_WOL_TYPE,
+   },
+};
 
 static int devlink_port_param_generic_verify(const struct devlink_param *param)
 {
-- 
1.8.3.1