@@ -120,6 +120,13 @@ struct mptcp_sched_ops {
void (*release)(struct mptcp_sock *msk);
} ____cacheline_aligned_in_smp;
+/* max value of mptcp_addr_info.id */
+#define MPTCP_PM_MAX_ADDR_ID U8_MAX
+
+typedef struct {
+ DECLARE_BITMAP(map, MPTCP_PM_MAX_ADDR_ID + 1);
+} mptcp_pm_addr_id_bitmap_t;
+
#ifdef CONFIG_MPTCP
void mptcp_init(void);
@@ -47,15 +47,15 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
struct mptcp_pm_addr_entry *entry,
bool needs_id)
{
- DECLARE_BITMAP(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
struct mptcp_pm_addr_entry *match = NULL;
struct sock *sk = (struct sock *)msk;
+ mptcp_pm_addr_id_bitmap_t id_bitmap;
struct mptcp_pm_addr_entry *e;
bool addr_match = false;
bool id_match = false;
int ret = -EINVAL;
- bitmap_zero(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
+ bitmap_zero(id_bitmap.map, MPTCP_PM_MAX_ADDR_ID + 1);
spin_lock_bh(&msk->pm.lock);
mptcp_for_each_userspace_pm_addr(msk, e) {
@@ -69,7 +69,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
} else if (addr_match || id_match) {
break;
}
- __set_bit(e->addr.id, id_bitmap);
+ __set_bit(e->addr.id, id_bitmap.map);
}
if (!match && !addr_match && !id_match) {
@@ -84,7 +84,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
*e = *entry;
if (!e->addr.id && needs_id)
- e->addr.id = find_next_zero_bit(id_bitmap,
+ e->addr.id = find_next_zero_bit(id_bitmap.map,
MPTCP_PM_MAX_ADDR_ID + 1,
1);
list_add_tail_rcu(&e->list, &msk->pm.userspace_pm_local_addr_list);
@@ -618,16 +618,14 @@ int mptcp_userspace_pm_dump_addr(struct sk_buff *msg,
struct netlink_callback *cb,
const struct genl_info *info)
{
- struct id_bitmap {
- DECLARE_BITMAP(map, MPTCP_PM_MAX_ADDR_ID + 1);
- } *bitmap;
+ mptcp_pm_addr_id_bitmap_t *bitmap;
struct mptcp_pm_addr_entry *entry;
struct mptcp_sock *msk;
int ret = -EINVAL;
struct sock *sk;
void *hdr;
- bitmap = (struct id_bitmap *)cb->ctx;
+ bitmap = (mptcp_pm_addr_id_bitmap_t *)cb->ctx;
msk = mptcp_userspace_pm_get_sock(info);
if (!msk)
@@ -208,9 +208,6 @@ enum mptcp_addr_signal_status {
MPTCP_RM_ADDR_SIGNAL,
};
-/* max value of mptcp_addr_info.id */
-#define MPTCP_PM_MAX_ADDR_ID U8_MAX
-
struct mptcp_pm_data {
struct mptcp_addr_info local;
struct mptcp_addr_info remote;