Commit ca1d16a0 authored by Raja Mani's avatar Raja Mani Committed by Kalle Valo

ath6kl: Avoid taking struct as argument in ath6kl_wmi_set_ip_cmd

In this way, caller is free to pass only the value of IP addr
to configure.

In addition to this,
  * 'ips' variable data type in struct wmi_set_ip_cmd is changed
     from __le32 to __be32 in order to match network byte order.
  *  ipv4_is_multicast() is used to validate multicast ip addr.
  *  New argument if_idx is added to supply correct vif index
     to ath6kl_wmi_cmd_send().

This will be used in the next patch.
Signed-off-by: default avatarRaja Mani <rmani@qca.qualcomm.com>
Signed-off-by: default avatarThirumalai Pachamuthu <tpachamu@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 6e786cb1
...@@ -2479,15 +2479,16 @@ int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class, ...@@ -2479,15 +2479,16 @@ int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class,
return ret; return ret;
} }
int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, struct wmi_set_ip_cmd *ip_cmd) int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, u8 if_idx,
__be32 ips0, __be32 ips1)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct wmi_set_ip_cmd *cmd; struct wmi_set_ip_cmd *cmd;
int ret; int ret;
/* Multicast address are not valid */ /* Multicast address are not valid */
if ((*((u8 *) &ip_cmd->ips[0]) >= 0xE0) || if (ipv4_is_multicast(ips0) ||
(*((u8 *) &ip_cmd->ips[1]) >= 0xE0)) ipv4_is_multicast(ips1))
return -EINVAL; return -EINVAL;
skb = ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_ip_cmd)); skb = ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_ip_cmd));
...@@ -2495,9 +2496,10 @@ int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, struct wmi_set_ip_cmd *ip_cmd) ...@@ -2495,9 +2496,10 @@ int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, struct wmi_set_ip_cmd *ip_cmd)
return -ENOMEM; return -ENOMEM;
cmd = (struct wmi_set_ip_cmd *) skb->data; cmd = (struct wmi_set_ip_cmd *) skb->data;
memcpy(cmd, ip_cmd, sizeof(struct wmi_set_ip_cmd)); cmd->ips[0] = ips0;
cmd->ips[1] = ips1;
ret = ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_SET_IP_CMDID, ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_IP_CMDID,
NO_SYNC_WMIFLAG); NO_SYNC_WMIFLAG);
return ret; return ret;
} }
......
...@@ -1903,7 +1903,7 @@ struct wow_filter { ...@@ -1903,7 +1903,7 @@ struct wow_filter {
struct wmi_set_ip_cmd { struct wmi_set_ip_cmd {
/* IP in network byte order */ /* IP in network byte order */
__le32 ips[MAX_IP_ADDRS]; __be32 ips[MAX_IP_ADDRS];
} __packed; } __packed;
enum ath6kl_wow_filters { enum ath6kl_wow_filters {
...@@ -2417,7 +2417,8 @@ int ath6kl_wmi_test_cmd(struct wmi *wmi, void *buf, size_t len); ...@@ -2417,7 +2417,8 @@ int ath6kl_wmi_test_cmd(struct wmi *wmi, void *buf, size_t len);
s32 ath6kl_wmi_get_rate(s8 rate_index); s32 ath6kl_wmi_get_rate(s8 rate_index);
int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, struct wmi_set_ip_cmd *ip_cmd); int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, u8 if_idx,
__be32 ips0, __be32 ips1);
int ath6kl_wmi_set_host_sleep_mode_cmd(struct wmi *wmi, u8 if_idx, int ath6kl_wmi_set_host_sleep_mode_cmd(struct wmi *wmi, u8 if_idx,
enum ath6kl_host_mode host_mode); enum ath6kl_host_mode host_mode);
int ath6kl_wmi_set_wow_mode_cmd(struct wmi *wmi, u8 if_idx, int ath6kl_wmi_set_wow_mode_cmd(struct wmi *wmi, u8 if_idx,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment