Commit f5864a10 authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman

staging: wfx: simplify hif_mib_uc_mc_bc_data_frame_condition

The current API defines bitfields. It is not very convenient. Prefer to
use bitmasks.
Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-33-Jerome.Pouiller@silabs.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 46f044b9
...@@ -181,19 +181,13 @@ struct hif_mib_ipv6_addr_data_frame_condition { ...@@ -181,19 +181,13 @@ struct hif_mib_ipv6_addr_data_frame_condition {
u8 i_pv6_address[HIF_API_IPV6_ADDRESS_SIZE]; u8 i_pv6_address[HIF_API_IPV6_ADDRESS_SIZE];
} __packed; } __packed;
union hif_addr_type { #define HIF_FILTER_UNICAST 0x1
u8 value; #define HIF_FILTER_MULTICAST 0x2
struct { #define HIF_FILTER_BROADCAST 0x4
u8 type_unicast:1;
u8 type_multicast:1;
u8 type_broadcast:1;
u8 reserved:5;
} bits;
};
struct hif_mib_uc_mc_bc_data_frame_condition { struct hif_mib_uc_mc_bc_data_frame_condition {
u8 condition_idx; u8 condition_idx;
union hif_addr_type param; u8 allowed_frames;
u8 reserved[2]; u8 reserved[2];
} __packed; } __packed;
......
...@@ -246,15 +246,12 @@ static inline int hif_set_mac_addr_condition(struct wfx_vif *wvif, ...@@ -246,15 +246,12 @@ static inline int hif_set_mac_addr_condition(struct wfx_vif *wvif,
arg, sizeof(*arg)); arg, sizeof(*arg));
} }
// FIXME: use a bitfield instead of 3 boolean values static inline int hif_set_uc_mc_bc_condition(struct wfx_vif *wvif,
static inline int hif_set_uc_mc_bc_condition(struct wfx_vif *wvif, int idx, int idx, u8 allowed_frames)
bool unic, bool multic, bool broadc)
{ {
struct hif_mib_uc_mc_bc_data_frame_condition val = { struct hif_mib_uc_mc_bc_data_frame_condition val = {
.condition_idx = idx, .condition_idx = idx,
.param.bits.type_unicast = unic, .allowed_frames = allowed_frames,
.param.bits.type_multicast = multic,
.param.bits.type_broadcast = broadc,
}; };
return hif_write_mib(wvif->wdev, wvif->id, return hif_write_mib(wvif->wdev, wvif->id,
......
...@@ -142,8 +142,8 @@ static int wfx_set_mcast_filter(struct wfx_vif *wvif, ...@@ -142,8 +142,8 @@ static int wfx_set_mcast_filter(struct wfx_vif *wvif,
config.mac_cond |= 1 << i; config.mac_cond |= 1 << i;
} }
// Accept unicast and broadcast ret = hif_set_uc_mc_bc_condition(wvif, 0, HIF_FILTER_UNICAST |
ret = hif_set_uc_mc_bc_condition(wvif, 0, true, false, true); HIF_FILTER_BROADCAST);
if (ret) if (ret)
return ret; return ret;
......
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