diff mbox series

[v3,1/3] mgmt: read/set system parameter definitions

Message ID 20200611020157.70230-2-alainm@chromium.org (mailing list archive)
State Accepted
Headers show
Series Support reading and setting default system parameters | expand

Commit Message

Alain Michaud June 11, 2020, 2:01 a.m. UTC
This patch submits the corresponding kernel definitions to mgmt.h.
This is submitted before the implementation to avoid any conflicts in
values allocations.

Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Reviewed-by: Yu Liu <yudiliu@google.com>

Signed-off-by: Alain Michaud <alainm@chromium.org>
---

Changes in v3:
- Fixed sparse errors

Changes in v2:
- Renamed the mgmt.h per Marcel's comments.
- Addressed Marcel's comments in the implementation.

 include/net/bluetooth/mgmt.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

Comments

Marcel Holtmann June 12, 2020, 1:46 p.m. UTC | #1
Hi Alain,

please remember to put Bluetooth: as prefix in the subject. I fixed this up for you.

> This patch submits the corresponding kernel definitions to mgmt.h.
> This is submitted before the implementation to avoid any conflicts in
> values allocations.
> 
> Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> Reviewed-by: Yu Liu <yudiliu@google.com>

Please put these behind your Signed-off-by line. I changed this for you.

> Signed-off-by: Alain Michaud <alainm@chromium.org>
> ---
> 
> Changes in v3:
> - Fixed sparse errors
> 
> Changes in v2:
> - Renamed the mgmt.h per Marcel's comments.
> - Addressed Marcel's comments in the implementation.
> 
> include/net/bluetooth/mgmt.h | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
> 
> diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
> index 16e0d87bd8fa..09452d2ea6d3 100644
> --- a/include/net/bluetooth/mgmt.h
> +++ b/include/net/bluetooth/mgmt.h
> @@ -702,6 +702,36 @@ struct mgmt_rp_set_exp_feature {
> 	__le32 flags;
> } __packed;
> 
> +#define MGMT_OP_READ_DEF_SYSTEM_CONFIG	0x004b
> +
> +struct mgmt_tlv {
> +	__u16 type;

I changed this to __le16 since we developed mgmt as little-endian. I missed this before and fixed this up as well.

> +	__u8  length;
> +	__u8  value[];
> +} __packed;
> +
> +struct mgmt_rp_read_default_system_config {
> +	__u8 parameters[0]; /* mgmt_tlv */

I changed this to params[] to follow recent global style changes. And hmmm, that seems to be not possible with no other values.

./include/net/bluetooth/mgmt.h:714:7: error: flexible array member in a struct with no named members
  714 |  __u8 params[]; /* mgmt_tlv */
      |       ^~~~~~

Maybe we need to leave these structs out since they only contain TLVs anyway.

> +} __packed;
> +
> +#define MGMT_OP_SET_DEF_SYSTEM_CONFIG	0x004c
> +
> +struct mgmt_cp_set_default_system_config {
> +	__u8 parameters[0]; /* mgmt_tlv */
> +} __packed;
> +
> +#define MGMT_OP_READ_DEF_RUNTIME_CONFIG	0x004d
> +
> +struct mgmt_rp_read_default_runtime_config {
> +	__u8 parameters[0]; /* mgmt_tlv */
> +} __packed;
> +
> +#define MGMT_OP_SET_DEF_RUNTIME_CONFIG	0x004e
> +
> +struct mgmt_cp_set_default_runtime_config {
> +	__u8 parameters[0]; /* mgmt_tlv */
> +} __packed;
> +
> #define MGMT_EV_CMD_COMPLETE		0x0001
> struct mgmt_ev_cmd_complete {
> 	__le16	opcode;

Other than that patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 16e0d87bd8fa..09452d2ea6d3 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -702,6 +702,36 @@  struct mgmt_rp_set_exp_feature {
 	__le32 flags;
 } __packed;
 
+#define MGMT_OP_READ_DEF_SYSTEM_CONFIG	0x004b
+
+struct mgmt_tlv {
+	__u16 type;
+	__u8  length;
+	__u8  value[];
+} __packed;
+
+struct mgmt_rp_read_default_system_config {
+	__u8 parameters[0]; /* mgmt_tlv */
+} __packed;
+
+#define MGMT_OP_SET_DEF_SYSTEM_CONFIG	0x004c
+
+struct mgmt_cp_set_default_system_config {
+	__u8 parameters[0]; /* mgmt_tlv */
+} __packed;
+
+#define MGMT_OP_READ_DEF_RUNTIME_CONFIG	0x004d
+
+struct mgmt_rp_read_default_runtime_config {
+	__u8 parameters[0]; /* mgmt_tlv */
+} __packed;
+
+#define MGMT_OP_SET_DEF_RUNTIME_CONFIG	0x004e
+
+struct mgmt_cp_set_default_runtime_config {
+	__u8 parameters[0]; /* mgmt_tlv */
+} __packed;
+
 #define MGMT_EV_CMD_COMPLETE		0x0001
 struct mgmt_ev_cmd_complete {
 	__le16	opcode;