Re: [RFC 0/7] netlink: Add allocation flag to netlink_unicast()
From: Masashi HonmaDate: Wed, 6 Jul 2016 09:28:29 +0900 > Though currently such a use case was not found, to solve potential > issue we will add an allocation flag to netlink_unicast(). We don't solve potential issues, we solve real issues. There is no reason to add the GFP parameter until it is actually needed. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC 5/7] net: Add allocation flag to rtnl_unicast()
Signed-off-by: Masashi Honma--- include/linux/rtnetlink.h | 3 ++- net/core/net_namespace.c | 2 +- net/core/rtnetlink.c | 10 ++ net/dcb/dcbnl.c | 2 +- net/decnet/dn_route.c | 3 ++- net/ipv4/devinet.c| 2 +- net/ipv4/ipmr.c | 6 -- net/ipv4/route.c | 2 +- net/ipv6/addrconf.c | 4 ++-- net/ipv6/addrlabel.c | 2 +- net/ipv6/ip6mr.c | 6 -- net/ipv6/route.c | 2 +- net/sched/act_api.c | 2 +- 13 files changed, 27 insertions(+), 19 deletions(-) diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 2daece8..132730f 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -8,7 +8,8 @@ #include extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo); -extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid); +extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid, + gfp_t flags); extern void rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group, struct nlmsghdr *nlh, gfp_t flags); extern void rtnl_set_sk_err(struct net *net, u32 group, int error); diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 2c2eb1b..28eed58 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -646,7 +646,7 @@ static int rtnl_net_getid(struct sk_buff *skb, struct nlmsghdr *nlh) if (err < 0) goto err_out; - err = rtnl_unicast(msg, net, NETLINK_CB(skb).portid); + err = rtnl_unicast(msg, net, NETLINK_CB(skb).portid, GFP_KERNEL); goto out; err_out: diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 7f7927f..89fd826 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -653,11 +653,11 @@ int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int g return err; } -int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid) +int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid, gfp_t flags) { struct sock *rtnl = net->rtnl; - return nlmsg_unicast(rtnl, skb, pid, gfp_any()); + return nlmsg_unicast(rtnl, skb, pid, flags); } EXPORT_SYMBOL(rtnl_unicast); @@ -2565,7 +2565,8 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh) WARN_ON(err == -EMSGSIZE); kfree_skb(nskb); } else - err = rtnl_unicast(nskb, net, NETLINK_CB(skb).portid); + err = rtnl_unicast(nskb, net, NETLINK_CB(skb).portid, + GFP_KERNEL); return err; } @@ -3601,7 +3602,8 @@ static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh) WARN_ON(err == -EMSGSIZE); kfree_skb(nskb); } else { - err = rtnl_unicast(nskb, net, NETLINK_CB(skb).portid); + err = rtnl_unicast(nskb, net, NETLINK_CB(skb).portid, + GFP_KERNEL); } return err; diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index 4f6c186..e4de9fe 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1749,7 +1749,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh) nlmsg_end(reply_skb, reply_nlh); - ret = rtnl_unicast(reply_skb, net, portid); + ret = rtnl_unicast(reply_skb, net, portid, GFP_KERNEL); out: return ret; } diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index b1dc096..6fe02bb 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c @@ -1714,7 +1714,8 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) goto out_free; } - return rtnl_unicast(skb, _net, NETLINK_CB(in_skb).portid); + return rtnl_unicast(skb, _net, NETLINK_CB(in_skb).portid, + GFP_KERNEL); out_free: kfree_skb(skb); diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index e333bc8..5e969e5 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -1917,7 +1917,7 @@ static int inet_netconf_get_devconf(struct sk_buff *in_skb, kfree_skb(skb); goto errout; } - err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid); + err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid, GFP_ATOMIC); errout: return err; } diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 5ad48ec..c704a2a 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -654,7 +654,8 @@ static void ipmr_destroy_unres(struct mr_table *mrt, struct mfc_cache *c) e->error = -ETIMEDOUT; memset(>msg, 0, sizeof(e->msg)); - rtnl_unicast(skb, net, NETLINK_CB(skb).portid); + rtnl_unicast(skb, net, NETLINK_CB(skb).portid, +
[RFC 4/7] infiniband: Add allocation flag to ibnl_unicast()
Signed-off-by: Masashi Honma--- drivers/infiniband/core/iwpm_msg.c | 6 +++--- drivers/infiniband/core/iwpm_util.c | 5 +++-- drivers/infiniband/core/iwpm_util.h | 1 + drivers/infiniband/core/netlink.c | 4 ++-- include/rdma/rdma_netlink.h | 3 ++- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/core/iwpm_msg.c b/drivers/infiniband/core/iwpm_msg.c index 1c41b95..4307eab 100644 --- a/drivers/infiniband/core/iwpm_msg.c +++ b/drivers/infiniband/core/iwpm_msg.c @@ -174,7 +174,7 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) goto add_mapping_error; nlmsg_request->req_buffer = pm_msg; - ret = ibnl_unicast(skb, nlh, iwpm_user_pid); + ret = ibnl_unicast(skb, nlh, iwpm_user_pid, GFP_ATOMIC); if (ret) { skb = NULL; /* skb is freed in the netlink send-op handling */ iwpm_user_pid = IWPM_PID_UNDEFINED; @@ -251,7 +251,7 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) goto query_mapping_error; nlmsg_request->req_buffer = pm_msg; - ret = ibnl_unicast(skb, nlh, iwpm_user_pid); + ret = ibnl_unicast(skb, nlh, iwpm_user_pid, GFP_ATOMIC); if (ret) { skb = NULL; /* skb is freed in the netlink send-op handling */ err_str = "Unable to send a nlmsg"; @@ -312,7 +312,7 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client) if (ret) goto remove_mapping_error; - ret = ibnl_unicast(skb, nlh, iwpm_user_pid); + ret = ibnl_unicast(skb, nlh, iwpm_user_pid, GFP_ATOMIC); if (ret) { skb = NULL; /* skb is freed in the netlink send-op handling */ iwpm_user_pid = IWPM_PID_UNDEFINED; diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c index b65e06c..6dcbb2d 100644 --- a/drivers/infiniband/core/iwpm_util.c +++ b/drivers/infiniband/core/iwpm_util.c @@ -609,7 +609,7 @@ static int send_mapinfo_num(u32 mapping_num, u8 nl_client, int iwpm_pid) _num, IWPM_NLA_MAPINFO_SEND_NUM); if (ret) goto mapinfo_num_error; - ret = ibnl_unicast(skb, nlh, iwpm_pid); + ret = ibnl_unicast(skb, nlh, iwpm_pid, GFP_ATOMIC); if (ret) { skb = NULL; err_str = "Unable to send a nlmsg"; @@ -638,7 +638,8 @@ static int send_nlmsg_done(struct sk_buff *skb, u8 nl_client, int iwpm_pid) return -ENOMEM; } nlh->nlmsg_type = NLMSG_DONE; - ret = ibnl_unicast(skb, (struct nlmsghdr *)skb->data, iwpm_pid); + ret = ibnl_unicast(skb, (struct nlmsghdr *)skb->data, iwpm_pid, + GFP_ATOMIC); if (ret) pr_warn("%s Unable to send a nlmsg\n", __func__); return ret; diff --git a/drivers/infiniband/core/iwpm_util.h b/drivers/infiniband/core/iwpm_util.h index af1fc14..0ced7f4 100644 --- a/drivers/infiniband/core/iwpm_util.h +++ b/drivers/infiniband/core/iwpm_util.h @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c index 09037a9..1451238 100644 --- a/drivers/infiniband/core/netlink.c +++ b/drivers/infiniband/core/netlink.c @@ -227,9 +227,9 @@ static void ibnl_rcv(struct sk_buff *skb) } int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh, - __u32 pid) + __u32 pid, gfp_t flags) { - return nlmsg_unicast(nls, skb, pid, gfp_any()); + return nlmsg_unicast(nls, skb, pid, flags); } EXPORT_SYMBOL(ibnl_unicast); diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h index 5852661..0bb3010 100644 --- a/include/rdma/rdma_netlink.h +++ b/include/rdma/rdma_netlink.h @@ -61,10 +61,11 @@ int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh, * @skb: The netlink skb * @nlh: Header of the netlink message to send * @pid: Userspace netlink process ID + * @flags: allocation flags * Returns 0 on success or a negative error code. */ int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh, - __u32 pid); + __u32 pid, gfp_t flags); /** * Send the supplied skb to a netlink group. -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC 2/7] netfilter: Add allocation flag to nfnetlink_unicast()
Signed-off-by: Masashi Honma--- include/linux/netfilter/nfnetlink.h | 2 +- net/netfilter/nfnetlink.c | 4 ++-- net/netfilter/nfnetlink_log.c | 4 ++-- net/netfilter/nfnetlink_queue.c | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 1d82dd5..a1c7808 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h @@ -38,7 +38,7 @@ int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, unsigned int group, int echo, gfp_t flags); int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error); int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid, - int flags); + int flags, gfp_t allocation); void nfnl_lock(__u8 subsys_id); void nfnl_unlock(__u8 subsys_id); diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index f6193e7..b0910c7 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c @@ -141,9 +141,9 @@ int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error) EXPORT_SYMBOL_GPL(nfnetlink_set_err); int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid, - int flags) + int flags, gfp_t allocation) { - return netlink_unicast(net->nfnl, skb, portid, flags, 0); + return netlink_unicast(net->nfnl, skb, portid, flags, allocation); } EXPORT_SYMBOL_GPL(nfnetlink_unicast); diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 11f81c8..c834306 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -357,8 +357,8 @@ __nfulnl_send(struct nfulnl_instance *inst) goto out; } } - nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid, - MSG_DONTWAIT); + nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid, MSG_DONTWAIT, + gfp_any()); out: inst->qlen = 0; inst->skb = NULL; diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 5d36a09..8d7b6ff 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c @@ -638,7 +638,8 @@ __nfqnl_enqueue_packet(struct net *net, struct nfqnl_instance *queue, *packet_id_ptr = htonl(entry->id); /* nfnetlink_unicast will either free the nskb or add it to a socket */ - err = nfnetlink_unicast(nskb, net, queue->peer_portid, MSG_DONTWAIT); + err = nfnetlink_unicast(nskb, net, queue->peer_portid, MSG_DONTWAIT, + GFP_ATOMIC); if (err < 0) { if (queue->flags & NFQA_CFG_F_FAIL_OPEN) { failopen = 1; -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC 6/7] genetlink: Add allocation flag to genlmsg_unicast()
Signed-off-by: Masashi Honma--- drivers/net/gtp.c | 3 ++- drivers/net/team/team.c | 5 +++-- drivers/net/wireless/mac80211_hwsim.c | 2 +- fs/dlm/netlink.c | 2 +- include/net/genetlink.h | 8 +--- kernel/taskstats.c| 2 +- net/hsr/hsr_netlink.c | 6 -- net/l2tp/l2tp_netlink.c | 8 +--- net/openvswitch/datapath.c| 3 ++- net/tipc/netlink_compat.c | 2 +- net/wireless/nl80211.c| 9 + 11 files changed, 30 insertions(+), 20 deletions(-) diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index 97e0cbc..0156abb 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -1210,7 +1210,8 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info) goto err_unlock_free; rcu_read_unlock(); - return genlmsg_unicast(genl_info_net(info), skb2, info->snd_portid); + return genlmsg_unicast(genl_info_net(info), skb2, info->snd_portid, + GFP_ATOMIC); err_unlock_free: kfree_skb(skb2); diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index f9eebea..3d40b55 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -2194,7 +2194,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info) genlmsg_end(msg, hdr); - return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid); + return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid, + GFP_KERNEL); err_msg_put: nlmsg_free(msg); @@ -2240,7 +2241,7 @@ typedef int team_nl_send_func_t(struct sk_buff *skb, static int team_nl_send_unicast(struct sk_buff *skb, struct team *team, u32 portid) { - return genlmsg_unicast(dev_net(team->dev), skb, portid); + return genlmsg_unicast(dev_net(team->dev), skb, portid, gfp_any()); } static int team_nl_fill_one_option_get(struct sk_buff *skb, struct team *team, diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 382109bb..5c7bf77 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -1008,7 +1008,7 @@ static int hwsim_unicast_netgroup(struct mac80211_hwsim_data *data, rcu_read_lock(); for_each_net_rcu(net) { if (data->netgroup == hwsim_net_get_netgroup(net)) { - res = genlmsg_unicast(net, skb, portid); + res = genlmsg_unicast(net, skb, portid, GFP_ATOMIC); found = true; break; } diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c index 1e6e227..c498616 100644 --- a/fs/dlm/netlink.c +++ b/fs/dlm/netlink.c @@ -59,7 +59,7 @@ static int send_data(struct sk_buff *skb) genlmsg_end(skb, data); - return genlmsg_unicast(_net, skb, listener_nlportid); + return genlmsg_unicast(_net, skb, listener_nlportid, GFP_NOFS); } static int user_cmd(struct sk_buff *skb, struct genl_info *info) diff --git a/include/net/genetlink.h b/include/net/genetlink.h index b107a35..5f0f2ff 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h @@ -331,10 +331,12 @@ int genlmsg_multicast_allns(struct genl_family *family, * genlmsg_unicast - unicast a netlink message * @skb: netlink message as socket buffer * @portid: netlink portid of the destination socket + * @flags: allocation flags */ -static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 portid) +static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, + u32 portid, gfp_t flags) { - return nlmsg_unicast(net->genl_sock, skb, portid, 0); + return nlmsg_unicast(net->genl_sock, skb, portid, flags); } /** @@ -344,7 +346,7 @@ static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 port */ static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info) { - return genlmsg_unicast(genl_info_net(info), skb, info->snd_portid); + return genlmsg_unicast(genl_info_net(info), skb, info->snd_portid, 0); } /** diff --git a/kernel/taskstats.c b/kernel/taskstats.c index b3f05ee..ecfcaff 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -140,7 +140,7 @@ static void send_cpu_listeners(struct sk_buff *skb, if (!skb_next) break; } - rc = genlmsg_unicast(_net, skb_cur, s->pid); + rc = genlmsg_unicast(_net, skb_cur, s->pid, GFP_KERNEL); if (rc == -ECONNREFUSED) { s->valid = 0; delcount++; diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c index d4d1617..dcc674f 100644 --- a/net/hsr/hsr_netlink.c +++ b/net/hsr/hsr_netlink.c @@
[RFC 7/7] genetlink: Add allocation flag to genlmsg_reply()
Add allocation flag to genlmsg_reply() and remove netlink_unicast() temporal functionality for stepwise modification. Signed-off-by: Masashi Honma--- drivers/block/drbd/drbd_nl.c | 2 +- drivers/net/wireless/mac80211_hwsim.c | 2 +- include/net/genetlink.h | 7 +-- kernel/taskstats.c| 2 +- net/core/devlink.c| 12 ++-- net/ieee802154/ieee802154.h | 3 ++- net/ieee802154/netlink.c | 5 +++-- net/ieee802154/nl-mac.c | 4 ++-- net/ieee802154/nl-phy.c | 6 +++--- net/ieee802154/nl802154.c | 4 ++-- net/ipv4/fou.c| 2 +- net/ipv4/tcp_metrics.c| 2 +- net/ipv6/ila/ila_xlat.c | 2 +- net/irda/irnetlink.c | 2 +- net/netfilter/ipvs/ip_vs_ctl.c| 2 +- net/netlabel/netlabel_cipso_v4.c | 2 +- net/netlabel/netlabel_mgmt.c | 4 ++-- net/netlabel/netlabel_unlabeled.c | 2 +- net/netlink/af_netlink.c | 2 +- net/netlink/genetlink.c | 2 +- net/nfc/netlink.c | 6 +++--- net/openvswitch/datapath.c| 6 +++--- net/tipc/bearer.c | 4 ++-- net/tipc/node.c | 2 +- net/wireless/nl80211.c| 34 +- 25 files changed, 63 insertions(+), 58 deletions(-) diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 0bac9c8..3162608 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -100,7 +100,7 @@ static char *drbd_m_holder = "Hands off! this is DRBD's meta data device."; static void drbd_adm_send_reply(struct sk_buff *skb, struct genl_info *info) { genlmsg_end(skb, genlmsg_data(nlmsg_data(nlmsg_hdr(skb; - if (genlmsg_reply(skb, info)) + if (genlmsg_reply(skb, info, GFP_KERNEL)) pr_err("error sending genl reply\n"); } diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 5c7bf77..5319cd1 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -3160,7 +3160,7 @@ static int hwsim_get_radio_nl(struct sk_buff *msg, struct genl_info *info) goto out_err; } - genlmsg_reply(skb, info); + genlmsg_reply(skb, info, GFP_KERNEL); break; } diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 5f0f2ff..99c9c39 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h @@ -343,10 +343,13 @@ static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, * genlmsg_reply - reply to a request * @skb: netlink message to be sent back * @info: receiver information + * @flags: allocation flags */ -static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info) +static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info, + gfp_t flags) { - return genlmsg_unicast(genl_info_net(info), skb, info->snd_portid, 0); + return genlmsg_unicast(genl_info_net(info), skb, info->snd_portid, + flags); } /** diff --git a/kernel/taskstats.c b/kernel/taskstats.c index ecfcaff..894d0da 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -114,7 +114,7 @@ static int send_reply(struct sk_buff *skb, struct genl_info *info) genlmsg_end(skb, reply); - return genlmsg_reply(skb, info); + return genlmsg_reply(skb, info, GFP_KERNEL); } /* diff --git a/net/core/devlink.c b/net/core/devlink.c index 933e8d4..61a1c8a 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -501,7 +501,7 @@ static int devlink_nl_cmd_get_doit(struct sk_buff *skb, struct genl_info *info) return err; } - return genlmsg_reply(msg, info); + return genlmsg_reply(msg, info, GFP_KERNEL); } static int devlink_nl_cmd_get_dumpit(struct sk_buff *msg, @@ -554,7 +554,7 @@ static int devlink_nl_cmd_port_get_doit(struct sk_buff *skb, return err; } - return genlmsg_reply(msg, info); + return genlmsg_reply(msg, info, GFP_KERNEL); } static int devlink_nl_cmd_port_get_dumpit(struct sk_buff *msg, @@ -736,7 +736,7 @@ static int devlink_nl_cmd_sb_get_doit(struct sk_buff *skb, return err; } - return genlmsg_reply(msg, info); + return genlmsg_reply(msg, info, GFP_KERNEL); } static int devlink_nl_cmd_sb_get_dumpit(struct sk_buff *msg, @@ -843,7 +843,7 @@ static int devlink_nl_cmd_sb_pool_get_doit(struct sk_buff *skb, return err; } - return genlmsg_reply(msg, info); + return genlmsg_reply(msg, info, GFP_KERNEL); } static int __sb_pool_get_dumpit(struct sk_buff *msg, int start, int
[RFC 3/7] netlink: Add allocation flag to nlmsg_unicast()
Signed-off-by: Masashi Honma--- crypto/crypto_user.c | 3 ++- drivers/infiniband/core/netlink.c | 2 +- include/net/genetlink.h | 2 +- include/net/netlink.h | 6 -- net/core/rtnetlink.c | 2 +- net/netfilter/nf_tables_api.c | 10 +- net/netlink/af_netlink.c | 2 +- net/xfrm/xfrm_user.c | 15 +-- 8 files changed, 24 insertions(+), 18 deletions(-) diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index 7097a33..f379b74 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c @@ -249,7 +249,8 @@ drop_alg: if (err) return err; - return nlmsg_unicast(crypto_nlsk, skb, NETLINK_CB(in_skb).portid); + return nlmsg_unicast(crypto_nlsk, skb, NETLINK_CB(in_skb).portid, +GFP_ATOMIC); } static int crypto_dump_report(struct sk_buff *skb, struct netlink_callback *cb) diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c index 9b8c20c..09037a9 100644 --- a/drivers/infiniband/core/netlink.c +++ b/drivers/infiniband/core/netlink.c @@ -229,7 +229,7 @@ static void ibnl_rcv(struct sk_buff *skb) int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh, __u32 pid) { - return nlmsg_unicast(nls, skb, pid); + return nlmsg_unicast(nls, skb, pid, gfp_any()); } EXPORT_SYMBOL(ibnl_unicast); diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 8d4608c..b107a35 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h @@ -334,7 +334,7 @@ int genlmsg_multicast_allns(struct genl_family *family, */ static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 portid) { - return nlmsg_unicast(net->genl_sock, skb, portid); + return nlmsg_unicast(net->genl_sock, skb, portid, 0); } /** diff --git a/include/net/netlink.h b/include/net/netlink.h index 898e449..df5b533 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -585,12 +585,14 @@ static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb, * @sk: netlink socket to spread message to * @skb: netlink message as socket buffer * @portid: netlink portid of the destination socket + * @flags: allocation flags */ -static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 portid) +static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, + u32 portid, gfp_t flags) { int err; - err = netlink_unicast(sk, skb, portid, MSG_DONTWAIT, 0); + err = netlink_unicast(sk, skb, portid, MSG_DONTWAIT, flags); if (err > 0) err = 0; diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 3433633f..7f7927f 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -657,7 +657,7 @@ int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid) { struct sock *rtnl = net->rtnl; - return nlmsg_unicast(rtnl, skb, pid); + return nlmsg_unicast(rtnl, skb, pid, gfp_any()); } EXPORT_SYMBOL(rtnl_unicast); diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 2c88187..4afb751 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -581,7 +581,7 @@ static int nf_tables_gettable(struct net *net, struct sock *nlsk, if (err < 0) goto err; - return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); + return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid, GFP_KERNEL); err: kfree_skb(skb2); @@ -1144,7 +1144,7 @@ static int nf_tables_getchain(struct net *net, struct sock *nlsk, if (err < 0) goto err; - return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); + return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid, GFP_KERNEL); err: kfree_skb(skb2); @@ -1976,7 +1976,7 @@ static int nf_tables_getrule(struct net *net, struct sock *nlsk, if (err < 0) goto err; - return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); + return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid, GFP_KERNEL); err: kfree_skb(skb2); @@ -2664,7 +2664,7 @@ static int nf_tables_getset(struct net *net, struct sock *nlsk, if (err < 0) goto err; - return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); + return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid, GFP_KERNEL); err: kfree_skb(skb2); @@ -3798,7 +3798,7 @@ static int nf_tables_getgen(struct net *net, struct sock *nlsk, if (err < 0) goto err; - return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); + return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid, GFP_KERNEL); err: kfree_skb(skb2); return err; diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index
[RFC 1/7] netlink: Add allocation flag to netlink_unicast()
Though netlink_broadcast() has allocation flag which can specify memory allocation type (ex. GFP_KERNEL/GFP_ATOMIC), netlink_unicast() does not have it. This can cause "BUG: sleeping function called from invalid context at" with CONFIG_DEBUG_ATOMIC_SLEEP enabled kernel when calling netlink_unicast() inside RCU read-side section and not in IRQ. This patch adds an allocation flag to netlink_unicast(). At this moment, the allocation flag could be zero to imply gfp_any(). This is a temporal functionality for stepwise modification and removed at the end of the series of patches. Signed-off-by: Masashi Honma--- drivers/connector/connector.c| 2 +- include/linux/netlink.h | 3 ++- include/net/netlink.h| 2 +- kernel/audit.c | 9 + net/core/rtnetlink.c | 2 +- net/ipv4/fib_frontend.c | 2 +- net/ipv4/inet_diag.c | 2 +- net/ipv4/udp_diag.c | 2 +- net/netfilter/ipset/ip_set_core.c| 11 +++ net/netfilter/nf_conntrack_netlink.c | 9 ++--- net/netfilter/nfnetlink.c| 2 +- net/netfilter/nfnetlink_acct.c | 2 +- net/netfilter/nfnetlink_cthelper.c | 2 +- net/netfilter/nfnetlink_cttimeout.c | 5 +++-- net/netfilter/nft_compat.c | 4 ++-- net/netlink/af_netlink.c | 12 +++- net/sctp/sctp_diag.c | 2 +- net/unix/diag.c | 2 +- samples/connector/cn_test.c | 2 +- 19 files changed, 44 insertions(+), 33 deletions(-) diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 25693b0..44470e6 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c @@ -125,7 +125,7 @@ int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 __group, return netlink_broadcast(dev->nls, skb, portid, group, gfp_mask); return netlink_unicast(dev->nls, skb, portid, - !gfpflags_allow_blocking(gfp_mask)); + !gfpflags_allow_blocking(gfp_mask), gfp_mask); } EXPORT_SYMBOL_GPL(cn_netlink_send_mult); diff --git a/include/linux/netlink.h b/include/linux/netlink.h index da14ab6..f90d24a 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -69,7 +69,8 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group) extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); extern int netlink_has_listeners(struct sock *sk, unsigned int group); -extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock); +extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, + int nonblock, gfp_t allocation); extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid, __u32 group, gfp_t allocation); extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, diff --git a/include/net/netlink.h b/include/net/netlink.h index 254a0fc..898e449 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -590,7 +590,7 @@ static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 portid { int err; - err = netlink_unicast(sk, skb, portid, MSG_DONTWAIT); + err = netlink_unicast(sk, skb, portid, MSG_DONTWAIT, 0); if (err > 0) err = 0; diff --git a/kernel/audit.c b/kernel/audit.c index 8d528f9..131577d 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -411,7 +411,7 @@ static void kauditd_send_skb(struct sk_buff *skb) restart: /* take a reference in case we can't send it and we want to hold it */ skb_get(skb); - err = netlink_unicast(audit_sock, skb, audit_nlk_portid, 0); + err = netlink_unicast(audit_sock, skb, audit_nlk_portid, 0, gfp_any()); if (err < 0) { pr_err("netlink_unicast sending to audit_pid=%d returned error: %d\n", audit_pid, err); @@ -547,7 +547,7 @@ int audit_send_list(void *_dest) mutex_unlock(_cmd_mutex); while ((skb = __skb_dequeue(>q)) != NULL) - netlink_unicast(aunet->nlsk, skb, dest->portid, 0); + netlink_unicast(aunet->nlsk, skb, dest->portid, 0, gfp_any()); put_net(net); kfree(dest); @@ -591,7 +591,7 @@ static int audit_send_reply_thread(void *arg) /* Ignore failure. It'll only happen if the sender goes away, because our timeout is set to infinite. */ - netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0); + netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0, gfp_any()); put_net(net); kfree(reply); return 0; @@ -814,7 +814,8 @@ static int audit_replace(pid_t pid) if (!skb) return
[RFC 0/7] netlink: Add allocation flag to netlink_unicast()
Though netlink_broadcast() has allocation flag which can specify memory allocation type (ex. GFP_KERNEL/GFP_ATOMIC), netlink_unicast() does not have it. This can cause "BUG: sleeping function called from invalid context at" with CONFIG_DEBUG_ATOMIC_SLEEP enabled kernel when calling netlink_unicast() inside RCU read-side section and not in IRQ. Though currently such a use case was not found, to solve potential issue we will add an allocation flag to netlink_unicast(). Previously netlink_unicast() have used gfp_any() as a flag. We replaced it to GFP_KERNEL or GFP_ATOMIC or etc by guessing based on context. If we could not determine the value, we remain it gfp_any(). We welcome comments like "this gfp_any() should be GFP_KERNEL". Of course other comments are welcome as well. This series of patches are not tested. This is a RFC because this does not fix existing issue. Masashi Honma (7): netlink: Add allocation flag to netlink_unicast() netfilter: Add allocation flag to nfnetlink_unicast() netlink: Add allocation flag to nlmsg_unicast() infiniband: Add allocation flag to ibnl_unicast() net: Add allocation flag to rtnl_unicast() genetlink: Add allocation flag to genlmsg_unicast() genetlink: Add allocation flag to genlmsg_reply() crypto/crypto_user.c | 3 ++- drivers/block/drbd/drbd_nl.c | 2 +- drivers/connector/connector.c | 2 +- drivers/infiniband/core/iwpm_msg.c| 6 ++--- drivers/infiniband/core/iwpm_util.c | 5 ++-- drivers/infiniband/core/iwpm_util.h | 1 + drivers/infiniband/core/netlink.c | 4 ++-- drivers/net/gtp.c | 3 ++- drivers/net/team/team.c | 5 ++-- drivers/net/wireless/mac80211_hwsim.c | 4 ++-- fs/dlm/netlink.c | 2 +- include/linux/netfilter/nfnetlink.h | 2 +- include/linux/netlink.h | 3 ++- include/linux/rtnetlink.h | 3 ++- include/net/genetlink.h | 13 +++ include/net/netlink.h | 6 +++-- include/rdma/rdma_netlink.h | 3 ++- kernel/audit.c| 9 kernel/taskstats.c| 4 ++-- net/core/devlink.c| 12 +- net/core/net_namespace.c | 2 +- net/core/rtnetlink.c | 12 ++ net/dcb/dcbnl.c | 2 +- net/decnet/dn_route.c | 3 ++- net/hsr/hsr_netlink.c | 6 +++-- net/ieee802154/ieee802154.h | 3 ++- net/ieee802154/netlink.c | 5 ++-- net/ieee802154/nl-mac.c | 4 ++-- net/ieee802154/nl-phy.c | 6 ++--- net/ieee802154/nl802154.c | 4 ++-- net/ipv4/devinet.c| 2 +- net/ipv4/fib_frontend.c | 2 +- net/ipv4/fou.c| 2 +- net/ipv4/inet_diag.c | 2 +- net/ipv4/ipmr.c | 6 +++-- net/ipv4/route.c | 2 +- net/ipv4/tcp_metrics.c| 2 +- net/ipv4/udp_diag.c | 2 +- net/ipv6/addrconf.c | 4 ++-- net/ipv6/addrlabel.c | 2 +- net/ipv6/ila/ila_xlat.c | 2 +- net/ipv6/ip6mr.c | 6 +++-- net/ipv6/route.c | 2 +- net/irda/irnetlink.c | 2 +- net/l2tp/l2tp_netlink.c | 8 --- net/netfilter/ipset/ip_set_core.c | 11 + net/netfilter/ipvs/ip_vs_ctl.c| 2 +- net/netfilter/nf_conntrack_netlink.c | 9 +--- net/netfilter/nf_tables_api.c | 10 net/netfilter/nfnetlink.c | 4 ++-- net/netfilter/nfnetlink_acct.c| 2 +- net/netfilter/nfnetlink_cthelper.c| 2 +- net/netfilter/nfnetlink_cttimeout.c | 5 ++-- net/netfilter/nfnetlink_log.c | 4 ++-- net/netfilter/nfnetlink_queue.c | 3 ++- net/netfilter/nft_compat.c| 4 ++-- net/netlabel/netlabel_cipso_v4.c | 2 +- net/netlabel/netlabel_mgmt.c | 4 ++-- net/netlabel/netlabel_unlabeled.c | 2 +- net/netlink/af_netlink.c | 14 +++- net/netlink/genetlink.c | 2 +- net/nfc/netlink.c | 6 ++--- net/openvswitch/datapath.c| 9 net/sched/act_api.c | 2 +- net/sctp/sctp_diag.c | 2 +- net/tipc/bearer.c | 4 ++-- net/tipc/netlink_compat.c | 2 +- net/tipc/node.c | 2 +- net/unix/diag.c | 2 +- net/wireless/nl80211.c| 43 ++- net/xfrm/xfrm_user.c | 15 +++- samples/connector/cn_test.c | 2 +- 72 files changed, 199 insertions(+), 155 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to
Re: ath9k-htc on OHCI -> bogus usb xfer
Am 05.07.2016 um 19:31 schrieb Alexey Brodkin: > Hi Oleksij, > > On Tue, 2016-07-05 at 19:23 +0200, Oleksij Rempel wrote: >> Hi, >> >> Am 05.07.2016 um 14:20 schrieb Alexey Brodkin: >>> >>> Hello, >>> >>> Looks like this is another manifestation of already seen problem with >>> ath9k-htc >>> and OHCI controller. >>> >>> I'm trying to get USB Wi-Fi dongle based on Atheros AR9271 to work with our >>> development board (this is Synopsys AXS103) and seeing a picture very >>> similar to >>> what was discussed here >>> http://thread.gmane.org/gmane.linux.usb.general/110847 >>> >>> Below is what I see on insertion of the dongle. >>> Note I have the most recent ath9k-htc firmware (see >>> "ath9k_htc/htc_9271-1.4.0.fw" >>> in the log below) and Linux kernel is 4.6.3 (latest stable as of today) but >>> the same >>> happens even on 4.4. >>> >>> Interesting enough if I simply remove or disable the warning like that >>> >8--- >>> diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c >>> index 3d27477..a317e1e 100644 >>> --- a/drivers/usb/core/urb.c >>> +++ b/drivers/usb/core/urb.c >>> @@ -443,11 +443,6 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) >>> * cause problems in HCDs if they get it wrong. >>> */ >>> >>> - /* Check that the pipe's type matches the endpoint's type */ >>> - if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) >>> - dev_WARN(>dev, "BOGUS urb xfer, pipe %x != type %x\n", >>> - usb_pipetype(urb->pipe), pipetypes[xfertype]); >>> - >>> /* Check against a simple/standard policy */ >>> allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | >>> URB_DIR_MASK | >>> URB_FREE_BUFFER); >>> >8--- >>> everything seem to work quite nice. >>> >>> Any thoughts are much appreciated. >>> >>> That's the log itself: >>> >8--- >>> usb 1-1: new full-speed USB device number 2 using ohci-platform >>> usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested >>> usb 1-1: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size: 51008 >>> [ cut here ] >>> WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 >>> usb_submit_urb+0x162/0x404 >>> usb 1-1: BOGUS urb xfer, pipe 1 != type 3 >>> Modules linked in: >>> CPU: 0 PID: 4 Comm: kworker/0:0 Not tainted 4.6.3 #10 >>> Workqueue: events request_firmware_work_func >>> >>> Stack Trace: >>> arc_unwind_core.constprop.1+0x94/0x10c >>> ---[ end trace 2249b79eac9991d1 ]--- >>> [ cut here ] >>> WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 >>> usb_submit_urb+0x162/0x404 >>> usb 1-1: BOGUS urb xfer, pipe 1 != type 3 >>> Modules linked in: >>> CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: GW 4.6.3 #10 >>> Workqueue: events request_firmware_work_func >>> >>> Stack Trace: >>> arc_unwind_core.constprop.1+0x94/0x10c >>> ---[ end trace 2249b79eac9991d2 ]--- >>> [ cut here ] >>> WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 >>> usb_submit_urb+0x162/0x404 >>> usb 1-1: BOGUS urb xfer, pipe 1 != type 3 >>> Modules linked in: >>> CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: GW 4.6.3 #10 >>> Workqueue: events request_firmware_work_func >>> >>> Stack Trace: >>> arc_unwind_core.constprop.1+0x94/0x10c >>> ---[ end trace 2249b79eac9991d3 ]--- >>> >> >> please send content of hif_usb_send_regout() from your source code. >> It is located in drivers/net/wireless/ath/ath9k/hif_usb.c > > I use vanilla 4.6.3 tree so that's what I have is the same as > http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/net/wireless/ath/ath9k/hif_usb.c?h=linu > x-4.6.y#n99 Interesting. Can you please send lsusb -v for this adapter? and it will be interesting to see, which usb endpoint was actualy used. -- Regards, Oleksij signature.asc Description: OpenPGP digital signature
Re: ath9k-htc on OHCI -> bogus usb xfer
Hi Oleksij, On Tue, 2016-07-05 at 19:23 +0200, Oleksij Rempel wrote: > Hi, > > Am 05.07.2016 um 14:20 schrieb Alexey Brodkin: > > > > Hello, > > > > Looks like this is another manifestation of already seen problem with > > ath9k-htc > > and OHCI controller. > > > > I'm trying to get USB Wi-Fi dongle based on Atheros AR9271 to work with our > > development board (this is Synopsys AXS103) and seeing a picture very > > similar to > > what was discussed here > > http://thread.gmane.org/gmane.linux.usb.general/110847 > > > > Below is what I see on insertion of the dongle. > > Note I have the most recent ath9k-htc firmware (see > > "ath9k_htc/htc_9271-1.4.0.fw" > > in the log below) and Linux kernel is 4.6.3 (latest stable as of today) but > > the same > > happens even on 4.4. > > > > Interesting enough if I simply remove or disable the warning like that > > >8--- > > diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c > > index 3d27477..a317e1e 100644 > > --- a/drivers/usb/core/urb.c > > +++ b/drivers/usb/core/urb.c > > @@ -443,11 +443,6 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) > > * cause problems in HCDs if they get it wrong. > > */ > > > > - /* Check that the pipe's type matches the endpoint's type */ > > - if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) > > - dev_WARN(>dev, "BOGUS urb xfer, pipe %x != type %x\n", > > - usb_pipetype(urb->pipe), pipetypes[xfertype]); > > - > > /* Check against a simple/standard policy */ > > allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | > > URB_DIR_MASK | > > URB_FREE_BUFFER); > > >8--- > > everything seem to work quite nice. > > > > Any thoughts are much appreciated. > > > > That's the log itself: > > >8--- > > usb 1-1: new full-speed USB device number 2 using ohci-platform > > usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested > > usb 1-1: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size: 51008 > > [ cut here ] > > WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 > > usb_submit_urb+0x162/0x404 > > usb 1-1: BOGUS urb xfer, pipe 1 != type 3 > > Modules linked in: > > CPU: 0 PID: 4 Comm: kworker/0:0 Not tainted 4.6.3 #10 > > Workqueue: events request_firmware_work_func > > > > Stack Trace: > > arc_unwind_core.constprop.1+0x94/0x10c > > ---[ end trace 2249b79eac9991d1 ]--- > > [ cut here ] > > WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 > > usb_submit_urb+0x162/0x404 > > usb 1-1: BOGUS urb xfer, pipe 1 != type 3 > > Modules linked in: > > CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: GW 4.6.3 #10 > > Workqueue: events request_firmware_work_func > > > > Stack Trace: > > arc_unwind_core.constprop.1+0x94/0x10c > > ---[ end trace 2249b79eac9991d2 ]--- > > [ cut here ] > > WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 > > usb_submit_urb+0x162/0x404 > > usb 1-1: BOGUS urb xfer, pipe 1 != type 3 > > Modules linked in: > > CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: GW 4.6.3 #10 > > Workqueue: events request_firmware_work_func > > > > Stack Trace: > > arc_unwind_core.constprop.1+0x94/0x10c > > ---[ end trace 2249b79eac9991d3 ]--- > > > > please send content of hif_usb_send_regout() from your source code. > It is located in drivers/net/wireless/ath/ath9k/hif_usb.c I use vanilla 4.6.3 tree so that's what I have is the same as http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/net/wireless/ath/ath9k/hif_usb.c?h=linu x-4.6.y#n99 -Alexey-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: ath9k-htc on OHCI -> bogus usb xfer
Hi, Am 05.07.2016 um 14:20 schrieb Alexey Brodkin: > Hello, > > Looks like this is another manifestation of already seen problem with > ath9k-htc > and OHCI controller. > > I'm trying to get USB Wi-Fi dongle based on Atheros AR9271 to work with our > development board (this is Synopsys AXS103) and seeing a picture very similar > to > what was discussed here http://thread.gmane.org/gmane.linux.usb.general/110847 > > Below is what I see on insertion of the dongle. > Note I have the most recent ath9k-htc firmware (see > "ath9k_htc/htc_9271-1.4.0.fw" > in the log below) and Linux kernel is 4.6.3 (latest stable as of today) but > the same > happens even on 4.4. > > Interesting enough if I simply remove or disable the warning like that > >8--- > diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c > index 3d27477..a317e1e 100644 > --- a/drivers/usb/core/urb.c > +++ b/drivers/usb/core/urb.c > @@ -443,11 +443,6 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) > * cause problems in HCDs if they get it wrong. > */ > > - /* Check that the pipe's type matches the endpoint's type */ > - if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) > - dev_WARN(>dev, "BOGUS urb xfer, pipe %x != type %x\n", > - usb_pipetype(urb->pipe), pipetypes[xfertype]); > - > /* Check against a simple/standard policy */ > allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK | > URB_FREE_BUFFER); > >8--- > everything seem to work quite nice. > > Any thoughts are much appreciated. > > That's the log itself: > >8--- > usb 1-1: new full-speed USB device number 2 using ohci-platform > usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested > usb 1-1: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size: 51008 > [ cut here ] > WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 > usb_submit_urb+0x162/0x404 > usb 1-1: BOGUS urb xfer, pipe 1 != type 3 > Modules linked in: > CPU: 0 PID: 4 Comm: kworker/0:0 Not tainted 4.6.3 #10 > Workqueue: events request_firmware_work_func > > Stack Trace: > arc_unwind_core.constprop.1+0x94/0x10c > ---[ end trace 2249b79eac9991d1 ]--- > [ cut here ] > WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 > usb_submit_urb+0x162/0x404 > usb 1-1: BOGUS urb xfer, pipe 1 != type 3 > Modules linked in: > CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: GW 4.6.3 #10 > Workqueue: events request_firmware_work_func > > Stack Trace: > arc_unwind_core.constprop.1+0x94/0x10c > ---[ end trace 2249b79eac9991d2 ]--- > [ cut here ] > WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 > usb_submit_urb+0x162/0x404 > usb 1-1: BOGUS urb xfer, pipe 1 != type 3 > Modules linked in: > CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: GW 4.6.3 #10 > Workqueue: events request_firmware_work_func > > Stack Trace: > arc_unwind_core.constprop.1+0x94/0x10c > ---[ end trace 2249b79eac9991d3 ]--- > please send content of hif_usb_send_regout() from your source code. It is located in drivers/net/wireless/ath/ath9k/hif_usb.c -- Regards, Oleksij signature.asc Description: OpenPGP digital signature
Re: [PATCH 2/2] ath10k: Fix sending NULL/ Qos NULL data frames for QCA99X0 and later
On 06/30/2016 03:25 AM, Valo, Kalle wrote: Ben Greearwrites: Is there a better way than posting to the ath10k mailing list? There are quite a few more of my patches that are stuck in pending or ignored state. If you could review some of them and add them to your testing trees then it might help them go upstream. Yes, as you seem to test with your custom ath10k and custom firmware review and testing feedback from others is more than welcome. That way I can have more confidence that the patch really works with the mainline version. The problem with your patches is that you dump more responsibility on me. I have no idea if they work with the mainline kernel, or if they break something, so I need to personally test the patch and that takes time. Basically I have a rule if that I need to use more than two minutes on a patch it goes to the Deferred queue and I'll go through that less often than the normal patch queue. I can do some testing with stock firmware, but stock firmware is often quite limited so I cannot do the more interesting test cases that we use internally. Some of my patches are for fixing edge cases that cannot be easily reproduced, and that code really needs to be reviewed for correctness more by looking at the code than by trying to run some exhaustive test case. I think if there were a specific maintainer for ath10k that could take a more active role, especially with regard to keeping a fairly wide variety of test rigs around to run regression tests, then it would help all involved. I think this person needs access to firmware source so that they can more easily verify the driver matches the firmware: Many of the regressions and bug fixes, for instance with stats, would be much easier to clean up if you look at firmware while developing the driver bits. Thanks, Ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 02/10] rtlwifi: rtl8192ce: Convert driver to use common hardware info routine
The driver for RTL8192CE chips is converted to use the common routine for getting the hardware information. Reported-by: Arnd BergmannSigned-off-by: Larry Finger Cc: Arnd Bergmann --- V2 - Fixes bug found after V1 was submitted. V3 - No changes. This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls") submitted by Joe Perches. --- .../net/wireless/realtek/rtlwifi/rtl8192ce/hw.c| 83 -- 1 file changed, 12 insertions(+), 71 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c index 809a021..2446079 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c @@ -1680,65 +1680,18 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct device *dev = _pcipriv(hw)->dev.pdev->dev; - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; - - switch (rtlefuse->epromtype) { - case EEPROM_BOOT_EFUSE: - rtl_efuse_shadow_map_update(hw); - break; - - case EEPROM_93C46: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"RTL819X Not boot from eeprom, check it !!\n"); - return; - - default: - dev_warn(dev, "no efuse data\n"); - return; - } - - memcpy(hwinfo, >efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); - - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP", - hwinfo, HWSET_MAX_SIZE); - - eeprom_id = *((u16 *)[0]); - if (eeprom_id != RTL8190_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, -"EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - - if (rtlefuse->autoload_failflag) + int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID, + EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, + EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, + COUNTRY_CODE_WORLD_WIDE_13}; + u8 *hwinfo; + + hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); + if (!hwinfo) return; - rtlefuse->eeprom_vid = *(u16 *)[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *)[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *)[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *)[EEPROM_SMID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); - - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)[EEPROM_MAC_ADDR + i]; - *((u16 *) (>dev_addr[i])) = usvalue; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr); + if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) + goto exit; _rtl92ce_read_txpower_info_from_hwpg(hw, rtlefuse->autoload_failflag, @@ -1747,18 +1700,6 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw) rtl8192ce_read_bt_coexist_info_from_hwpg(hw, rtlefuse->autoload_failflag, hwinfo); - - rtlefuse->eeprom_channelplan = *[EEPROM_CHANNELPLAN]; - rtlefuse->eeprom_version = *(u16 *)[EEPROM_VERSION]; - rtlefuse->txpwr_fromeprom = true; - rtlefuse->eeprom_oemid = *[EEPROM_CUSTOMER_ID]; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); - - /* set channel paln to world wide 13 */ - rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13; - if (rtlhal->oem_id == RT_CID_DEFAULT) { switch (rtlefuse->eeprom_oemid) { case EEPROM_CID_DEFAULT: @@ -1782,10 +1723,10 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw) default: rtlhal->oem_id = RT_CID_DEFAULT; break; - }
[PATCH v3 06/10] rtlwifi: rtl8723ae: Convert driver to use common hardware info routine
The driver for RTL8723AE chips is converted to use the common routine for getting the hardware information. Reported-by: Arnd BergmannSigned-off-by: Larry Finger Cc: Arnd Bergmann --- V2 - Fixes bug found after V1 was submitted. V3 - No changes. This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls") submitted by Joe Perches. --- .../net/wireless/realtek/rtlwifi/rtl8723ae/hw.c| 76 -- 1 file changed, 11 insertions(+), 65 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c index 0025e21..662c445 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c @@ -1630,67 +1630,22 @@ static void _rtl8723e_read_adapter_info(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct device *dev = _pcipriv(hw)->dev.pdev->dev; - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; + int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID, + EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, + EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, + COUNTRY_CODE_WORLD_WIDE_13}; + u8 *hwinfo; if (b_pseudo_test) { /* need add */ return; } - switch (rtlefuse->epromtype) { - case EEPROM_BOOT_EFUSE: - rtl_efuse_shadow_map_update(hw); - - case EEPROM_93C46: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"RTL819X Not boot from eeprom, check it !!\n"); + hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); + if (!hwinfo) return; - default: - dev_warn(dev, "no efuse data\n"); - } - memcpy(hwinfo, >efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); - - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n", - hwinfo, HWSET_MAX_SIZE); - - eeprom_id = *((u16 *)[0]); - if (eeprom_id != RTL8190_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, -"EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - - if (rtlefuse->autoload_failflag) - return; - - rtlefuse->eeprom_vid = *(u16 *)[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *)[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *)[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *)[EEPROM_SMID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); - - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)[EEPROM_MAC_ADDR + i]; - *((u16 *)(>dev_addr[i])) = usvalue; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, -"dev_addr: %pM\n", rtlefuse->dev_addr); + if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) + goto exit; _rtl8723e_read_txpower_info_from_hwpg(hw, rtlefuse->autoload_failflag, hwinfo); @@ -1698,17 +1653,6 @@ static void _rtl8723e_read_adapter_info(struct ieee80211_hw *hw, rtl8723e_read_bt_coexist_info_from_hwpg(hw, rtlefuse->autoload_failflag, hwinfo); - rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN]; - rtlefuse->eeprom_version = *(u16 *)[EEPROM_VERSION]; - rtlefuse->txpwr_fromeprom = true; - rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); - - /* set channel paln to world wide 13 */ - rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13; - if (rtlhal->oem_id == RT_CID_DEFAULT) { switch (rtlefuse->eeprom_oemid) { case EEPROM_CID_DEFAULT: @@ -1836,6 +1780,8 @@ static void _rtl8723e_read_adapter_info(struct ieee80211_hw *hw, } } +exit: + kfree(hwinfo); } static void _rtl8723e_hal_customized_behavior(struct
[PATCH v3 08/10] rtlwifi: rtl8821ae: Convert driver to use common hardware info routine
The driver for RTL8821AE chips is converted to use the common routine for getting the hardware information. Reported-by: Arnd BergmannSigned-off-by: Larry Finger Cc: Arnd Bergmann --- V2 - Fixes bug found after V1 was submitted. V3 - No changes. This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls") submitted by Joe Perches. --- .../net/wireless/realtek/rtlwifi/rtl8821ae/hw.c| 84 +++--- 1 file changed, 11 insertions(+), 73 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c index ac8836b..0cddf1a 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c @@ -3101,86 +3101,22 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_ struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct device *dev = _pcipriv(hw)->dev.pdev->dev; - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; + int params[] = {RTL_EEPROM_ID, EEPROM_VID, EEPROM_DID, + EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, + EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, + COUNTRY_CODE_WORLD_WIDE_13}; + u8 *hwinfo; if (b_pseudo_test) { ;/* need add */ } - switch (rtlefuse->epromtype) { - case EEPROM_BOOT_EFUSE: - rtl_efuse_shadow_map_update(hw); - break; - - case EEPROM_93C46: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"RTL819X Not boot from eeprom, check it !!\n"); - return; - - default: - dev_warn(dev, "no efuse data\n"); - } - memcpy(hwinfo, >efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); - - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n", - hwinfo, HWSET_MAX_SIZE); - - eeprom_id = *((u16 *)[0]); - if (eeprom_id != RTL_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, -"EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - - if (rtlefuse->autoload_failflag) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"RTL8812AE autoload_failflag, check it !!\n"); + hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); + if (!hwinfo) return; - } - - rtlefuse->eeprom_version = *(u8 *)[EEPROM_VERSION]; - if (rtlefuse->eeprom_version == 0xff) - rtlefuse->eeprom_version = 0; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM version: 0x%2x\n", rtlefuse->eeprom_version); - - rtlefuse->eeprom_vid = *(u16 *)[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *)[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *)[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *)[EEPROM_SMID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); - - /*customer ID*/ - rtlefuse->eeprom_oemid = *(u8 *)[EEPROM_CUSTOMER_ID]; - if (rtlefuse->eeprom_oemid == 0xFF) - rtlefuse->eeprom_oemid = 0; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); - - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)[EEPROM_MAC_ADDR + i]; - *((u16 *)(>dev_addr[i])) = usvalue; - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, -"dev_addr: %pM\n", rtlefuse->dev_addr); + if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) + goto exit; _rtl8821ae_read_txpower_info_from_hwpg(hw, rtlefuse->autoload_failflag, hwinfo); @@ -3280,6 +3216,8 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_ break; } } +exit: + kfree(hwinfo); } /*static void _rtl8821ae_hal_customized_behavior(struct ieee80211_hw *hw) --
[PATCH v3 10/10] rtlwifi: rtl8723ae: Clean up the hardware info routine
This driver contains some complicated if ... else if ... else constructions. These are replaced by switch statements to improve readability. Signed-off-by: Larry Finger--- V2 - Changes suggested by Joe Perches were incorporated V3 - Missing break statments are added. This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls") submitted by Joe Perches. --- .../net/wireless/realtek/rtlwifi/rtl8723ae/hw.c| 231 +++-- 1 file changed, 117 insertions(+), 114 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c index 662c445..b88c7ee 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c @@ -1653,132 +1653,135 @@ static void _rtl8723e_read_adapter_info(struct ieee80211_hw *hw, rtl8723e_read_bt_coexist_info_from_hwpg(hw, rtlefuse->autoload_failflag, hwinfo); - if (rtlhal->oem_id == RT_CID_DEFAULT) { - switch (rtlefuse->eeprom_oemid) { - case EEPROM_CID_DEFAULT: - if (rtlefuse->eeprom_did == 0x8176) { - if (CHK_SVID_SMID(0x10EC, 0x6151) || - CHK_SVID_SMID(0x10EC, 0x6152) || - CHK_SVID_SMID(0x10EC, 0x6154) || - CHK_SVID_SMID(0x10EC, 0x6155) || - CHK_SVID_SMID(0x10EC, 0x6177) || - CHK_SVID_SMID(0x10EC, 0x6178) || - CHK_SVID_SMID(0x10EC, 0x6179) || - CHK_SVID_SMID(0x10EC, 0x6180) || - CHK_SVID_SMID(0x10EC, 0x7151) || - CHK_SVID_SMID(0x10EC, 0x7152) || - CHK_SVID_SMID(0x10EC, 0x7154) || - CHK_SVID_SMID(0x10EC, 0x7155) || - CHK_SVID_SMID(0x10EC, 0x7177) || - CHK_SVID_SMID(0x10EC, 0x7178) || - CHK_SVID_SMID(0x10EC, 0x7179) || - CHK_SVID_SMID(0x10EC, 0x7180) || - CHK_SVID_SMID(0x10EC, 0x8151) || - CHK_SVID_SMID(0x10EC, 0x8152) || - CHK_SVID_SMID(0x10EC, 0x8154) || - CHK_SVID_SMID(0x10EC, 0x8155) || - CHK_SVID_SMID(0x10EC, 0x8181) || - CHK_SVID_SMID(0x10EC, 0x8182) || - CHK_SVID_SMID(0x10EC, 0x8184) || - CHK_SVID_SMID(0x10EC, 0x8185) || - CHK_SVID_SMID(0x10EC, 0x9151) || - CHK_SVID_SMID(0x10EC, 0x9152) || - CHK_SVID_SMID(0x10EC, 0x9154) || - CHK_SVID_SMID(0x10EC, 0x9155) || - CHK_SVID_SMID(0x10EC, 0x9181) || - CHK_SVID_SMID(0x10EC, 0x9182) || - CHK_SVID_SMID(0x10EC, 0x9184) || - CHK_SVID_SMID(0x10EC, 0x9185)) + if (rtlhal->oem_id != RT_CID_DEFAULT) + return; + + switch (rtlefuse->eeprom_oemid) { + case EEPROM_CID_DEFAULT: + switch (rtlefuse->eeprom_did) { + case 0x8176: + switch (rtlefuse->eeprom_svid) { + case 0x10EC: + switch (rtlefuse->eeprom_smid) { + case 0x6151 ... 0x6152: + case 0x6154 ... 0x6155: + case 0x6177 ... 0x6180: + case 0x7151 ... 0x7152: + case 0x7154 ... 0x7155: + case 0x7177 ... 0x7180: + case 0x8151 ... 0x8152: + case 0x8154 ... 0x8155: + case 0x8181 ... 0x8182: + case 0x8184 ... 0x8185: + case 0x9151 ... 0x9152: + case 0x9154 ... 0x9155: + case 0x9181 ... 0x9182: + case 0x9184 ... 0x9185: rtlhal->oem_id = RT_CID_TOSHIBA; - else if (rtlefuse->eeprom_svid == 0x1025) - rtlhal->oem_id = RT_CID_819X_ACER; - else if (CHK_SVID_SMID(0x10EC, 0x6191) || -CHK_SVID_SMID(0x10EC, 0x6192) || -
[PATCH v3 09/10] rtlwifi: rtl8192de: Convert driver to use common hardware info routine
The driver for RTL8192DE chips is converted to use the common routine for getting the hardware information. Reported-by: Arnd BergmannSigned-off-by: Larry Finger Cc: Arnd Bergmann --- V2 - Fixes bug found after V1 was submitted. V3 - No changes. This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls") submitted by Joe Perches. --- .../net/wireless/realtek/rtlwifi/rtl8192de/hw.c| 77 +- 1 file changed, 15 insertions(+), 62 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c index 8618c32..b0f6324 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c @@ -1744,71 +1744,26 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct device *dev = _pcipriv(hw)->dev.pdev->dev; - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; - unsigned long flags; + int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID, + EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR_MAC0_92D, + EEPROM_CHANNEL_PLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, + COUNTRY_CODE_WORLD_WIDE_13}; + int i; + u16 usvalue; + u8 *hwinfo; - switch (rtlefuse->epromtype) { - case EEPROM_BOOT_EFUSE: - spin_lock_irqsave(_for_power_and_efuse, flags); - rtl_efuse_shadow_map_update(hw); - _rtl92de_efuse_update_chip_version(hw); - spin_unlock_irqrestore(_for_power_and_efuse, flags); - break; - case EEPROM_93C46: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"RTL819X Not boot from eeprom, check it !!\n"); - return; - default: - dev_warn(dev, "no efuse data\n"); + hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); + if (!hwinfo) return; - } - - memcpy(hwinfo, >efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP", - hwinfo, HWSET_MAX_SIZE); - eeprom_id = *((u16 *)[0]); - if (eeprom_id != RTL8190_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, -"EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - if (rtlefuse->autoload_failflag) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"RTL819X Not boot from eeprom, check it !!\n"); + if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) return; - } - rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; - _rtl92de_read_macphymode_and_bandtype(hw, hwinfo); - /* VID, DID SE 0xA-D */ - rtlefuse->eeprom_vid = *(u16 *)[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *)[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *)[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *)[EEPROM_SMID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); + _rtl92de_efuse_update_chip_version(hw); + _rtl92de_read_macphymode_and_bandtype(hw, hwinfo); - /* Read Permanent MAC address */ - if (rtlhal->interfaceindex == 0) { - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)[EEPROM_MAC_ADDR_MAC0_92D + i]; - *((u16 *) (>dev_addr[i])) = usvalue; - } - } else { + /* Read Permanent MAC address for 2nd interface */ + if (rtlhal->interfaceindex != 0) { for (i = 0; i < 6; i += 2) { usvalue = *(u16 *)[EEPROM_MAC_ADDR_MAC1_92D + i]; *((u16 *) (>dev_addr[i])) = usvalue; @@ -1834,10 +1789,8 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw) rtlefuse->channel_plan = COUNTRY_CODE_FCC; break; } - rtlefuse->eeprom_version = *(u16 *)[EEPROM_VERSION];
[PATCH v3 07/10] rtlwifi: rtl8723be: Convert driver to use common hardware info routine
The driver for RTL8723BE chips is converted to use the common routine for getting the hardware information. Reported-by: Arnd BergmannSigned-off-by: Larry Finger Cc: Arnd Bergmann --- V2 - Fixes bug found after V1 was submitted. V3 - No changes. This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls") submitted by Joe Perches. --- .../net/wireless/realtek/rtlwifi/rtl8723be/hw.c| 74 -- 1 file changed, 12 insertions(+), 62 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c index 63b0df6..cb68c719 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c @@ -2026,10 +2026,12 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct device *dev = _pcipriv(hw)->dev.pdev->dev; - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; + int params[] = {RTL8723BE_EEPROM_ID, EEPROM_VID, EEPROM_DID, + EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, + EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, + COUNTRY_CODE_WORLD_WIDE_13}; + u8 *hwinfo; + int i; bool is_toshiba_smid1 = false; bool is_toshiba_smid2 = false; bool is_samsung_smid = false; @@ -2057,58 +2059,12 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, return; } - switch (rtlefuse->epromtype) { - case EEPROM_BOOT_EFUSE: - rtl_efuse_shadow_map_update(hw); - break; - - case EEPROM_93C46: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"RTL819X Not boot from eeprom, check it !!\n"); + hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); + if (!hwinfo) return; - default: - dev_warn(dev, "no efuse data\n"); - return; - } - memcpy(hwinfo, >efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("MAP\n"), - hwinfo, HWSET_MAX_SIZE); - - eeprom_id = *((u16 *)[0]); - if (eeprom_id != RTL8723BE_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, -"EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - - if (rtlefuse->autoload_failflag) - return; - - rtlefuse->eeprom_vid = *(u16 *)[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *)[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *)[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *)[EEPROM_SMID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); - - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)[EEPROM_MAC_ADDR + i]; - *((u16 *)(>dev_addr[i])) = usvalue; - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "dev_addr: %pM\n", -rtlefuse->dev_addr); + if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) + goto exit; /*parse xtal*/ rtlefuse->crystalcap = hwinfo[EEPROM_XTAL_8723BE]; @@ -2122,14 +2078,6 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, rtlefuse->autoload_failflag, hwinfo); - rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN]; - rtlefuse->eeprom_version = *(u16 *)[EEPROM_VERSION]; - rtlefuse->txpwr_fromeprom = true; - rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); - /* set channel plan from efuse */ rtlefuse->channel_plan = rtlefuse->eeprom_channelplan; @@ -2240,6 +2188,8 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, break; } } +exit: +
[PATCH v3 05/10] rtlwifi: rtl8192ee: Convert driver to use common hardware info routine
The driver for RTL8192EE chips is converted to use the common routine for getting the hardware information. Reported-by: Arnd BergmannSigned-off-by: Larry Finger Cc: Arnd Bergmann --- V2 - Fixes bug found after V1 was submitted. V3 - No changes. This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls") submitted by Joe Perches. --- .../net/wireless/realtek/rtlwifi/rtl8192ee/hw.c| 73 -- 1 file changed, 12 insertions(+), 61 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c index 9d1ecba..b07af8d 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c @@ -2098,75 +2098,24 @@ static void _rtl92ee_read_adapter_info(struct ieee80211_hw *hw) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; - - switch (rtlefuse->epromtype) { - case EEPROM_BOOT_EFUSE: - rtl_efuse_shadow_map_update(hw); - break; - - case EEPROM_93C46: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"RTL819X Not boot from eeprom, check it !!\n"); - return; - - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"boot from neither eeprom nor efuse, check it !!\n"); + int params[] = {RTL8192E_EEPROM_ID, EEPROM_VID, EEPROM_DID, + EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, + EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, + COUNTRY_CODE_WORLD_WIDE_13}; + u8 *hwinfo; + + hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); + if (!hwinfo) return; - } - memcpy(hwinfo, >efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n", - hwinfo, HWSET_MAX_SIZE); + if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) + goto exit; - eeprom_id = *((u16 *)[0]); - if (eeprom_id != RTL8192E_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, -"EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - - if (rtlefuse->autoload_failflag) - return; - /*VID DID SVID SDID*/ - rtlefuse->eeprom_vid = *(u16 *)[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *)[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *)[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *)[EEPROM_SMID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); - /*customer ID*/ - rtlefuse->eeprom_oemid = *(u8 *)[EEPROM_CUSTOMER_ID]; if (rtlefuse->eeprom_oemid == 0xFF) rtlefuse->eeprom_oemid = 0; RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); - /*EEPROM version*/ - rtlefuse->eeprom_version = *(u8 *)[EEPROM_VERSION]; - /*mac address*/ - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)[EEPROM_MAC_ADDR + i]; - *((u16 *)(>dev_addr[i])) = usvalue; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, -"dev_addr: %pM\n", rtlefuse->dev_addr); - /*channel plan */ - rtlefuse->eeprom_channelplan = *(u8 *)[EEPROM_CHANNELPLAN]; /* set channel plan from efuse */ rtlefuse->channel_plan = rtlefuse->eeprom_channelplan; /*tx power*/ @@ -2208,6 +2157,8 @@ static void _rtl92ee_read_adapter_info(struct ieee80211_hw *hw) break; } } +exit: + kfree(hwinfo); } static void _rtl92ee_hal_customized_behavior(struct ieee80211_hw *hw) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/10 V3] rtlwifi: Various clean-ups for the hwinfo routines
The rtlwifi family of drivers use similar routines to extract hardware information from EFUSE. This set of patches create a common routine to extract this data, and converts most of the drivers to use this routine. In addition, a complicated set of if ... else if ... else statements are present in rtl8723ae. These are converted into switch statements that are much easier to read. The changes in the hwinfo routines was suggested by Arnd Bergmann. All of this material is intended for kernel 4.8. Signed-off-by: Larry Finger--- V2 - Applied changes suggested by Joe Perches Fixed a bug found after V1 was submitted These patches require ("rtlwifi: Add missing newlines to RT_TRACE calls") submitted by Joe Perches. v3 - Adding missing break statements. Larry Finger (10): rtlwifi: Create common routine to get hardware info rtlwifi: rtl8192ce: Convert driver to use common hardware info routine rtlwifi: rtl8192cu: Convert driver to use common hardware info routine rtlwifi: rtl8188ee: Convert driver to use common hardware info routine rtlwifi: rtl8192ee: Convert driver to use common hardware info routine rtlwifi: rtl8723ee: Convert driver to use common hardware info routine rtlwifi: rtl8723be: Convert driver to use common hardware info routine rtlwifi: rtl8821ae: Convert driver to use common hardware info routine rtlwifi: rtl8192de: Convert driver to use common hardware info routine rtlwifi: rtl8723ae: Clean up the hardware info routine drivers/net/wireless/realtek/rtlwifi/efuse.c | 78 ++ drivers/net/wireless/realtek/rtlwifi/efuse.h | 2 + .../net/wireless/realtek/rtlwifi/rtl8188ee/hw.c| 76 +- .../net/wireless/realtek/rtlwifi/rtl8192ce/hw.c| 83 +- .../net/wireless/realtek/rtlwifi/rtl8192cu/hw.c| 61 ++--- .../net/wireless/realtek/rtlwifi/rtl8192de/hw.c| 77 ++ .../net/wireless/realtek/rtlwifi/rtl8192ee/hw.c| 73 +- .../net/wireless/realtek/rtlwifi/rtl8723ae/hw.c| 286 + .../net/wireless/realtek/rtlwifi/rtl8723be/hw.c| 74 +- .../net/wireless/realtek/rtlwifi/rtl8821ae/hw.c| 84 +- 10 files changed, 288 insertions(+), 606 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 03/10] rtlwifi: rtl8192cu: Convert driver to use common hardware info routine
The driver for RTL8192CU chips is converted to use the common routine for getting the hardware information. Reported-by: Arnd BergmannSigned-off-by: Larry Finger Cc: Arnd Bergmann --- V2 - Fixes bug found after V1 was submitted. V3 - No changes. This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls") submitted by Joe Perches. --- .../net/wireless/realtek/rtlwifi/rtl8192cu/hw.c| 61 ++ 1 file changed, 15 insertions(+), 46 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c index ae1129f..8789752 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c @@ -347,56 +347,24 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE] = {0}; - u16 eeprom_id; - - switch (rtlefuse->epromtype) { - case EEPROM_BOOT_EFUSE: - rtl_efuse_shadow_map_update(hw); - break; - - case EEPROM_93C46: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"RTL819X Not boot from eeprom, check it !!\n"); + int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID, + EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, + EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, + 0}; + u8 *hwinfo; + + hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); + if (!hwinfo) return; - default: - pr_warn("rtl92cu: no efuse data\n\n"); - return; - } - memcpy(hwinfo, >efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_LOUD, "MAP", - hwinfo, HWSET_MAX_SIZE); - eeprom_id = le16_to_cpu(*((__le16 *)[0])); - if (eeprom_id != RTL8190_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - if (rtlefuse->autoload_failflag) - return; - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)[EEPROM_MAC_ADDR + i]; - *((u16 *) (>dev_addr[i])) = usvalue; - } - pr_info("MAC address: %pM\n", rtlefuse->dev_addr); + if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) + goto exit; + _rtl92cu_read_txpower_info_from_hwpg(hw, rtlefuse->autoload_failflag, hwinfo); - rtlefuse->eeprom_vid = le16_to_cpu(*(__le16 *)[EEPROM_VID]); - rtlefuse->eeprom_did = le16_to_cpu(*(__le16 *)[EEPROM_DID]); - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, " VID = 0x%02x PID = 0x%02x\n", -rtlefuse->eeprom_vid, rtlefuse->eeprom_did); - rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN]; - rtlefuse->eeprom_version = -le16_to_cpu(*(__le16 *)[EEPROM_VERSION]); + _rtl92cu_read_board_type(hw, hwinfo); + rtlefuse->txpwr_fromeprom = true; - rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x\n", -rtlefuse->eeprom_oemid); if (rtlhal->oem_id == RT_CID_DEFAULT) { switch (rtlefuse->eeprom_oemid) { case EEPROM_CID_DEFAULT: @@ -422,7 +390,8 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw) break; } } - _rtl92cu_read_board_type(hw, hwinfo); +exit: + kfree(hwinfo); } static void _rtl92cu_hal_customized_behavior(struct ieee80211_hw *hw) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 01/10] rtlwifi: Create common routine to get hardware info
All of the rtlwifi family of drivers have a similar routine that acquires the hardware info from efuse and initializes a number of variables in the driver's private area. A common routine is created for all drivers to use. Reported-by: Arnd BergmannSigned-off-by: Larry Finger Cc: Arnd Bergmann --- V2 - Fixes bug found after V1 was submitted. V3 - No changes. This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls") submitted by Joe Perches. --- drivers/net/wireless/realtek/rtlwifi/efuse.c | 78 drivers/net/wireless/realtek/rtlwifi/efuse.h | 2 + 2 files changed, 80 insertions(+) diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.c b/drivers/net/wireless/realtek/rtlwifi/efuse.c index 0b4082c..7becfef 100644 --- a/drivers/net/wireless/realtek/rtlwifi/efuse.c +++ b/drivers/net/wireless/realtek/rtlwifi/efuse.c @@ -24,6 +24,7 @@ */ #include "wifi.h" #include "efuse.h" +#include "pci.h" #include static const u8 MAX_PGPKT_SIZE = 9; @@ -1243,3 +1244,80 @@ static u8 efuse_calculate_word_cnts(u8 word_en) return word_cnts; } +int rtl_get_hwinfo(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv, + int max_size, u8 *hwinfo, int *params) +{ + struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); + struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); + struct device *dev = >dev.pdev->dev; + u16 eeprom_id; + u16 i, usvalue; + + switch (rtlefuse->epromtype) { + case EEPROM_BOOT_EFUSE: + rtl_efuse_shadow_map_update(hw); + break; + + case EEPROM_93C46: + RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, +"RTL8XXX did not boot from eeprom, check it !!\n"); + return 1; + + default: + dev_warn(dev, "no efuse data\n"); + return 1; + } + + memcpy(hwinfo, >efuse_map[EFUSE_INIT_MAP][0], max_size); + + RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP", + hwinfo, max_size); + + eeprom_id = *((u16 *)[0]); + if (eeprom_id != params[0]) { + RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, +"EEPROM ID(%#x) is invalid!!\n", eeprom_id); + rtlefuse->autoload_failflag = true; + } else { + RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); + rtlefuse->autoload_failflag = false; + } + + if (rtlefuse->autoload_failflag) + return 1; + + rtlefuse->eeprom_vid = *(u16 *)[params[1]]; + rtlefuse->eeprom_did = *(u16 *)[params[2]]; + rtlefuse->eeprom_svid = *(u16 *)[params[3]]; + rtlefuse->eeprom_smid = *(u16 *)[params[4]]; + RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, +"EEPROMId = 0x%4x\n", eeprom_id); + RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, +"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); + RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, +"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); + RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, +"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); + RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, +"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); + + for (i = 0; i < 6; i += 2) { + usvalue = *(u16 *)[params[5] + i]; + *((u16 *)(>dev_addr[i])) = usvalue; + } + RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr); + + rtlefuse->eeprom_channelplan = *[params[6]]; + rtlefuse->eeprom_version = *(u16 *)[params[7]]; + rtlefuse->txpwr_fromeprom = true; + rtlefuse->eeprom_oemid = *[params[8]]; + + RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, +"EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); + + /* set channel plan to world wide 13 */ + rtlefuse->channel_plan = params[9]; + + return 0; +} +EXPORT_SYMBOL_GPL(rtl_get_hwinfo); diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.h b/drivers/net/wireless/realtek/rtlwifi/efuse.h index be02e78..51aa121 100644 --- a/drivers/net/wireless/realtek/rtlwifi/efuse.h +++ b/drivers/net/wireless/realtek/rtlwifi/efuse.h @@ -109,5 +109,7 @@ bool efuse_shadow_update_chk(struct ieee80211_hw *hw); void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw); void efuse_force_write_vendor_Id(struct ieee80211_hw *hw); void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx); +int rtl_get_hwinfo(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv, + int max_size, u8 *hwinfo, int *params); #endif -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 04/10] rtlwifi: rtl8188ee: Convert driver to use common hardware info routine
The driver for RTL8188EE chips is converted to use the common routine for getting the hardware information. Reported-by: Arnd BergmannSigned-off-by: Larry Finger Cc: Arnd Bergmann --- V2 - Fixes bug found after V1 was submitted. V3 - No changes. This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls") submitted by Joe Perches. --- .../net/wireless/realtek/rtlwifi/rtl8188ee/hw.c| 76 -- 1 file changed, 13 insertions(+), 63 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c index cfdf6d8..4ab6201 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c @@ -1835,76 +1835,24 @@ static void _rtl88ee_read_adapter_info(struct ieee80211_hw *hw) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; - - switch (rtlefuse->epromtype) { - case EEPROM_BOOT_EFUSE: - rtl_efuse_shadow_map_update(hw); - break; - - case EEPROM_93C46: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"RTL819X Not boot from eeprom, check it !!\n"); + int params[] = {RTL8188E_EEPROM_ID, EEPROM_VID, EEPROM_DID, + EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR, + EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID, + COUNTRY_CODE_WORLD_WIDE_13}; + u8 *hwinfo; + + hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL); + if (!hwinfo) return; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, -"boot from neither eeprom nor efuse, check it !!\n"); - return; - } - memcpy(hwinfo, >efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE); - - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n", - hwinfo, HWSET_MAX_SIZE); - - eeprom_id = *((u16 *)[0]); - if (eeprom_id != RTL8188E_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, -"EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } + if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params)) + goto exit; - if (rtlefuse->autoload_failflag == true) - return; - /*VID DID SVID SDID*/ - rtlefuse->eeprom_vid = *(u16 *)[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *)[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *)[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *)[EEPROM_SMID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); - /*customer ID*/ - rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; if (rtlefuse->eeprom_oemid == 0xFF) - rtlefuse->eeprom_oemid =0; + rtlefuse->eeprom_oemid = 0; RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); - /*EEPROM version*/ - rtlefuse->eeprom_version = *(u16 *)[EEPROM_VERSION]; - /*mac address*/ - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)[EEPROM_MAC_ADDR + i]; - *((u16 *)(>dev_addr[i])) = usvalue; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, -"dev_addr: %pM\n", rtlefuse->dev_addr); - /*channel plan */ - rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN]; /* set channel plan from efuse */ rtlefuse->channel_plan = rtlefuse->eeprom_channelplan; /*tx power*/ @@ -1978,6 +1926,8 @@ static void _rtl88ee_read_adapter_info(struct ieee80211_hw *hw) } } +exit: + kfree(hwinfo); } static void _rtl88ee_hal_customized_behavior(struct ieee80211_hw *hw) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
4.8 merge window closing
Hi, Linus released 4.7-rc6 last Sunday but didn't give any hints how close the real release is, but nevertheless the merge window for 4.8 is getting quite close so if there's anything you want to have in wireless-drivers-next for 4.8 better send them NOW. Especially as I won't have that much time to apply patches the next two weeks. -- Kalle Valo -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [1/6] rtlwifi: Remove unused parameter from rtl_ps_set_rf_state()
Larry Fingerwrote: > Commit 4b9d8d67b44a ("rtlwifi: rtl8192cu: Remove unused parameter") reworked > this routine. Those changes were later reverted by commit d3feae41a347 > ("rtlwifi: Update power-save routines for 062814 driver"). > > There were two changes in commit 4b9d8d67b44a. The first of these removed > a parameter from rtl_ps_set_rf_state() that was always false. This is the > change that is restored in the current patch. A second change that reworked > the locking is still being analyzed. > > In addition to removing the unused parameter, there is no need for > rtl_ps_set_rf_state() to be exported. > > Reported-by: Pavel Andrianov > Signed-off-by: Larry Finger > Cc: Pavel Andrianov Thanks, 6 patches applied to wireless-drivers-next.git: 30462b514fb3 rtlwifi: Remove unused parameter from rtl_ps_set_rf_state() 204e2ab22e1e rtlwifi: rtl8188ee: Fix potential race condition c3ae8ec4a264 rtlwifi: rtl8192ee: Fix potential race condition 31c2e76c77fb rtlwifi: rtl8723be: Fix potential race condition 4f29b348bdc0 rtlwifi: rtl8723ae: Fix potential race condition 300c32ca84f5 rtlwifi: rtl8821ae: Fix potential race condition -- Sent by pwcli https://patchwork.kernel.org/patch/9198637/ -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: mwifiex: disable MSIx interrupt for 8997 chipset
Amitkumar Karwarwrote: > From: Shengzhen Li > > Sometimes MSIx interrupts are received out of order on multi-core > system. This creates a problem when there is a race between data > packet and SLEEP event from firmware. We will disable MSIx interrupt > mode to solve the problem and go with MSI mode. > > Signed-off-by: Shengzhen Li > Signed-off-by: Amitkumar Karwar Thanks, 1 patch applied to wireless-drivers-next.git: bf942091678c mwifiex: disable MSIx interrupt for 8997 chipset -- Sent by pwcli https://patchwork.kernel.org/patch/9190001/ -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] nl80211: Add info to scan results to support beacon report
On Tue, 2016-07-05 at 17:10 +0300, Luca Coelho wrote: > From: Avraham Stern> > Beacon report radio measurement requires reporting observed BSSs > on the channels specified in the beacon request. If the measurement > mode is set to passive or active, it requires actually performing a > scan (passive or active, accordingly), and reporting the time that > the scan was started and the time each beacon/probe was received > (both in terms of TSF of the BSS of the requesting AP). If the > request mode is table, this information is optional. > In addition, the radio measurement request specifies the channel > dwell time for the measurement. > > In order to use scan for beacon report when the mode is active or > passive, add a parameter to scan request that specifies the > channel dwell time, and add scan start time and beacon received time > to scan results information. > > Supporting beacon report is required for Multi Band Operation (MBO). > > Signed-off-by: Assaf Krauss > Signed-off-by: David Spinadel > Signed-off-by: Avraham Stern > Signed-off-by: Luca Coelho > --- Forgot to say, the non-mac80211 driver changes are just compiled- tested. -- Luca. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] nl80211: Add info to scan results to support beacon report
From: Avraham SternBeacon report radio measurement requires reporting observed BSSs on the channels specified in the beacon request. If the measurement mode is set to passive or active, it requires actually performing a scan (passive or active, accordingly), and reporting the time that the scan was started and the time each beacon/probe was received (both in terms of TSF of the BSS of the requesting AP). If the request mode is table, this information is optional. In addition, the radio measurement request specifies the channel dwell time for the measurement. In order to use scan for beacon report when the mode is active or passive, add a parameter to scan request that specifies the channel dwell time, and add scan start time and beacon received time to scan results information. Supporting beacon report is required for Multi Band Operation (MBO). Signed-off-by: Assaf Krauss Signed-off-by: David Spinadel Signed-off-by: Avraham Stern Signed-off-by: Luca Coelho --- drivers/net/wireless/ath/ath6kl/cfg80211.c | 17 +++-- drivers/net/wireless/ath/wil6210/cfg80211.c| 6 +++- drivers/net/wireless/ath/wil6210/main.c| 12 +-- drivers/net/wireless/ath/wil6210/p2p.c | 6 +++- drivers/net/wireless/ath/wil6210/wmi.c | 8 +++-- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 6 +++- drivers/net/wireless/intersil/orinoco/scan.c | 12 +-- drivers/net/wireless/marvell/libertas/cfg.c| 11 -- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 12 +-- drivers/net/wireless/marvell/mwifiex/main.c| 6 +++- drivers/net/wireless/marvell/mwifiex/scan.c| 12 +-- drivers/net/wireless/rndis_wlan.c | 10 -- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 11 -- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 12 +-- drivers/staging/wlan-ng/cfg80211.c | 5 ++- include/net/cfg80211.h | 40 ++--- include/uapi/linux/nl80211.h | 42 ++ net/mac80211/scan.c| 9 +++-- net/wireless/core.c| 4 +-- net/wireless/core.h| 12 +++ net/wireless/nl80211.c | 27 ++ net/wireless/scan.c| 18 ++ net/wireless/trace.h | 33 - 23 files changed, 279 insertions(+), 52 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 4e11ba0..ef5b40e 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -859,7 +859,11 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason, struct ath6kl *ar = vif->ar; if (vif->scan_req) { - cfg80211_scan_done(vif->scan_req, true); + struct cfg80211_scan_info info = { + .aborted = true, + }; + + cfg80211_scan_done(vif->scan_req, ); vif->scan_req = NULL; } @@ -1069,6 +1073,9 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, void ath6kl_cfg80211_scan_complete_event(struct ath6kl_vif *vif, bool aborted) { struct ath6kl *ar = vif->ar; + struct cfg80211_scan_info info = { + .aborted = aborted, + }; int i; ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: status%s\n", __func__, @@ -1089,7 +1096,7 @@ void ath6kl_cfg80211_scan_complete_event(struct ath6kl_vif *vif, bool aborted) } out: - cfg80211_scan_done(vif->scan_req, aborted); + cfg80211_scan_done(vif->scan_req, ); vif->scan_req = NULL; } @@ -3614,7 +3621,11 @@ void ath6kl_cfg80211_vif_stop(struct ath6kl_vif *vif, bool wmi_ready) } if (vif->scan_req) { - cfg80211_scan_done(vif->scan_req, true); + struct cfg80211_scan_info info = { + .aborted = true, + }; + + cfg80211_scan_done(vif->scan_req, ); vif->scan_req = NULL; } diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index 62bf933..f0e1175 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -1369,7 +1369,11 @@ static void wil_cfg80211_stop_p2p_device(struct wiphy *wiphy, mutex_lock(>mutex); started = wil_p2p_stop_discovery(wil); if (started && wil->scan_request) { - cfg80211_scan_done(wil->scan_request, 1); + struct cfg80211_scan_info info = { + .aborted = true, + }; + +
Re: [PATCH 3/4] rtl8xxxu: Mark 0x20f4:0x648b as tested
jes.soren...@redhat.com writes: > From: Jes Sorensen> > Successfully tested by Jocelyn Mayer > > Reported-by: J. Mayer > Signed-off-by: Jes Sorensen > --- > drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 9 +++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > index cfa5528..90d21c3 100644 > --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > @@ -5852,6 +5852,10 @@ static int rtl8xxxu_probe(struct usb_interface > *interface, > if (id->idProduct == 0x1004) > untested = 0; > break; > + case 0x20f4: > + if (id->idProduct == 0x648b) > + untested = 0; > + break; > default: > break; > } > @@ -6021,6 +6025,9 @@ static struct usb_device_id dev_table[] = { > /* Tested by Andrea Merello */ > {USB_DEVICE_AND_INTERFACE_INFO(0x050d, 0x1004, 0xff, 0xff, 0xff), > .driver_info = (unsigned long)_fops}, > +/* Tested by Jocelyn Mayer */ > +{USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0x648b, 0xff, 0xff, 0xff), > + .driver_info = (unsigned long)_fops}, > /* Currently untested 8188 series devices */ > {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8191, 0xff, 0xff, > 0xff), > .driver_info = (unsigned long)_fops}, > @@ -6080,8 +6087,6 @@ static struct usb_device_id dev_table[] = { > .driver_info = (unsigned long)_fops}, > {USB_DEVICE_AND_INTERFACE_INFO(0x2019, 0xed17, 0xff, 0xff, 0xff), > .driver_info = (unsigned long)_fops}, > -{USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0x648b, 0xff, 0xff, 0xff), > - .driver_info = (unsigned long)_fops}, > {USB_DEVICE_AND_INTERFACE_INFO(0x4855, 0x0090, 0xff, 0xff, 0xff), > .driver_info = (unsigned long)_fops}, > {USB_DEVICE_AND_INTERFACE_INFO(0x4856, 0x0091, 0xff, 0xff, 0xff), But will this now conflict with rtlwifi? drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c:{RTL_USB_DEVICE(0x20f4, 0x648b, rtl92cu_hal_cfg)}, /*TRENDnet - Cameo*/ Like discussed before, I don't like having two drivers support same hardware and users more or less randomly using either of them. -- Kalle Valo -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/4] rtl8xxxu: Mark 0x2001:0x3308 as tested
jes.soren...@redhat.com writes: > From: Jes Sorensen> > D-Link DWA-121 is reported as working. > > Reported-by: Stefano Bravi > Signed-off-by: Jes Sorensen > --- > drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 9 +++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > index 90d21c3..dfe61e4 100644 > --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > @@ -5856,6 +5856,10 @@ static int rtl8xxxu_probe(struct usb_interface > *interface, > if (id->idProduct == 0x648b) > untested = 0; > break; > + case 0x2001: > + if (id->idProduct == 0x3308) > + untested = 0; > + break; > default: > break; > } > @@ -6028,6 +6032,9 @@ static struct usb_device_id dev_table[] = { > /* Tested by Jocelyn Mayer */ > {USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0x648b, 0xff, 0xff, 0xff), > .driver_info = (unsigned long)_fops}, > +/* Tested by Stefano Bravi */ > +{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3308, 0xff, 0xff, 0xff), > + .driver_info = (unsigned long)_fops}, > /* Currently untested 8188 series devices */ > {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8191, 0xff, 0xff, > 0xff), > .driver_info = (unsigned long)_fops}, > @@ -6075,8 +6082,6 @@ static struct usb_device_id dev_table[] = { > .driver_info = (unsigned long)_fops}, > {USB_DEVICE_AND_INTERFACE_INFO(0x13d3, 0x3357, 0xff, 0xff, 0xff), > .driver_info = (unsigned long)_fops}, > -{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3308, 0xff, 0xff, 0xff), > - .driver_info = (unsigned long)_fops}, Isn't this also supported by rtlwifi? drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c:{RTL_USB_DEVICE(0x2001, 0x3308, rtl92cu_hal_cfg)}, /*D-Link - Alpha*/ -- Kalle Valo -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [linux-sunxi] Re: [PATCH 1/4] brcmfmac: Add brcm,nvram_file_name dt property
On Monday, July 4, 2016 8:36:05 PM CEST Arend van Spriel wrote: > On 04-07-16 16:54, Arnd Bergmann wrote: > > On Monday, July 4, 2016 11:08:38 AM CEST Arend Van Spriel wrote: > > > > In drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c I already see > > over a dozen different chips being supported, bcm4329 is only one of > > them. In particular, there seem to be some that have various modules: > > > > BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x001F, 43241B0), > > BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0020, 43241B4), > > BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFC0, 43241B5), > > > > So if you have a bcm43241, that compatible string probably should > > include both brcm,bcm43241-b4-fmac and brcm,bcm43241-fmac, possibly also > > brcm,bcm4329-fmac, to show that it is a superset of the programming > > interface of that one. > > Hi Arnd, > > I have to disagree here. The compatible string "brcm,bcm4329-fmac" is > chosen as the bcm4329 chip was the first supported and we never added > others as there is no other programming required. For all supported > devices the same device tree properties apply and are handled the same. > As such there is no need to come up with a new compatible string. Generally speaking, the way that the compatible strings work is that you add a new one whenever you get a new piece of hardware, and you can leave the first one as a fallback so you don't have to change the driver. Adding the new string for the actual device is important though, since you might only discover later that they are not 100% compatible and that you in fact need to know the difference. For discoverable buses like sdio or usb, it may actually be better to not identify the device through the compatible property at all, and instead use a string that is generated from the actual identifier as the primary key, as e.g. documented in Documentation/devicetree/bindings/usb/usb-device.txt The mmc binding is less clear about that, and we may want to correct that. In fact, the example in Documentation/devicetree/bindings/mmc/mmc.txt even lists an invalid compatible string, so that is even worse. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [v2, 1/3] mwifiex: add a cfg80211 .get_tx_power operation callback
Javier Martinez Canillaswrote: > The mwifiex driver implements a cfg80211 .set_tx_power operation handler > but doesn't have the inverse .get_tx_power callback. > > This not only has the effect that the Tx power can't be reported to user > space tools such as iwconfig and iwlist but also that the wireless core > prints a warning when a new wiphy is created due an cfg80211 operation > being implemented without its counterpart. > > After this patch, the Tx power is properly reported to user-space tools: > > $ iwlist mlan0 txpower > mlan0 unknown transmit-power information. > > Current Tx-Power=13 dBm (19 mW) > > and also the following warning isn't shown anymore on the driver probe: > > WARNING: CPU: 3 PID: 127 at net/wireless/core.c:366 wiphy_new_nm+0x66c/0x6ac > Modules linked in: mwifiex_sdio mwifiex > CPU: 3 PID: 127 Comm: kworker/3:1 Tainted: GW > 4.7.0-rc1-next-20160531-6-g569df5b983f3 > Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) > Workqueue: events request_firmware_work_func > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (dump_stack+0x88/0x9c) > [] (dump_stack) from [] (__warn+0xe8/0x100) > [] (__warn) from [] (warn_slowpath_null+0x20/0x28) > [] (warn_slowpath_null) from [] (wiphy_new_nm+0x66c/0x6ac) > [] (wiphy_new_nm) from [] > (mwifiex_register_cfg80211+0x28/0x3f0 [mwifiex]) > [] (mwifiex_register_cfg80211 [mwifiex]) from [] > (mwifiex_fw_dpc+0x2b0/0x474 [mwifiex]) > [] (mwifiex_fw_dpc [mwifiex]) from [] > (request_firmware_work_func+0x30/0x58) > [] (request_firmware_work_func) from [] > (process_one_work+0x124/0x338) > [] (process_one_work) from [] (worker_thread+0x38/0x4d4) > [] (worker_thread) from [] (kthread+0xdc/0xf4) > [] (kthread) from [] (ret_from_fork+0x14/0x3c) > > Signed-off-by: Javier Martinez Canillas > Tested-by: Enric Balletbo i Serra Thanks, 2 patches applied to wireless-drivers-next.git: 7d54bacadce1 mwifiex: add a cfg80211 .get_tx_power operation callback 3ee712857958 mwifiex: add get_antenna support for cfg80211 -- Sent by pwcli https://patchwork.kernel.org/patch/9158855/ -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] nl80211: Add info to scan results to support beacon report
On Tue, 2016-07-05 at 15:23 +0300, Luca Coelho wrote: > From: Avraham Stern> > Beacon report radio measurement requires reporting observed BSSs > on the channels specified in the beacon request. If the measurement > mode is set to passive or active, it requires actually performing a > scan (passive or active, accordingly), and reporting the time that > the scan was started and the time each beacon/probe was received > (both in terms of TSF of the BSS of the requesting AP). If the > request mode is table, this information is optional. > In addition, the radio measurement request specifies the channel > dwell time for the measurement. > > In order to use scan for beacon report when the mode is active or > passive, add a parameter to scan request that specifies the > channel dwell time, and add scan start time and beacon received time > to scan results information. > > Supporting beacon report is required for Multi Band Operation (MBO). > > Signed-off-by: Assaf Krauss > Signed-off-by: David Spinadel > Signed-off-by: Avraham Stern > Signed-off-by: Luca Coelho > --- > include/net/cfg80211.h | 40 > +++- > include/uapi/linux/nl80211.h | 42 > ++ > net/mac80211/scan.c | 9 +++-- > net/wireless/core.c | 4 ++-- > net/wireless/core.h | 12 > net/wireless/nl80211.c | 27 +++ > net/wireless/scan.c | 18 -- > net/wireless/trace.h | 33 + > 8 files changed, 162 insertions(+), 23 deletions(-) Ouch, I missed changing the APIs of the non-cfg80211 drivers here. I'll fix and resend. Thanks to kbuild test robot for reporting. :) -- Luca.N�r��yb�X��ǧv�^�){.n�+{��*ޕ�,�{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj"��!�i
Re: mwifiex: fix unconditional error return in .add_virtual_intf callback
Javier Martinez Canillaswrote: > The commit 7311ea850079 ("mwifiex: fix AP start problem for newly added > interface") attempted to fix an issue when a new AP interface is added. > > But the patch didn't check the return value of the functions doing the > firmware calls and returned an error even if the functions didn't fail. > > This prevents the network device to be registered properly, so fix it. > > Fixes: 7311ea850079 ("mwifiex: fix AP start problem for newly added > interface") > Signed-off-by: Javier Martinez Canillas > Reviewed-by: Julian Calaby Thanks, 1 patch applied to wireless-drivers-next.git: f152bdad6208 mwifiex: fix unconditional error return in .add_virtual_intf callback -- Sent by pwcli https://patchwork.kernel.org/patch/9210355/ -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] nl80211: Add info to scan results to support beacon report
Hi, [auto build test ERROR on mac80211-next/master] [also build test ERROR on next-20160705] [cannot apply to v4.7-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Luca-Coelho/mac80211-cfg80211-a-bunch-of-patches-from-our-internal-tree/20160705-202748 base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master config: i386-randconfig-n0-201627 (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430 reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): drivers/net/wireless/ath/wil6210/main.c: In function 'wil_reset': >> drivers/net/wireless/ath/wil6210/main.c:856:41: warning: passing argument 2 >> of 'cfg80211_scan_done' makes pointer from integer without a cast >> [-Wint-conversion] cfg80211_scan_done(wil->scan_request, true); ^~~~ In file included from drivers/net/wireless/ath/wil6210/wil6210.h:22:0, from drivers/net/wireless/ath/wil6210/main.c:21: include/net/cfg80211.h:4102:6: note: expected 'struct cfg80211_scan_info *' but argument is of type 'int' void cfg80211_scan_done(struct cfg80211_scan_request *request, ^~ drivers/net/wireless/ath/wil6210/main.c: In function '__wil_down': drivers/net/wireless/ath/wil6210/main.c:1055:41: warning: passing argument 2 of 'cfg80211_scan_done' makes pointer from integer without a cast [-Wint-conversion] cfg80211_scan_done(wil->scan_request, true); ^~~~ In file included from drivers/net/wireless/ath/wil6210/wil6210.h:22:0, from drivers/net/wireless/ath/wil6210/main.c:21: include/net/cfg80211.h:4102:6: note: expected 'struct cfg80211_scan_info *' but argument is of type 'int' void cfg80211_scan_done(struct cfg80211_scan_request *request, ^~ -- drivers/net/wireless/ath/wil6210/cfg80211.c: In function 'wil_cfg80211_stop_p2p_device': >> drivers/net/wireless/ath/wil6210/cfg80211.c:1372:41: warning: passing >> argument 2 of 'cfg80211_scan_done' makes pointer from integer without a cast >> [-Wint-conversion] cfg80211_scan_done(wil->scan_request, 1); ^ In file included from drivers/net/wireless/ath/wil6210/wil6210.h:22:0, from drivers/net/wireless/ath/wil6210/cfg80211.c:18: include/net/cfg80211.h:4102:6: note: expected 'struct cfg80211_scan_info *' but argument is of type 'int' void cfg80211_scan_done(struct cfg80211_scan_request *request, ^~ -- drivers/net/wireless/ath/wil6210/wmi.c: In function 'wmi_evt_scan_complete': >> drivers/net/wireless/ath/wil6210/wmi.c:437:41: error: incompatible type for >> argument 2 of 'cfg80211_scan_done' cfg80211_scan_done(wil->scan_request, aborted); ^~~ In file included from drivers/net/wireless/ath/wil6210/wil6210.h:22:0, from drivers/net/wireless/ath/wil6210/wmi.c:21: include/net/cfg80211.h:4102:6: note: expected 'struct cfg80211_scan_info *' but argument is of type 'bool {aka _Bool}' void cfg80211_scan_done(struct cfg80211_scan_request *request, ^~ -- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function 'brcmf_notify_escan_complete': >> drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:780:36: error: >> incompatible type for argument 2 of 'cfg80211_scan_done' cfg80211_scan_done(scan_request, aborted); ^~~ In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:23:0: include/net/cfg80211.h:4102:6: note: expected 'struct cfg80211_scan_info *' but argument is of type 'bool {aka _Bool}' void cfg80211_scan_done(struct cfg80211_scan_request *request, ^~ vim +/cfg80211_scan_done +437 drivers/net/wireless/ath/wil6210/wmi.c 7743882d6 Vladimir Kondratiev 2013-01-28 431 wil_dbg_wmi(wil, "SCAN_COMPLETE(0x%08x)\n", data->status); 2a91d7d06 Vladimir Kondratiev 2014-06-16 432 wil_dbg_misc(wil, "Complete scan_request 0x%p aborted %d\n", 2a91d7d06 Vladimir Kondratiev 2014-06-16 433 wil->scan_request, aborted); 2a91d7d06 Vladimir Kondratiev 2014-06-16 434 047e5d74b Vladimir Kondratiev 2014-05-27 435 del_timer_sync(>scan_timer); 4332cac17 Lior David 2016-03-01 436 mutex_lock(>p2p_wdev_mutex); 2be7d22f0 Vladimir Kondratiev 2012-12-20 @437 cfg80211_scan_done(wil->scan_request, aborted); 4332cac17 Lior David 2016-03-01
Re: [PATCHv4 wl-drv-next 0/2] register-field manipulation macros
Jakub Kicinskiwrites: > This set moves to a global header file macros which I find > very useful and worth popularising. The basic problem is > that since C bitfields are not very dependable accessing > subfields of registers becomes slightly inconvenient. > It is nice to have the necessary mask and shift operations > wrapped in a macro. It is also nice to have that macro > compute the shift amount based on the mask automatically. > > My implementation follows what Felix Fietkau has done in > mt76. Hannes Frederic Sowa suggested more use of standard > Linux/GCC functions. Since the RFC I've also added a > compile-time check to validate that the value passed to > setters fits in the mask. > > I attempted the use of static inlines instead of macros > but it makes GCC < 6.0 barf at the BUILD_BUG_ON()s. > I also noticed that forcing arguments to be u32 for inlines > makes the compiler use 32bit arithmetic where it could > get away with 64bit before (on 64bit machines, obviously). > That's a potential performance concern but probably not > a very practical one today. Apart from looking "cleaner" > static inlines would have the advantage that we could #undef > the auxiliary macros at the end of the header. This information about various compiler problems is good to have in the commit log as the cover letter itself is not stored in the git log. > v3: > Build bot caught a build failure with -Os set. AFAICT gcc > did not handle temporary variable I put in the macro > expression too well. I work around that by defining > __BUILD_BUG_ON_NOT_POWER_OF_2 and using it instead of > BUILD_BUG_ON(!tmp || is_power_of_2(tmp)). > > Please review and advise on improvements. > > If accepted I think would be best to push this through > Kalle's tree, since the only existing user is in > drivers/net/wireless/. I like it. But I feel much more comfortable to take these if I get an ack from someone like Dave Miller or Andrew Morton (CCed). Full patches here: https://patchwork.kernel.org/patch/9214129/ https://patchwork.kernel.org/patch/9214135/ -- Kalle Valo -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] nl80211: Add info to scan results to support beacon report
Hi, [auto build test WARNING on mac80211-next/master] [also build test WARNING on next-20160705] [cannot apply to v4.7-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Luca-Coelho/mac80211-cfg80211-a-bunch-of-patches-from-our-internal-tree/20160705-202748 base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master config: x86_64-randconfig-i0-201627 (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): drivers/net/wireless/ath/ath6kl/cfg80211.c: In function 'ath6kl_cfg80211_disconnect_event': >> drivers/net/wireless/ath/ath6kl/cfg80211.c:862:37: warning: passing argument >> 2 of 'cfg80211_scan_done' makes pointer from integer without a cast >> [-Wint-conversion] cfg80211_scan_done(vif->scan_req, true); ^~~~ In file included from drivers/net/wireless/ath/ath6kl/core.h:26:0, from drivers/net/wireless/ath/ath6kl/cfg80211.c:24: include/net/cfg80211.h:4102:6: note: expected 'struct cfg80211_scan_info *' but argument is of type 'int' void cfg80211_scan_done(struct cfg80211_scan_request *request, ^~ drivers/net/wireless/ath/ath6kl/cfg80211.c: In function 'ath6kl_cfg80211_scan_complete_event': drivers/net/wireless/ath/ath6kl/cfg80211.c:1092:36: error: incompatible type for argument 2 of 'cfg80211_scan_done' cfg80211_scan_done(vif->scan_req, aborted); ^~~ In file included from drivers/net/wireless/ath/ath6kl/core.h:26:0, from drivers/net/wireless/ath/ath6kl/cfg80211.c:24: include/net/cfg80211.h:4102:6: note: expected 'struct cfg80211_scan_info *' but argument is of type 'bool {aka _Bool}' void cfg80211_scan_done(struct cfg80211_scan_request *request, ^~ drivers/net/wireless/ath/ath6kl/cfg80211.c: In function 'ath6kl_cfg80211_vif_stop': drivers/net/wireless/ath/ath6kl/cfg80211.c:3617:37: warning: passing argument 2 of 'cfg80211_scan_done' makes pointer from integer without a cast [-Wint-conversion] cfg80211_scan_done(vif->scan_req, true); ^~~~ In file included from drivers/net/wireless/ath/ath6kl/core.h:26:0, from drivers/net/wireless/ath/ath6kl/cfg80211.c:24: include/net/cfg80211.h:4102:6: note: expected 'struct cfg80211_scan_info *' but argument is of type 'int' void cfg80211_scan_done(struct cfg80211_scan_request *request, ^~ -- drivers/net/wireless/marvell/mwifiex/main.c: In function 'mwifiex_close': >> drivers/net/wireless/marvell/mwifiex/main.c:702:42: warning: passing >> argument 2 of 'cfg80211_scan_done' makes pointer from integer without a cast >> [-Wint-conversion] cfg80211_scan_done(priv->scan_request, 1); ^ In file included from include/net/mac80211.h:23:0, from drivers/net/wireless/marvell/mwifiex/decl.h:30, from drivers/net/wireless/marvell/mwifiex/main.h:52, from drivers/net/wireless/marvell/mwifiex/main.c:20: include/net/cfg80211.h:4102:6: note: expected 'struct cfg80211_scan_info *' but argument is of type 'int' void cfg80211_scan_done(struct cfg80211_scan_request *request, ^~ -- drivers/net/wireless/marvell/mwifiex/scan.c: In function 'mwifiex_check_next_scan_command': >> drivers/net/wireless/marvell/mwifiex/scan.c:1982:44: warning: passing >> argument 2 of 'cfg80211_scan_done' makes pointer from integer without a cast >> [-Wint-conversion] cfg80211_scan_done(priv->scan_request, 1); ^ In file included from include/net/mac80211.h:23:0, from drivers/net/wireless/marvell/mwifiex/decl.h:30, from drivers/net/wireless/marvell/mwifiex/scan.c:20: include/net/cfg80211.h:4102:6: note: expected 'struct cfg80211_scan_info *' but argument is of type 'int' void cfg80211_scan_done(struct cfg80211_scan_request *request, ^~ vim +/cfg80211_scan_done +862 drivers/net/wireless/ath/ath6kl/cfg80211.c 8c8b65e3e Vasanthakumar Thiagarajan 2011-10-25 846 memset(vif->req_bssid, 0, sizeof(vif->req_bssid)); bdcd81707 Kalle Valo2011-07-18 847 bdcd81707 Kalle Valo2011-07-18 848 up(>sem); bdcd81707 Kalle Valo2011-07-18 849 14ee6f6b7 Vasanthakumar Thiagarajan 2011-10-25 850 vif->sme_state = SME_DISCONNECTED; 170826dd0 Vasanthakumar Thiagarajan 2011-09-10 851
Re: [PATCH] mwifiex: fix unconditional error return in .add_virtual_intf callback
Hello Kalle, On 07/05/2016 09:09 AM, Kalle Valo wrote: > Javier Martinez Canillaswrites: > >> The commit 7311ea850079 ("mwifiex: fix AP start problem for newly added >> interface") attempted to fix an issue when a new AP interface is added. >> >> But the patch didn't check the return value of the functions doing the >> firmware calls and returned an error even if the functions didn't fail. >> >> This prevents the network device to be registered properly, so fix it. >> >> Fixes: commit 7311ea850079 ("mwifiex: fix AP start problem for newly added >> interface") >> Signed-off-by: Javier Martinez Canillas > > The fixes line should be: > > Fixes: 7311ea850079 ("mwifiex: fix AP start problem for newly added > interface") > > I can fix that before I apply the patch. > Sigh, it was a copy and paste error when I copied the SHA-1 from the commit message. Sorry about that and thanks for taking care of this. Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv4 wl-drv-next 2/2] mt7601u: use linux/bitfield.h
Jakub Kicinskiwrites: > Use the newly added linux/bitfield.h. > > Signed-off-by: Jakub Kicinski [...] > +#define MT76_SET FIELD_PUT > +#define MT76_GET FIELD_GET This define is useless now, I would just remove it entirely. But you can do that in a follow up patch. -- Kalle Valo -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mwifiex: fix unconditional error return in .add_virtual_intf callback
Javier Martinez Canillaswrites: > The commit 7311ea850079 ("mwifiex: fix AP start problem for newly added > interface") attempted to fix an issue when a new AP interface is added. > > But the patch didn't check the return value of the functions doing the > firmware calls and returned an error even if the functions didn't fail. > > This prevents the network device to be registered properly, so fix it. > > Fixes: commit 7311ea850079 ("mwifiex: fix AP start problem for newly added > interface") > Signed-off-by: Javier Martinez Canillas The fixes line should be: Fixes: 7311ea850079 ("mwifiex: fix AP start problem for newly added interface") I can fix that before I apply the patch. -- Kalle Valo -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: pull-request: iwlwifi-next 2016-07-01
Luca Coelhowrites: > Here are some patches intended for 4.8. I have a lot more patches > pending in our internal tree, but I decided to take smaller steps > because it's easier to find a few hours to push a few patches than it > is to find many hours to send all pending patches. Is it okay for you > if I send a bunch of 10-20 patches pull-reqs or do you prefer if I hold > them back and send bigger pull-reqs later? > > There's not much here, more details in the tag description. > > Let me know if everything's fine (or not). :) > > Luca. > > > The following changes since commit af5e964f3045b66f1cd720b9c5abd37e47e613e2: > > MAINTAINERS: add myself as co-maintainer of the iwlwifi driver (2016-05-10 > 22:34:11 +0300) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git > tags/iwlwifi-next-for-kalle-2016-07-01 Pulled, thanks. -- Kalle Valo -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] cfg80211: Add support to set tx power for a station associated
On 2016-06-28 16:18, Johannes Berg wrote: On Tue, 2016-06-14 at 23:14 +0530, Ashok Raj Nagarajan wrote: This patch adds support to set transmit power setting type and transmit power level attributes to NL80211_CMD_SET_STATION in order to facilitate adjusting the transmit power level of a station associated to the AP. Why would you ever need to do that manually? Please give more explanation in the commit message. We have minstrel-blues (which never made it into the code, but that's just because the submitter went away) doing power adjustments, so you need to explain why this should be necessary. Hi Johannes, Sure.. First use case will be to help with the problem of legacy client devices that roam across multiple APs. It is a classic enterprise Wi-Fi AP problem, often managed by a "network controller" unit that is connected to all the APs. The problem is how to handle seamless handoff of clients between multiple APs while maximizing the client throughput and minimizing disruption of IP application services like VoIP calls and video streaming. A legacy client will often hold onto an AP association, even down to 1 Mbps as it roams away. Instead, if the AP can recognise that the client RSSI (and therefore throughput) is poor, it can "drop" the Tx power significantly (just to that client) such that it forces the client to look for a better, closer, and therefore higher-throughput association. It would "give it a kick" without blacklisting it. It just needs to hold the power low for the small amount of time it takes to convince it to go away. Other use cases may be - Support a form of QoS per STA since a higher MCS rate might be achievable, and CW delays might be reduced - The optimal power can be negotiated (closed loop) or observed (open loop) for a given STA, reducing needless congestion on the overall channel - Reduce power to a STA that does not support certain radio features (e.g. 11b clients) Thanks, Ashok johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/7] mac80211_hwsim: Add radar bandwidths to the P2P Device combination
From: Ilan PeerAdd radar_detect_widths to the interface combination that allows concurrent P2P Device dedicated interface and AP interfaces, to enable testing of radar detection when P2P Device interface is used. Clear the radar_detect_widths in case of multi channel contexts as this is not currently supported. As radar_detect_widths are now supported in all combinations, remove the hwsim_if_dfs_limits definition since it is no longer needed. Signed-off-by: Ilan Peer Signed-off-by: Luca Coelho --- drivers/net/wireless/mac80211_hwsim.c | 25 + 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 382109bb..97196c4 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -457,10 +457,6 @@ static const struct ieee80211_iface_limit hwsim_if_limits[] = { { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_DEVICE) } }; -static const struct ieee80211_iface_limit hwsim_if_dfs_limits[] = { - { .max = 8, .types = BIT(NL80211_IFTYPE_AP) }, -}; - static const struct ieee80211_iface_combination hwsim_if_comb[] = { { .limits = hwsim_if_limits, @@ -468,18 +464,12 @@ static const struct ieee80211_iface_combination hwsim_if_comb[] = { .n_limits = ARRAY_SIZE(hwsim_if_limits) - 1, .max_interfaces = 2048, .num_different_channels = 1, - }, - { - .limits = hwsim_if_dfs_limits, - .n_limits = ARRAY_SIZE(hwsim_if_dfs_limits), - .max_interfaces = 8, - .num_different_channels = 1, .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | BIT(NL80211_CHAN_WIDTH_20) | BIT(NL80211_CHAN_WIDTH_40) | BIT(NL80211_CHAN_WIDTH_80) | BIT(NL80211_CHAN_WIDTH_160), - } + }, }; static const struct ieee80211_iface_combination hwsim_if_comb_p2p_dev[] = { @@ -488,18 +478,12 @@ static const struct ieee80211_iface_combination hwsim_if_comb_p2p_dev[] = { .n_limits = ARRAY_SIZE(hwsim_if_limits), .max_interfaces = 2048, .num_different_channels = 1, - }, - { - .limits = hwsim_if_dfs_limits, - .n_limits = ARRAY_SIZE(hwsim_if_dfs_limits), - .max_interfaces = 8, - .num_different_channels = 1, .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | BIT(NL80211_CHAN_WIDTH_20) | BIT(NL80211_CHAN_WIDTH_40) | BIT(NL80211_CHAN_WIDTH_80) | BIT(NL80211_CHAN_WIDTH_160), - } + }, }; static spinlock_t hwsim_radio_lock; @@ -2487,13 +2471,14 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, hw->wiphy->max_scan_ssids = 255; hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; hw->wiphy->max_remain_on_channel_duration = 1000; - /* For channels > 1 DFS is not allowed */ - hw->wiphy->n_iface_combinations = 1; hw->wiphy->iface_combinations = >if_combination; if (param->p2p_device) data->if_combination = hwsim_if_comb_p2p_dev[0]; else data->if_combination = hwsim_if_comb[0]; + hw->wiphy->n_iface_combinations = 1; + /* For channels > 1 DFS is not allowed */ + data->if_combination.radar_detect_widths = 0; data->if_combination.num_different_channels = data->channels; } else if (param->p2p_device) { hw->wiphy->iface_combinations = hwsim_if_comb_p2p_dev; -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/7] nl80211: Add info to scan results to support beacon report
From: Avraham SternBeacon report radio measurement requires reporting observed BSSs on the channels specified in the beacon request. If the measurement mode is set to passive or active, it requires actually performing a scan (passive or active, accordingly), and reporting the time that the scan was started and the time each beacon/probe was received (both in terms of TSF of the BSS of the requesting AP). If the request mode is table, this information is optional. In addition, the radio measurement request specifies the channel dwell time for the measurement. In order to use scan for beacon report when the mode is active or passive, add a parameter to scan request that specifies the channel dwell time, and add scan start time and beacon received time to scan results information. Supporting beacon report is required for Multi Band Operation (MBO). Signed-off-by: Assaf Krauss Signed-off-by: David Spinadel Signed-off-by: Avraham Stern Signed-off-by: Luca Coelho --- include/net/cfg80211.h | 40 +++- include/uapi/linux/nl80211.h | 42 ++ net/mac80211/scan.c | 9 +++-- net/wireless/core.c | 4 ++-- net/wireless/core.h | 12 net/wireless/nl80211.c | 27 +++ net/wireless/scan.c | 18 -- net/wireless/trace.h | 33 + 8 files changed, 162 insertions(+), 23 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index fa4f0f7..e2658e3 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1424,6 +1424,21 @@ struct cfg80211_ssid { }; /** + * struct cfg80211_scan_info - information about completed scan + * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the + * wireless device that requested the scan is connected to. If this + * information is not available, this field is left zero. + * @tsf_bssid: the BSSID according to which %scan_start_tsf is set. + * @aborted: set to true if the scan was aborted for any reason, + * userspace will be notified of that + */ +struct cfg80211_scan_info { + u64 scan_start_tsf; + u8 tsf_bssid[ETH_ALEN] __aligned(2); + bool aborted; +}; + +/** * struct cfg80211_scan_request - scan request description * * @ssids: SSIDs to scan for (active scan only) @@ -1433,12 +1448,17 @@ struct cfg80211_ssid { * @scan_width: channel width for scanning * @ie: optional information element(s) to add into Probe Request or %NULL * @ie_len: length of ie in octets + * @duration: how long to listen on each channel, in TUs. If + * %duration_mandatory is not set, this is the maximum dwell time and + * the actual dwell time may be shorter. + * @duration_mandatory: if set, the scan duration must be as specified by the + * %duration field. * @flags: bit field of flags controlling operation * @rates: bitmap of rates to advertise for each band * @wiphy: the wiphy this was for * @scan_start: time (in jiffies) when the scan started * @wdev: the wireless device to scan for - * @aborted: (internal) scan request was notified as aborted + * @info: (internal) information about completed scan * @notified: (internal) scan request was notified as done or aborted * @no_cck: used to send probe requests at non CCK rate in 2GHz band * @mac_addr: MAC address used with randomisation @@ -1454,6 +1474,8 @@ struct cfg80211_scan_request { enum nl80211_bss_scan_width scan_width; const u8 *ie; size_t ie_len; + u16 duration; + bool duration_mandatory; u32 flags; u32 rates[NUM_NL80211_BANDS]; @@ -1467,7 +1489,8 @@ struct cfg80211_scan_request { /* internal */ struct wiphy *wiphy; unsigned long scan_start; - bool aborted, notified; + struct cfg80211_scan_info info; + bool notified; bool no_cck; /* keep last */ @@ -1600,12 +1623,19 @@ enum cfg80211_signal_type { * buffered on the device) and be accurate to about 10ms. * If the frame isn't buffered, just passing the return value of * ktime_get_boot_ns() is likely appropriate. + * @parent_tsf: the time at the start of reception of the first octet of the + * timestamp field of the frame. The time is the TSF of the BSS specified + * by %parent_bssid. + * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to + * the BSS that requested the scan in which the beacon/probe was received. */ struct cfg80211_inform_bss { struct ieee80211_channel *chan; enum nl80211_bss_scan_width scan_width; s32 signal; u64 boottime_ns; + u64 parent_tsf; + u8 parent_bssid[ETH_ALEN] __aligned(2); }; /** @@ -4067,10 +4097,10 @@ const
[PATCH 6/7] mac80211: report failure to start (partial) scan as scan abort
From: Johannes BergRather than reporting the scan as having completed, report it as being aborted. Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho --- net/mac80211/scan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 8d4a9cd..070b40f 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -362,10 +362,11 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) if (rc == 0) return; - /* HW scan failed and is going to be reported as done, so clear -* old scan info. + /* HW scan failed and is going to be reported as aborted, +* so clear old scan info. */ memset(>scan_info, 0, sizeof(local->scan_info)); + aborted = true; } kfree(local->hw_scan_req); -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/7] mac80211: Add support for beacon report radio measurement
From: Avraham SternAdd the following to support beacon report radio measurement with the measurement mode field set to passive or active: 1. Propagate the required scan duration to the device 2. Report the scan start time (in terms of TSF) 3. Report each BSS's detection time (also in terms of TSF) TSF times refer to the BSS that the interface that requested the scan is connected to. Signed-off-by: Assaf Krauss Signed-off-by: Avraham Stern [changed ath9k/10k, at76c59x-usb, iwlegacy, wl1251 and wlcore to match the new API] Signed-off-by: Luca Coelho --- drivers/net/wireless/ath/ath10k/mac.c | 14 + drivers/net/wireless/ath/ath9k/channel.c | 5 +++- drivers/net/wireless/atmel/at76c50x-usb.c | 5 +++- drivers/net/wireless/intel/iwlegacy/common.c | 6 +++- drivers/net/wireless/intel/iwlwifi/dvm/scan.c | 6 +++- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 37 ++- drivers/net/wireless/mac80211_hwsim.c | 11 +-- drivers/net/wireless/st/cw1200/scan.c | 6 +++- drivers/net/wireless/ti/wl1251/event.c| 6 +++- drivers/net/wireless/ti/wl1251/main.c | 6 +++- drivers/net/wireless/ti/wlcore/main.c | 11 +-- drivers/net/wireless/ti/wlcore/scan.c | 5 +++- include/net/mac80211.h| 5 ++-- net/mac80211/ieee80211_i.h| 1 + net/mac80211/scan.c | 42 ++- 15 files changed, 131 insertions(+), 35 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index d4b7a16..ebc12c5 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3858,12 +3858,16 @@ void __ath10k_scan_finish(struct ath10k *ar) break; case ATH10K_SCAN_RUNNING: case ATH10K_SCAN_ABORTING: - if (!ar->scan.is_roc) - ieee80211_scan_completed(ar->hw, -(ar->scan.state == - ATH10K_SCAN_ABORTING)); - else if (ar->scan.roc_notify) + if (!ar->scan.is_roc) { + struct cfg80211_scan_info info = { + .aborted = (ar->scan.state == + ATH10K_SCAN_ABORTING), + }; + + ieee80211_scan_completed(ar->hw, ); + } else if (ar->scan.roc_notify) { ieee80211_remain_on_channel_expired(ar->hw); + } /* fall through */ case ATH10K_SCAN_STARTING: ar->scan.state = ATH10K_SCAN_IDLE; diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c index e56bafc..57e26a6 100644 --- a/drivers/net/wireless/ath/ath9k/channel.c +++ b/drivers/net/wireless/ath/ath9k/channel.c @@ -960,6 +960,9 @@ void ath_roc_complete(struct ath_softc *sc, enum ath_roc_complete_reason reason) void ath_scan_complete(struct ath_softc *sc, bool abort) { struct ath_common *common = ath9k_hw_common(sc->sc_ah); + struct cfg80211_scan_info info = { + .aborted = abort, + }; if (abort) ath_dbg(common, CHAN_CTX, "HW scan aborted\n"); @@ -969,7 +972,7 @@ void ath_scan_complete(struct ath_softc *sc, bool abort) sc->offchannel.scan_req = NULL; sc->offchannel.scan_vif = NULL; sc->offchannel.state = ATH_OFFCHANNEL_IDLE; - ieee80211_scan_completed(sc->hw, abort); + ieee80211_scan_completed(sc->hw, ); clear_bit(ATH_OP_SCANNING, >op_flags); spin_lock_bh(>chan_lock); if (test_bit(ATH_OP_MULTI_CHANNEL, >op_flags)) diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c index 7c10804..0e18067 100644 --- a/drivers/net/wireless/atmel/at76c50x-usb.c +++ b/drivers/net/wireless/atmel/at76c50x-usb.c @@ -1922,6 +1922,9 @@ static void at76_dwork_hw_scan(struct work_struct *work) { struct at76_priv *priv = container_of(work, struct at76_priv, dwork_hw_scan.work); + struct cfg80211_scan_info info = { + .aborted = false, + }; int ret; if (priv->device_unplugged) @@ -1948,7 +1951,7 @@ static void at76_dwork_hw_scan(struct work_struct *work) mutex_unlock(>mtx); - ieee80211_scan_completed(priv->hw, false); + ieee80211_scan_completed(priv->hw, ); ieee80211_wake_queues(priv->hw); } diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c index eb24b92..140b6ea 100644 --- a/drivers/net/wireless/intel/iwlegacy/common.c +++ b/drivers/net/wireless/intel/iwlegacy/common.c @@
[PATCH 7/7] mac80211: parse wide bandwidth channel switch IE with workaround
From: Johannes BergContinuing the workaround implemented in commit 23665aaf9170 ("mac80211: Interoperability workaround for 80+80 and 160 MHz channels") use the same code to parse the Wide Bandwidth Channel Switch element by converting to VHT Operation element since the spec also just refers to that for parsing semantics, particularly with the workaround. While at it, remove some dead code - the IEEE80211_STA_DISABLE_40MHZ flag can never be set at this point since it's checked earlier and the wide_bw_chansw_ie pointer is set to NULL if it's set. Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho --- net/mac80211/spectmgmt.c | 45 + 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c index 2ddc661..97f4c9d 100644 --- a/net/mac80211/spectmgmt.c +++ b/net/mac80211/spectmgmt.c @@ -129,42 +129,31 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, } if (wide_bw_chansw_ie) { - new_vht_chandef.chan = new_chan; - new_vht_chandef.center_freq1 = - ieee80211_channel_to_frequency( + struct ieee80211_vht_operation vht_oper = { + .chan_width = + wide_bw_chansw_ie->new_channel_width, + .center_freq_seg1_idx = wide_bw_chansw_ie->new_center_freq_seg0, - new_band); - - switch (wide_bw_chansw_ie->new_channel_width) { - default: - /* hmmm, ignore VHT and use HT if present */ - case IEEE80211_VHT_CHANWIDTH_USE_HT: + .center_freq_seg2_idx = + wide_bw_chansw_ie->new_center_freq_seg1, + /* .basic_mcs_set doesn't matter */ + }; + + /* default, for the case of IEEE80211_VHT_CHANWIDTH_USE_HT, +* to the previously parsed chandef +*/ + new_vht_chandef = csa_ie->chandef; + + /* ignore if parsing fails */ + if (!ieee80211_chandef_vht_oper(_oper, _vht_chandef)) new_vht_chandef.chan = NULL; - break; - case IEEE80211_VHT_CHANWIDTH_80MHZ: - new_vht_chandef.width = NL80211_CHAN_WIDTH_80; - break; - case IEEE80211_VHT_CHANWIDTH_160MHZ: - new_vht_chandef.width = NL80211_CHAN_WIDTH_160; - break; - case IEEE80211_VHT_CHANWIDTH_80P80MHZ: - /* field is otherwise reserved */ - new_vht_chandef.center_freq2 = - ieee80211_channel_to_frequency( - wide_bw_chansw_ie->new_center_freq_seg1, - new_band); - new_vht_chandef.width = NL80211_CHAN_WIDTH_80P80; - break; - } + if (sta_flags & IEEE80211_STA_DISABLE_80P80MHZ && new_vht_chandef.width == NL80211_CHAN_WIDTH_80P80) ieee80211_chandef_downgrade(_vht_chandef); if (sta_flags & IEEE80211_STA_DISABLE_160MHZ && new_vht_chandef.width == NL80211_CHAN_WIDTH_160) ieee80211_chandef_downgrade(_vht_chandef); - if (sta_flags & IEEE80211_STA_DISABLE_40MHZ && - new_vht_chandef.width > NL80211_CHAN_WIDTH_20) - ieee80211_chandef_downgrade(_vht_chandef); } /* if VHT data is there validate & use it */ -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/7] cfg80211: handle failed skb allocation
From: Gregory GreenmanHandle the case when dev_alloc_skb returns NULL. Signed-off-by: Gregory Greenman Signed-off-by: Luca Coelho --- net/wireless/util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/wireless/util.c b/net/wireless/util.c index 2443ee3..b7d1592 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -721,6 +721,8 @@ __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen, * alignment since sizeof(struct ethhdr) is 14. */ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len); + if (!frame) + return NULL; skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2); skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len); -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/7] nl80211: Add API to support VHT MU-MIMO air sniffer
From: Aviya Erenfeldadd API to support VHT MU-MIMO air sniffer. in MU-MIMO there are parallel frames on the air while the HW has only one RX. add the capability to sniff one of the MU-MIMO parallel frames by giving the sniffer additional information so it'll know which of the parallel frames it shall follow. Add attribute - NL80211_ATTR_MU_MIMO_GROUP_DATA - for getting a MU-MIMO groupID in order to monitor packets from that group using VHT MU-MIMO. And add attribute -NL80211_ATTR_MU_MIMO_FOLLOW_ADDR - for passing MAC address to monitor mode. that option will be used by VHT MU-MIMO air sniffer to follow a station according to it's MAC address using VHT MU-MIMO. Signed-off-by: Aviya Erenfeld Signed-off-by: Luca Coelho --- include/net/cfg80211.h | 10 -- include/uapi/linux/nl80211.h | 29 + net/wireless/nl80211.c | 36 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 7bbb00d..fa4f0f7 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -330,6 +330,9 @@ struct ieee80211_supported_band { * in a separate chapter. */ +#define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\ + WLAN_USER_POSITION_LEN) + /** * struct vif_params - describes virtual interface parameters * @use_4addr: use 4-address frames @@ -339,10 +342,13 @@ struct ieee80211_supported_band { * This feature is only fully supported by drivers that enable the * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating **only p2p devices with specified MAC. + * @vht_mumimo_groups: MU-MIMO groupID. used for monitoring only + * packets belonging to that MU-MIMO groupID. */ struct vif_params { - int use_4addr; - u8 macaddr[ETH_ALEN]; + int use_4addr; + u8 macaddr[ETH_ALEN]; + u8 vht_mumimo_groups[VHT_MUMIMO_GROUPS_DATA_LEN]; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 53c8278..1d7da78 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -1829,6 +1829,25 @@ enum nl80211_commands { * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per * interface type. * + * @NL80211_ATTR_MU_MIMO_GROUP_DATA: array of 24 bytes that defines a MU-MIMO + * groupID for monitor mode. + * The first 8 bytes are a mask that defines the membership in each + * group (there are 64 groups, group 0 and 63 are reserved), + * each bit represents a group and set to 1 for being a member in + * that group and 0 for not being a member. + * The remaining 16 bytes define the position in each group: 2 bits for + * each group. + * (smaller group numbers represented on most significant bits and bigger + * group numbers on least significant bits.) + * This attribute is used only if all interfaces are in monitor mode. + * Set this attribute in order to monitor packets using the given MU-MIMO + * groupID data. + * to turn off that feature set all the bits of the groupID to zero. + * @NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR: mac address for the sniffer to follow + * when using MU-MIMO air sniffer. + * to turn that feature off set an invalid mac address + * (e.g. FF:FF:FF:FF:FF:FF) + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -2213,6 +2232,9 @@ enum nl80211_attrs { NL80211_ATTR_IFTYPE_EXT_CAPA, + NL80211_ATTR_MU_MIMO_GROUP_DATA, + NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -4479,6 +4501,12 @@ enum nl80211_feature_flags { * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set * the ASSOC_REQ_USE_RRM flag in the association request even if * NL80211_FEATURE_QUIET is not advertized. + * @NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER: This device supports MU-MIMO air + * sniffer which means that it can be configured to hear packets from + * certain groups which can be configured by the + * %NL80211_ATTR_MU_MIMO_GROUP_DATA attribute, + * or can be configured to follow a station by configuring the + * %NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR attribute. * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. @@ -4486,6 +4514,7 @@ enum nl80211_feature_flags { enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_VHT_IBSS, NL80211_EXT_FEATURE_RRM, + NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git
[PATCH 0/7] mac80211/cfg80211: a bunch of patches from our internal tree
From: Luca CoelhoHi Johannes, These are some cfg80211/mac80211 patches that were pending upstreaming in our internal tree (I think you know about them ;). Please let me know if everything is okay. There is a couple of checkpatch >80 chars line warnings, which I decided to ignore, since fixing them would make things uglier. One patch required changes in other drivers. Those changes are compile-tested only. Cheers, Luca. Aviya Erenfeld (1): nl80211: Add API to support VHT MU-MIMO air sniffer Avraham Stern (2): nl80211: Add info to scan results to support beacon report mac80211: Add support for beacon report radio measurement Gregory Greenman (1): cfg80211: handle failed skb allocation Ilan Peer (1): mac80211_hwsim: Add radar bandwidths to the P2P Device combination Johannes Berg (2): mac80211: report failure to start (partial) scan as scan abort mac80211: parse wide bandwidth channel switch IE with workaround drivers/net/wireless/ath/ath10k/mac.c | 14 -- drivers/net/wireless/ath/ath9k/channel.c | 5 +- drivers/net/wireless/atmel/at76c50x-usb.c | 5 +- drivers/net/wireless/intel/iwlegacy/common.c | 6 ++- drivers/net/wireless/intel/iwlwifi/dvm/scan.c | 6 ++- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 37 +++--- drivers/net/wireless/mac80211_hwsim.c | 36 ++ drivers/net/wireless/st/cw1200/scan.c | 6 ++- drivers/net/wireless/ti/wl1251/event.c| 6 ++- drivers/net/wireless/ti/wl1251/main.c | 6 ++- drivers/net/wireless/ti/wlcore/main.c | 11 - drivers/net/wireless/ti/wlcore/scan.c | 5 +- include/net/cfg80211.h| 50 --- include/net/mac80211.h| 5 +- include/uapi/linux/nl80211.h | 71 +++ net/mac80211/ieee80211_i.h| 1 + net/mac80211/scan.c | 42 ++-- net/mac80211/spectmgmt.c | 45 +++-- net/wireless/core.c | 4 +- net/wireless/core.h | 12 + net/wireless/nl80211.c| 63 net/wireless/scan.c | 18 --- net/wireless/trace.h | 33 ++--- net/wireless/util.c | 2 + 24 files changed, 386 insertions(+), 103 deletions(-) -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
ath9k-htc on OHCI -> bogus usb xfer
Hello, Looks like this is another manifestation of already seen problem with ath9k-htc and OHCI controller. I'm trying to get USB Wi-Fi dongle based on Atheros AR9271 to work with our development board (this is Synopsys AXS103) and seeing a picture very similar to what was discussed here http://thread.gmane.org/gmane.linux.usb.general/110847 Below is what I see on insertion of the dongle. Note I have the most recent ath9k-htc firmware (see "ath9k_htc/htc_9271-1.4.0.fw" in the log below) and Linux kernel is 4.6.3 (latest stable as of today) but the same happens even on 4.4. Interesting enough if I simply remove or disable the warning like that >8--- diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 3d27477..a317e1e 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c @@ -443,11 +443,6 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) * cause problems in HCDs if they get it wrong. */ - /* Check that the pipe's type matches the endpoint's type */ - if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) - dev_WARN(>dev, "BOGUS urb xfer, pipe %x != type %x\n", - usb_pipetype(urb->pipe), pipetypes[xfertype]); - /* Check against a simple/standard policy */ allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK | URB_FREE_BUFFER); >8--- everything seem to work quite nice. Any thoughts are much appreciated. That's the log itself: >8--- usb 1-1: new full-speed USB device number 2 using ohci-platform usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested usb 1-1: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size: 51008 [ cut here ] WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 usb_submit_urb+0x162/0x404 usb 1-1: BOGUS urb xfer, pipe 1 != type 3 Modules linked in: CPU: 0 PID: 4 Comm: kworker/0:0 Not tainted 4.6.3 #10 Workqueue: events request_firmware_work_func Stack Trace: arc_unwind_core.constprop.1+0x94/0x10c ---[ end trace 2249b79eac9991d1 ]--- [ cut here ] WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 usb_submit_urb+0x162/0x404 usb 1-1: BOGUS urb xfer, pipe 1 != type 3 Modules linked in: CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: GW 4.6.3 #10 Workqueue: events request_firmware_work_func Stack Trace: arc_unwind_core.constprop.1+0x94/0x10c ---[ end trace 2249b79eac9991d2 ]--- [ cut here ] WARNING: CPU: 0 PID: 4 at drivers/usb/core/urb.c:450 usb_submit_urb+0x162/0x404 usb 1-1: BOGUS urb xfer, pipe 1 != type 3 Modules linked in: CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: GW 4.6.3 #10 Workqueue: events request_firmware_work_func Stack Trace: arc_unwind_core.constprop.1+0x94/0x10c ---[ end trace 2249b79eac9991d3 ]--- ... >8--- -Alexey-- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv4 wl-drv-next 2/2] mt7601u: use linux/bitfield.h
Use the newly added linux/bitfield.h. Signed-off-by: Jakub Kicinski--- drivers/net/wireless/mediatek/mt7601u/dma.h | 2 - drivers/net/wireless/mediatek/mt7601u/mt7601u.h | 5 +- drivers/net/wireless/mediatek/mt7601u/util.h| 77 - 3 files changed, 4 insertions(+), 80 deletions(-) delete mode 100644 drivers/net/wireless/mediatek/mt7601u/util.h diff --git a/drivers/net/wireless/mediatek/mt7601u/dma.h b/drivers/net/wireless/mediatek/mt7601u/dma.h index 978e8a90b87f..166ac71905d2 100644 --- a/drivers/net/wireless/mediatek/mt7601u/dma.h +++ b/drivers/net/wireless/mediatek/mt7601u/dma.h @@ -18,8 +18,6 @@ #include #include -#include "util.h" - #define MT_DMA_HDR_LEN 4 #define MT_RX_INFO_LEN 4 #define MT_FCE_INFO_LEN4 diff --git a/drivers/net/wireless/mediatek/mt7601u/mt7601u.h b/drivers/net/wireless/mediatek/mt7601u/mt7601u.h index 428bd2f10b7b..5ef62e02ce66 100644 --- a/drivers/net/wireless/mediatek/mt7601u/mt7601u.h +++ b/drivers/net/wireless/mediatek/mt7601u/mt7601u.h @@ -15,6 +15,7 @@ #ifndef MT7601U_H #define MT7601U_H +#include #include #include #include @@ -24,7 +25,6 @@ #include #include "regs.h" -#include "util.h" #define MT_CALIBRATE_INTERVAL (4 * HZ) @@ -282,6 +282,9 @@ struct mt7601u_rxwi; extern const struct ieee80211_ops mt7601u_ops; +#define MT76_SET FIELD_PUT +#define MT76_GET FIELD_GET + void mt7601u_init_debugfs(struct mt7601u_dev *dev); u32 mt7601u_rr(struct mt7601u_dev *dev, u32 offset); diff --git a/drivers/net/wireless/mediatek/mt7601u/util.h b/drivers/net/wireless/mediatek/mt7601u/util.h deleted file mode 100644 index b89140bf1210.. --- a/drivers/net/wireless/mediatek/mt7601u/util.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2014 Felix Fietkau - * Copyright (C) 2004 - 2009 Ivo van Doorn - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef __MT76_UTIL_H -#define __MT76_UTIL_H - -/* - * Power of two check, this will check - * if the mask that has been given contains and contiguous set of bits. - * Note that we cannot use the is_power_of_2() function since this - * check must be done at compile-time. - */ -#define is_power_of_two(x) ( !((x) & ((x)-1)) ) -#define low_bit_mask(x)( ((x)-1) & ~(x) ) -#define is_valid_mask(x) is_power_of_two(1LU + (x) + low_bit_mask(x)) - -/* - * Macros to find first set bit in a variable. - * These macros behave the same as the __ffs() functions but - * the most important difference that this is done during - * compile-time rather then run-time. - */ -#define compile_ffs2(__x) \ - __builtin_choose_expr(((__x) & 0x1), 0, 1) - -#define compile_ffs4(__x) \ - __builtin_choose_expr(((__x) & 0x3), \ - (compile_ffs2((__x))), \ - (compile_ffs2((__x) >> 2) + 2)) - -#define compile_ffs8(__x) \ - __builtin_choose_expr(((__x) & 0xf), \ - (compile_ffs4((__x))), \ - (compile_ffs4((__x) >> 4) + 4)) - -#define compile_ffs16(__x) \ - __builtin_choose_expr(((__x) & 0xff), \ - (compile_ffs8((__x))), \ - (compile_ffs8((__x) >> 8) + 8)) - -#define compile_ffs32(__x) \ - __builtin_choose_expr(((__x) & 0x), \ - (compile_ffs16((__x))), \ - (compile_ffs16((__x) >> 16) + 16)) - -/* - * This macro will check the requirements for the FIELD{8,16,32} macros - * The mask should be a constant non-zero contiguous set of bits which - * does not exceed the given typelimit. - */ -#define FIELD_CHECK(__mask) \ - BUILD_BUG_ON(!(__mask) || !is_valid_mask(__mask)) - -#define MT76_SET(_mask, _val) \ - ({ \ - FIELD_CHECK(_mask); \ - (((u32) (_val)) << compile_ffs32(_mask)) & _mask; \ - }) - -#define MT76_GET(_mask, _val) \ - ({ \ - FIELD_CHECK(_mask); \ - (u32) (((_val) & _mask) >> compile_ffs32(_mask)); \ - }) - -#endif -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
[PATCHv4 wl-drv-next 1/2] add basic register-field manipulation macros
Common approach to accessing register fields is to define structures or sets of macros containing mask and shift pair. Operations on the register are then performed as follows: field = (reg >> shift) & mask; reg &= ~(mask << shift); reg |= (field & mask) << shift; Defining shift and mask separately is tedious. Ivo van Doorn came up with an idea of computing them at compilation time based on a single shifted mask (later refined by Felix) which can be used like this: #define REG_FIELD 0x000ff000 field = FIELD_GET(REG_FIELD, reg); reg &= ~REG_FIELD; reg |= FIELD_PUT(REG_FIELD, field); FIELD_{GET,PUT} macros take care of finding out what the appropriate shift is based on compilation time ffs operation. GENMASK can be used to define registers (which is usually less error-prone and easier to match with datasheets). This approach is the most convenient I've seen so to limit code multiplication let's move the macros to a global header file. Signed-off-by: Jakub Kicinski--- include/linux/bitfield.h | 109 +++ include/linux/bug.h | 3 ++ 2 files changed, 112 insertions(+) create mode 100644 include/linux/bitfield.h diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h new file mode 100644 index ..ff9fd0af2ac7 --- /dev/null +++ b/include/linux/bitfield.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2014 Felix Fietkau + * Copyright (C) 2004 - 2009 Ivo van Doorn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _LINUX_BITFIELD_H +#define _LINUX_BITFIELD_H + +#include +#include + +#define _bf_shf(x) (__builtin_ffsll(x) - 1) + +#define _BF_FIELD_CHECK(_mask, _val) \ + ({ \ + BUILD_BUG_ON(!(_mask)); \ + BUILD_BUG_ON(__builtin_constant_p(_val) ? \ +~((_mask) >> _bf_shf(_mask)) & (_val) :\ +0);\ + __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \ + (1ULL << _bf_shf(_mask))); \ + }) + +/* + * Bitfield access macros + * + * This file contains macros which take as input shifted mask + * from which they extract the base mask and shift amount at + * compilation time. There are two separate sets of the macros + * one for 32bit registers and one for 64bit ones. + * + * Fields can be defined using GENMASK (which is usually + * less error-prone and easier to match with datasheets). + * + * FIELD_{GET,PUT} macros are designed to be used with masks which + * are compilation time constants. + * + * Example: + * + * #define REG_FIELD_A GENMASK(6, 0) + * #define REG_FIELD_B BIT(7) + * #define REG_FIELD_C GENMASK(15, 8) + * #define REG_FIELD_D GENMASK(31, 16) + * + * Get: + * a = FIELD_GET(REG_FIELD_A, reg); + * b = FIELD_GET(REG_FIELD_B, reg); + * + * Set: + * reg = FIELD_PUT(REG_FIELD_A, 1) | + * FIELD_PUT(REG_FIELD_B, 0) | + * FIELD_PUT(REG_FIELD_C, c) | + * FIELD_PUT(REG_FIELD_D, 0x40); + * + * Modify: + * reg &= ~REG_FIELD_C; + * reg |= FIELD_PUT(REG_FIELD_C, c); + */ + +/** + * FIELD_PUT() - construct a bitfield element + * @_mask: shifted mask defining the field's length and position + * @_val: value to put in the field + * + * FIELD_PUT() masks and shifts up the value. The result should + * be combined with other fields of the bitfield using logical OR. + */ +#define FIELD_PUT(_mask, _val) \ + ({ \ + _BF_FIELD_CHECK(_mask, _val); \ + ((u32)(_val) << _bf_shf(_mask)) & (_mask); \ + }) + +/** + * FIELD_GET() - extract a bitfield element + * @_mask: shifted mask defining the field's length and position + * @_val: 32bit value of entire bitfield + * + * FIELD_GET() extracts the field specified by @_mask from the + * bitfield passed in as @_val. + */ +#define FIELD_GET(_mask, _val) \ + ({ \ + _BF_FIELD_CHECK(_mask, 0); \ + (u32)(((_val) & (_mask)) >> _bf_shf(_mask));\ + }) + +#define FIELD_PUT64(_mask, _val) \ + ({ \ +
[PATCHv4 wl-drv-next 0/2] register-field manipulation macros
Hi! This set moves to a global header file macros which I find very useful and worth popularising. The basic problem is that since C bitfields are not very dependable accessing subfields of registers becomes slightly inconvenient. It is nice to have the necessary mask and shift operations wrapped in a macro. It is also nice to have that macro compute the shift amount based on the mask automatically. My implementation follows what Felix Fietkau has done in mt76. Hannes Frederic Sowa suggested more use of standard Linux/GCC functions. Since the RFC I've also added a compile-time check to validate that the value passed to setters fits in the mask. I attempted the use of static inlines instead of macros but it makes GCC < 6.0 barf at the BUILD_BUG_ON()s. I also noticed that forcing arguments to be u32 for inlines makes the compiler use 32bit arithmetic where it could get away with 64bit before (on 64bit machines, obviously). That's a potential performance concern but probably not a very practical one today. Apart from looking "cleaner" static inlines would have the advantage that we could #undef the auxiliary macros at the end of the header. v3: Build bot caught a build failure with -Os set. AFAICT gcc did not handle temporary variable I put in the macro expression too well. I work around that by defining __BUILD_BUG_ON_NOT_POWER_OF_2 and using it instead of BUILD_BUG_ON(!tmp || is_power_of_2(tmp)). Please review and advise on improvements. If accepted I think would be best to push this through Kalle's tree, since the only existing user is in drivers/net/wireless/. v4: - add documentation in the header. v3: - don't use variables in statement expressions; - use __BUILD_BUG_ON_NOT_POWER_OF_2. v2: - change Felix's email address. Jakub Kicinski (2): add basic register-field manipulation macros mt7601u: use linux/bitfield.h drivers/net/wireless/mediatek/mt7601u/dma.h | 2 - drivers/net/wireless/mediatek/mt7601u/mt7601u.h | 5 +- drivers/net/wireless/mediatek/mt7601u/util.h| 77 - include/linux/bitfield.h| 110 include/linux/bug.h | 3 + 5 files changed, 117 insertions(+), 80 deletions(-) delete mode 100644 drivers/net/wireless/mediatek/mt7601u/util.h create mode 100644 include/linux/bitfield.h -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3 wl-drv-next 1/2] add basic register-field manipulation macros
On Tue, 5 Jul 2016 10:56:13 +, David Laight wrote: > From: Jakub Kicinski > > Sent: 01 July 2016 22:27 > > > > C bitfields are problematic and best avoided. Developers > > interacting with hardware registers find themselves searching > > for easy-to-use alternatives. Common approach is to define > > structures or sets of macros containing mask and shift pair. > > Operations on the register are then performed as follows: > > > > field = (reg >> shift) & mask; > > > > reg &= ~(mask << shift); > > reg |= (field & mask) << shift; > > > > Defining shift and mask separately is tedious. Ivo van Doorn > > came up with an idea of computing them at compilation time > > based on a single shifted mask (later refined by Felix) which > > can be used like this: > > > > #define REG_FIELD 0x000ff000 > > > > field = FIELD_GET(REG_FIELD, reg); > > > > reg &= ~REG_FIELD; > > reg |= FIELD_PUT(REG_FIELD, field); > > My problem with these sort of 'helpers' is that they make it much harder > to read code unless you happen to know exactly what the helpers do. > Unexpected issues (like values being sign extended) can be hard to spot. > > A lot of the time you can make things simpler by not doing the shifts > (ie define shifted constants). I think creating a standard set of macros in a global header file is actually helping the problems you raise. One is much more likely to know exactly what a common macro is doing than some driver-specific ad hoc macro. Common macros are also much more likely to be well tested making "unexpected issues" less likely to appear. Defining constants is fine in 20% of cases when you have only a small set of meaningful values (e.g. what to do for a 8 bit delay or priority field?) Besides when fields are not aligned to 4 bits it's hard to tell from the shifted value what the base was. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCHv3 wl-drv-next 1/2] add basic register-field manipulation macros
From: Jakub Kicinski > Sent: 01 July 2016 22:27 > > C bitfields are problematic and best avoided. Developers > interacting with hardware registers find themselves searching > for easy-to-use alternatives. Common approach is to define > structures or sets of macros containing mask and shift pair. > Operations on the register are then performed as follows: > > field = (reg >> shift) & mask; > > reg &= ~(mask << shift); > reg |= (field & mask) << shift; > > Defining shift and mask separately is tedious. Ivo van Doorn > came up with an idea of computing them at compilation time > based on a single shifted mask (later refined by Felix) which > can be used like this: > > #define REG_FIELD 0x000ff000 > > field = FIELD_GET(REG_FIELD, reg); > > reg &= ~REG_FIELD; > reg |= FIELD_PUT(REG_FIELD, field); My problem with these sort of 'helpers' is that they make it much harder to read code unless you happen to know exactly what the helpers do. Unexpected issues (like values being sign extended) can be hard to spot. A lot of the time you can make things simpler by not doing the shifts (ie define shifted constants). David -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] nl80211: Move ACL parsing later to avoid a possible memory leak
No support for pbss results in a memory leak for the acl_data (if parse_acl_data succeeds). Fix this by moving the ACL parsing later. Fixes: 34d505193bd10 ("cfg80211: basic support for PBSS network type") Signed-off-by: Purushottam Kushwaha--- net/wireless/nl80211.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 244d552..c11dccf 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3532,16 +3532,16 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) params.smps_mode = NL80211_SMPS_OFF; } + params.pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]); + if (params.pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) + return -EOPNOTSUPP; + if (info->attrs[NL80211_ATTR_ACL_POLICY]) { params.acl = parse_acl_data(>wiphy, info); if (IS_ERR(params.acl)) return PTR_ERR(params.acl); } - params.pbss = nla_get_flag(info->attrs[NL80211_ATTR_PBSS]); - if (params.pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ]) - return -EOPNOTSUPP; - wdev_lock(wdev); err = rdev_start_ap(rdev, dev, ); if (!err) { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html