From: Johannes Berg <johannes@sipsolutions.net>
To: Ajay Singh <ajay.kathat@microchip.com>, linux-wireless@vger.kernel.org
Cc: kvalo@codeaurora.org, gregkh@linuxfoundation.org,
ganesh.krishna@microchip.com, aditya.shankar@microchip.com,
venkateswara.kaja@microchip.com, claudiu.beznea@microchip.com,
adham.abozaeid@microchip.com
Subject: Re: [PATCH 13/19] wilc: add linux_wlan.c
Date: Mon, 08 Oct 2018 16:41:14 +0200 [thread overview]
Message-ID: <1539009674.3687.75.camel@sipsolutions.net> (raw)
In-Reply-To: <1537957525-11467-14-git-send-email-ajay.kathat@microchip.com> (sfid-20180926_122625_621450_BBA3DD9B)
On Wed, 2018-09-26 at 15:55 +0530, Ajay Singh wrote:
> Moved '/driver/staging/wilc1000/linux_wlan.c' to
> 'drivers/net/wireless/microchip/wilc/'.
>
> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> ---
> drivers/net/wireless/microchip/wilc/linux_wlan.c | 1161 ++++++++++++++++++++++
> 1 file changed, 1161 insertions(+)
> create mode 100644 drivers/net/wireless/microchip/wilc/linux_wlan.c
Hmm. It's pretty obviously a linux driver, what's the point?
> diff --git a/drivers/net/wireless/microchip/wilc/linux_wlan.c b/drivers/net/wireless/microchip/wilc/linux_wlan.c
> new file mode 100644
> index 0000000..76c9012
> --- /dev/null
> +++ b/drivers/net/wireless/microchip/wilc/linux_wlan.c
> @@ -0,0 +1,1161 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
> + * All rights reserved.
> + */
> +
> +#include <linux/irq.h>
> +#include <linux/kthread.h>
> +#include <linux/firmware.h>
> +#include <linux/netdevice.h>
> +#include <linux/inetdevice.h>
> +
> +#include "wilc_wfi_cfgoperations.h"
> +
> +static int dev_state_ev_handler(struct notifier_block *this,
> + unsigned long event, void *ptr)
> +{
> + struct in_ifaddr *dev_iface = ptr;
> + struct wilc_priv *priv;
> + struct host_if_drv *hif_drv;
> + struct net_device *dev;
> + u8 *ip_addr_buf;
> + struct wilc_vif *vif;
> + u8 null_ip[4] = {0};
> + char wlan_dev_name[5] = "wlan0";
Regardless of what you're trying to do, thta seems like a bad idea.
> + if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev)
> + return NOTIFY_DONE;
> +
> + if (memcmp(dev_iface->ifa_label, "wlan0", 5) &&
> + memcmp(dev_iface->ifa_label, "p2p0", 4))
> + return NOTIFY_DONE;
That too. What???
> + dev = (struct net_device *)dev_iface->ifa_dev->dev;
> + if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy)
> + return NOTIFY_DONE;
> +
> + priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
> + if (!priv)
> + return NOTIFY_DONE;
> +
> + hif_drv = (struct host_if_drv *)priv->hif_drv;
> + vif = netdev_priv(dev);
> + if (!vif || !hif_drv)
> + return NOTIFY_DONE;
> +
> + switch (event) {
> + case NETDEV_UP:
> + if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
> + hif_drv->ifc_up = 1;
> + vif->obtaining_ip = false;
> + del_timer(&vif->during_ip_timer);
> + }
> +
> + if (vif->wilc->enable_ps)
> + wilc_set_power_mgmt(vif, 1, 0);
> +
> + netdev_dbg(dev, "[%s] Up IP\n", dev_iface->ifa_label);
> +
> + ip_addr_buf = (char *)&dev_iface->ifa_address;
> + netdev_dbg(dev, "IP add=%d:%d:%d:%d\n",
> + ip_addr_buf[0], ip_addr_buf[1],
> + ip_addr_buf[2], ip_addr_buf[3]);
%pI4, I believe, but I think you should just remove it, it likely won't
have an IP address anyway, and you might have multiple, and so this is
just broken.
> + eth_h = (struct ethhdr *)(skb->data);
> + if (eth_h->h_proto == cpu_to_be16(0x8e88))
> + netdev_dbg(ndev, "EAPOL transmitted\n");
Err, no, just remove that.
> + ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr));
Sure, everything is IP. You just checked that it wasn't EAPOL?
> + udp_buf = (char *)ih + sizeof(struct iphdr);
> + if ((udp_buf[1] == 68 && udp_buf[3] == 67) ||
> + (udp_buf[1] == 67 && udp_buf[3] == 68))
> + netdev_dbg(ndev, "DHCP Message transmitted, type:%x %x %x\n",
> + udp_buf[248], udp_buf[249], udp_buf[250]);
Umm... no. Just remove that too.
> + vif->netstats.tx_packets++;
> + vif->netstats.tx_bytes += tx_data->size;
> + tx_data->bssid = wilc->vif[vif->idx]->bssid;
> + queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
> + tx_data->buff, tx_data->size,
> + linux_wlan_tx_complete);
> +
> + if (queue_count > FLOW_CONTROL_UPPER_THRESHOLD) {
> + netif_stop_queue(wilc->vif[0]->ndev);
> + netif_stop_queue(wilc->vif[1]->ndev);
> + }
It seems like a pretty bad idea to hard-code two interfaces, we do
dynamic addition/removal these days, in *particular* for P2P.
> +static int wilc_mac_close(struct net_device *ndev)
> +{
> + struct wilc_priv *priv;
> + struct wilc_vif *vif = netdev_priv(ndev);
> + struct host_if_drv *hif_drv;
> + struct wilc *wl;
> +
> + if (!vif || !vif->ndev || !vif->ndev->ieee80211_ptr ||
> + !vif->ndev->ieee80211_ptr->wiphy)
> + return 0;
I'm not really sure why you're so paranoid, none of that can possibly
happen.
> + priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy);
> + wl = vif->wilc;
> +
> + if (!priv)
> + return 0;
Nor can this.
> + hif_drv = (struct host_if_drv *)priv->hif_drv;
> +
> + netdev_dbg(ndev, "Mac close\n");
> +
> + if (!wl)
> + return 0;
> +
> + if (!hif_drv)
> + return 0;
Nor these.
johannes
next prev parent reply other threads:[~2018-10-08 14:41 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-26 10:25 [RFC 00/19] wilc: added driver for wilc module Ajay Singh
2018-09-26 10:25 ` [PATCH 01/19] wilc: add coreconfigurator.h Ajay Singh
2018-09-26 10:25 ` [PATCH 02/19] wilc: add coreconfigurator.c Ajay Singh
2018-10-08 14:16 ` Johannes Berg
2018-10-09 9:42 ` Ajay Singh
2018-10-09 10:05 ` Johannes Berg
2018-09-26 10:25 ` [PATCH 03/19] wilc: add host_interface.h Ajay Singh
2018-10-08 14:20 ` Johannes Berg
2018-10-09 10:34 ` Ajay Singh
2018-10-09 10:36 ` Johannes Berg
2018-10-09 11:44 ` Ajay Singh
2018-10-09 11:46 ` Johannes Berg
2018-10-09 12:18 ` Ajay Singh
2018-10-09 18:36 ` Adham.Abozaeid
2018-10-09 19:14 ` Johannes Berg
2018-10-09 20:01 ` Adham.Abozaeid
2018-10-09 20:02 ` Johannes Berg
2018-10-09 20:06 ` Adham.Abozaeid
2018-10-29 14:56 ` Kalle Valo
2018-10-30 3:20 ` Ajay.Kathat
2018-09-26 10:25 ` [PATCH 04/19] wilc: add host_interface.c Ajay Singh
2018-10-08 14:31 ` Johannes Berg
2018-10-10 20:06 ` Adham.Abozaeid
2018-10-11 7:01 ` Johannes Berg
2018-10-12 22:08 ` Adham.Abozaeid
2018-10-18 8:23 ` Johannes Berg
2018-10-18 18:30 ` Adham.Abozaeid
2018-10-19 7:02 ` Johannes Berg
2018-10-19 20:53 ` Adham.Abozaeid
2018-10-29 20:10 ` Johannes Berg
2018-10-29 21:32 ` Adham.Abozaeid
2018-10-29 21:33 ` Johannes Berg
2018-10-11 6:57 ` Ajay Singh
2018-10-10 20:14 ` Johannes Berg
2018-10-12 21:55 ` Adham.Abozaeid
2018-10-18 8:23 ` Johannes Berg
2018-09-26 10:25 ` [PATCH 05/19] wilc: add wilc_wlan_if.h Ajay Singh
2018-10-08 14:33 ` Johannes Berg
2018-10-11 6:59 ` Ajay Singh
2018-09-26 10:25 ` [PATCH 06/19] wilc: add wilc_wlan_cfg.h Ajay Singh
2018-09-26 10:25 ` [PATCH 07/19] wilc: add wilc_wlan_cfg.c Ajay Singh
2018-09-26 10:25 ` [PATCH 08/19] wilc: add wilc_wlan.h Ajay Singh
2018-09-26 10:25 ` [PATCH 09/19] wilc: add wilc_wlan.c Ajay Singh
2018-09-26 10:25 ` [PATCH 10/19] wilc: add wilc_wfi_netdevice.h Ajay Singh
2018-09-26 10:25 ` [PATCH 11/19] wilc: add wilc_wfi_cfgoperations.h Ajay Singh
2018-09-26 10:25 ` [PATCH 12/19] wilc: add wilc_wfi_cfgoperations.c Ajay Singh
2018-10-08 14:57 ` Johannes Berg
2018-10-09 4:23 ` Adham.Abozaeid
2018-10-09 7:55 ` Johannes Berg
2018-10-09 17:15 ` Adham.Abozaeid
2018-10-19 21:47 ` Adham.Abozaeid
2018-10-29 20:11 ` Johannes Berg
2018-10-29 21:43 ` Adham.Abozaeid
2018-09-26 10:25 ` [PATCH 13/19] wilc: add linux_wlan.c Ajay Singh
2018-10-08 14:41 ` Johannes Berg [this message]
2018-10-11 7:00 ` Ajay Singh
2018-10-11 7:03 ` Johannes Berg
2018-10-11 7:26 ` Ajay Singh
2018-09-26 10:25 ` [PATCH 14/19] wilc: add linux_mon.c Ajay Singh
2018-10-08 14:44 ` Johannes Berg
2018-10-11 7:12 ` Ajay Singh
2018-10-11 7:15 ` Johannes Berg
2018-09-26 10:25 ` [PATCH 15/19] wilc: add wilc_spi.c Ajay Singh
2018-09-26 10:25 ` [PATCH 16/19] wilc: add wilc_sdio.c Ajay Singh
2018-09-26 10:25 ` [PATCH 17/19] wilc: updated DT device binding for wilc device Ajay Singh
2018-09-26 10:25 ` [PATCH 18/19] wilc: add Makefile and Kconfig files for wilc compilation Ajay Singh
2018-09-26 10:25 ` [PATCH 19/19] wilc: added wilc module compilation in wireless Makefile & Kconfig Ajay Singh
2018-10-06 12:45 ` [RFC 00/19] wilc: added driver for wilc module Kalle Valo
2018-10-08 5:17 ` Ajay Singh
2018-10-08 7:38 ` Kalle Valo
2018-10-08 18:34 ` Adham.Abozaeid
2018-11-15 14:11 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1539009674.3687.75.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=adham.abozaeid@microchip.com \
--cc=aditya.shankar@microchip.com \
--cc=ajay.kathat@microchip.com \
--cc=claudiu.beznea@microchip.com \
--cc=ganesh.krishna@microchip.com \
--cc=gregkh@linuxfoundation.org \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=venkateswara.kaja@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).