Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] Driver: Vmxnet3: Reinitialize vmxnet3 backend on wakeup from hibernate
From: Shrikrishna Khare @ 2015-01-09 23:19 UTC (permalink / raw)
  To: sbhatewara, pv-drivers, netdev, linux-kernel
  Cc: Shrikrishna Khare, Srividya Murali

Failing to reinitialize on wakeup results in loss of network connectivity for
vmxnet3 interface.

Signed-off-by: Srividya Murali <smurali@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Reviewed-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
---
 drivers/net/vmxnet3/vmxnet3_drv.c |   44 +++++++++++++++++++++----------------
 drivers/net/vmxnet3/vmxnet3_int.h |    4 +-
 2 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 7af1f5c..3143981 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -3290,27 +3290,15 @@ skip_arp:
 static int
 vmxnet3_resume(struct device *device)
 {
-	int err, i = 0;
+	int err;
 	unsigned long flags;
 	struct pci_dev *pdev = to_pci_dev(device);
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct vmxnet3_adapter *adapter = netdev_priv(netdev);
-	struct Vmxnet3_PMConf *pmConf;
 
 	if (!netif_running(netdev))
 		return 0;
 
-	/* Destroy wake-up filters. */
-	pmConf = adapter->pm_conf;
-	memset(pmConf, 0, sizeof(*pmConf));
-
-	adapter->shared->devRead.pmConfDesc.confVer = cpu_to_le32(1);
-	adapter->shared->devRead.pmConfDesc.confLen = cpu_to_le32(sizeof(
-								  *pmConf));
-	adapter->shared->devRead.pmConfDesc.confPA =
-		cpu_to_le64(adapter->pm_conf_pa);
-
-	netif_device_attach(netdev);
 	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
 	err = pci_enable_device_mem(pdev);
@@ -3319,15 +3307,31 @@ vmxnet3_resume(struct device *device)
 
 	pci_enable_wake(pdev, PCI_D0, 0);
 
+	vmxnet3_alloc_intr_resources(adapter);
+
+	/* During hibernate and suspend, device has to be reinitialized as the
+	 * device state need not be preserved.
+	 */
+
+	/* Need not check adapter state as other reset tasks cannot run during
+	 * device resume.
+	 */
 	spin_lock_irqsave(&adapter->cmd_lock, flags);
 	VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
-			       VMXNET3_CMD_UPDATE_PMCFG);
+			       VMXNET3_CMD_QUIESCE_DEV);
 	spin_unlock_irqrestore(&adapter->cmd_lock, flags);
-	vmxnet3_alloc_intr_resources(adapter);
-	vmxnet3_request_irqs(adapter);
-	for (i = 0; i < adapter->num_rx_queues; i++)
-		napi_enable(&adapter->rx_queue[i].napi);
-	vmxnet3_enable_all_intrs(adapter);
+	vmxnet3_tq_cleanup_all(adapter);
+	vmxnet3_rq_cleanup_all(adapter);
+
+	vmxnet3_reset_dev(adapter);
+	err = vmxnet3_activate_dev(adapter);
+	if (err != 0) {
+		netdev_err(netdev,
+			   "failed to re-activate on resume, error: %d", err);
+		vmxnet3_force_close(adapter);
+		return err;
+	}
+	netif_device_attach(netdev);
 
 	return 0;
 }
@@ -3335,6 +3339,8 @@ vmxnet3_resume(struct device *device)
 static const struct dev_pm_ops vmxnet3_pm_ops = {
 	.suspend = vmxnet3_suspend,
 	.resume = vmxnet3_resume,
+	.freeze = vmxnet3_suspend,
+	.restore = vmxnet3_resume,
 };
 #endif
 
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index 048f020..6297d9f 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -69,10 +69,10 @@
 /*
  * Version numbers
  */
-#define VMXNET3_DRIVER_VERSION_STRING   "1.3.1.0-k"
+#define VMXNET3_DRIVER_VERSION_STRING   "1.3.2.0-k"
 
 /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
-#define VMXNET3_DRIVER_VERSION_NUM      0x01030100
+#define VMXNET3_DRIVER_VERSION_NUM      0x01030200
 
 #if defined(CONFIG_PCI_MSI)
 	/* RSS only makes sense if MSI-X is supported. */
-- 
1.7.4.1

^ permalink raw reply related

* Re: [PATCH net-next] Driver: Vmxnet3: Reinitialize vmxnet3 backend on wakeup from hibernate
From: Shrikrishna Khare @ 2015-01-09 23:20 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: sbhatewara, pv-drivers, netdev, linux-kernel, Srividya Murali
In-Reply-To: <54ADABDE.6030008@cogentembedded.com>


Hi Sergei,

 Thanks for the review. I have addressed all the review comments and 
resubmitted the patch.

Thanks,
Shri

On Wed, 7 Jan 2015, Sergei Shtylyov wrote:

> Hello.
> 
> On 01/07/2015 08:56 PM, Shrikrishna Khare wrote:
> 
> > Failing to reinitialize on wakeup results in loss of network connectivity
> > for
> > vmxnet3 interface.
> 
> > Signed-off-by: Srividya Murali <smurali@vmware.com>
> > Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
> > Reviewed-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
> > ---
> >   drivers/net/vmxnet3/vmxnet3_drv.c |   50
> > +++++++++++++++++++++---------------
> >   drivers/net/vmxnet3/vmxnet3_int.h |    4 +-
> >   2 files changed, 31 insertions(+), 23 deletions(-)
> 
> > diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c
> > b/drivers/net/vmxnet3/vmxnet3_drv.c
> > index 7af1f5c..124cb9f 100644
> > --- a/drivers/net/vmxnet3/vmxnet3_drv.c
> > +++ b/drivers/net/vmxnet3/vmxnet3_drv.c
> > @@ -3290,51 +3290,59 @@ skip_arp:
> >   static int
> >   vmxnet3_resume(struct device *device)
> >   {
> > -	int err, i = 0;
> > +	int err;
> >   	unsigned long flags;
> >   	struct pci_dev *pdev = to_pci_dev(device);
> >   	struct net_device *netdev = pci_get_drvdata(pdev);
> >   	struct vmxnet3_adapter *adapter = netdev_priv(netdev);
> > -	struct Vmxnet3_PMConf *pmConf;
> > 
> >   	if (!netif_running(netdev))
> >   		return 0;
> > 
> > -	/* Destroy wake-up filters. */
> > -	pmConf = adapter->pm_conf;
> > -	memset(pmConf, 0, sizeof(*pmConf));
> > -
> > -	adapter->shared->devRead.pmConfDesc.confVer = cpu_to_le32(1);
> > -	adapter->shared->devRead.pmConfDesc.confLen = cpu_to_le32(sizeof(
> > -								  *pmConf));
> > -	adapter->shared->devRead.pmConfDesc.confPA =
> > -		cpu_to_le64(adapter->pm_conf_pa);
> > -
> > -	netif_device_attach(netdev);
> >   	pci_set_power_state(pdev, PCI_D0);
> >   	pci_restore_state(pdev);
> >   	err = pci_enable_device_mem(pdev);
> >   	if (err != 0)
> > -		return err;
> > +		goto err;
> 
>    Why?
> 
> > 
> >   	pci_enable_wake(pdev, PCI_D0, 0);
> > 
> > +	vmxnet3_alloc_intr_resources(adapter);
> > +
> > +	/* During hibernate and suspend, device has to be reinitialized as the
> > +	 * device state need not be preserved.
> > +	 */
> > +
> > +	/* Need not check adapter state as other reset tasks cannot run during
> > +	 * device resume.
> > +	 */
> >   	spin_lock_irqsave(&adapter->cmd_lock, flags);
> >   	VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
> > -			       VMXNET3_CMD_UPDATE_PMCFG);
> > +			       VMXNET3_CMD_QUIESCE_DEV);
> >   	spin_unlock_irqrestore(&adapter->cmd_lock, flags);
> > -	vmxnet3_alloc_intr_resources(adapter);
> > -	vmxnet3_request_irqs(adapter);
> > -	for (i = 0; i < adapter->num_rx_queues; i++)
> > -		napi_enable(&adapter->rx_queue[i].napi);
> > -	vmxnet3_enable_all_intrs(adapter);
> > +	vmxnet3_tq_cleanup_all(adapter);
> > +	vmxnet3_rq_cleanup_all(adapter);
> > 
> > -	return 0;
> > +	vmxnet3_reset_dev(adapter);
> > +	err = vmxnet3_activate_dev(adapter);
> > +	if (err) {
> > +		netdev_err(adapter->netdev,
> 
>    Not just 'netdev'?
> 
> > +			   "%s: failed to re-activate on resume, error: %d",
> > +		    netdev->name, err);
> 
>    Should have been aligned with the line right above. And isn't netdev->name
> printed by netdev_err() already?
> 
> > +		vmxnet3_force_close(adapter);
> > +		goto err;
> 
>    Why not just *return*?
> 
> > +	}
> > +	netif_device_attach(netdev);
> > +
> > +err:
> > +	return err;
> >   }
> [...]
> 
> WBR, Sergei
> 
> 

^ permalink raw reply

* [PATCH RFC ethtool]  QSFP Diagnostics Information Support
From: vidya @ 2015-01-09 23:41 UTC (permalink / raw)
  To: netdev, bwh; +Cc: shm, vidya, roopa, bkenward, dave.lee

From: Vidya Sagar Ravipati <vidya@cumulusnetworks.com>

This patch provides support for diagnostics information
for QSFP Plus modules which based on SFF 8436 specification
This implementation is loosely based on current SFP DOM parser
and SFF-8436 specs (ftp://ftp.seagate.com/pub/sff/SFF-8436.PDF)
by SFF Committee.

Signed-off-by: Vidya Sagar Ravipati <vidya@cumulusnetworks.com>
---
 Makefile.am    |    2 +-
 ethtool-copy.h |    2 +
 ethtool.c      |    3 +
 internal.h     |    3 +
 qsfp.c         |  827 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 qsfp.h         |  541 ++++++++++++++++++++++++++++++++++++
 6 files changed, 1377 insertions(+), 1 deletion(-)
 create mode 100644 qsfp.c
 create mode 100644 qsfp.h

diff --git a/Makefile.am b/Makefile.am
index 4698d16..b6162db 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,7 +13,7 @@ ethtool_SOURCES += \
 		  fec_8xx.c ibm_emac.c ixgb.c ixgbe.c natsemi.c	\
 		  pcnet32.c realtek.c tg3.c marvell.c vioc.c	\
 		  smsc911x.c at76c50x-usb.c sfc.c stmmac.c	\
-		  sfpid.c sfpdiag.c ixgbevf.c tse.c
+		  sfpid.c sfpdiag.c ixgbevf.c tse.c qsfp.c
 endif
 
 TESTS = test-cmdline test-features
diff --git a/ethtool-copy.h b/ethtool-copy.h
index 61b78fc..8c4fb8b 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -1314,6 +1314,8 @@ enum ethtool_sfeatures_retval_bits {
 #define ETH_MODULE_SFF_8079_LEN		256
 #define ETH_MODULE_SFF_8472		0x2
 #define ETH_MODULE_SFF_8472_LEN		512
+#define ETH_MODULE_SFF_8436     0x3
+#define ETH_MODULE_SFF_8436_LEN     640
 
 /* Reset flags */
 /* The reset() operation must clear the flags for the components which
diff --git a/ethtool.c b/ethtool.c
index bf583f3..8cf1968 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -3918,6 +3918,9 @@ static int do_getmodule(struct cmd_context *ctx)
 				sff8079_show_all(eeprom->data);
 				sff8472_show_all(eeprom->data);
 				break;
+			case ETH_MODULE_SFF_8436:
+				sff8436_show_all(eeprom->data);
+				break;
 #endif
 			default:
 				geeprom_dump_hex = 1;
diff --git a/internal.h b/internal.h
index a9dfae0..03543a9 100644
--- a/internal.h
+++ b/internal.h
@@ -262,4 +262,7 @@ void sff8079_show_all(const __u8 *id);
 /* Optics diagnostics */
 void sff8472_show_all(const __u8 *id);
 
+/* QSFP Optics diagnostics */
+void sff8436_show_all(const __u8 *id);
+
 #endif /* ETHTOOL_INTERNAL_H__ */
diff --git a/qsfp.c b/qsfp.c
new file mode 100644
index 0000000..03e80d9
--- /dev/null
+++ b/qsfp.c
@@ -0,0 +1,827 @@
+/*
+ * qsfp.c: Implements SFF-8436 based QSFP+ Diagnostics Memory map.
+ *
+ * Copyright (C) 2014 Cumulus networks Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Freeoftware Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ *  Vidya Ravipati <vidya@cumulusnetworks.com>
+ *   This implementation is loosely based on current SFP parser
+ *   and SFF-8436 specs (ftp://ftp.seagate.com/pub/sff/SFF-8436.PDF)
+ *   by SFF Committee.
+ */
+
+/*
+ *	Description:
+ *	a) The register/memory layout is up to 5 128 byte pages defined by
+ *		a "pages valid" register and switched via a "page select"
+ *		register. Memory of 256 bytes can be memory mapped at a time
+ *		according to SFF 8436.
+ *	b) SFF 8436 based 640 bytes memory layout is presented for parser
+ *
+ *           SFF 8436 based QSFP Memory Map
+ *
+ *           2-Wire Serial Address: 1010000x
+ *
+ *           Lower Page 00h (128 bytes)
+ *           ======================
+ *           |                     |
+ *           |Page Select Byte(127)|
+ *           ======================
+ *                    |
+ *                    V
+ *	     ----------------------------------------
+ *	    |             |            |             |
+ *	    V             V            V             V
+ *	 ----------   ----------   ---------    ------------
+ *	| Upper    | | Upper    | | Upper    | | Upper      |
+ *	| Page 00h | | Page 01h | | Page 02h | | Page 03h   |
+ *	|          | |(Optional)| |(Optional)| | (Optional) |
+ *	|          | |          | |          | |            |
+ *	|          | |          | |          | |            |
+ *	|    ID    | |   AST    | |  User    | |  For       |
+ *	|  Fields  | |  Table   | | EEPROM   | |  Cable     |
+ *	|          | |          | | Data     | | Assemblies |
+ *	|          | |          | |          | |            |
+ *	|          | |          | |          | |            |
+ *	-----------  -----------   ----------  --------------
+ *
+ *
+ **/
+#include <stdio.h>
+#include <math.h>
+#include "internal.h"
+#include "qsfp.h"
+
+#define MAX_DESC_SIZE	42
+
+/* Channel Monitoring Fields */
+struct sff8436_channel_diags {
+
+	__u16 bias_cur;      /* Measured bias current in 2uA units */
+	__u16 rx_power;      /* Measured RX Power */
+
+};
+
+/* Module Monitoring Fields */
+struct sff8436_diags {
+
+#define MAX_CHANNEL_NUM 4
+#define LWARN 0
+#define HWARN 1
+#define LALRM 2
+#define HALRM 3
+
+	__u8 supports_dom;      /* Supports DOM */
+	__u8 supports_alarms;   /* Supports alarm/warning thold */
+	__u8  rx_power_type;    /* 0 = OMA, 1 = Average power */
+	__u16 sfp_voltage;   /* SFP voltage in 0.1mV units */
+	__s16 sfp_temp;      /* SFP Temp in 16-bit signed 1/256 Celcius */
+	/* [4] tables are low/high warn, low/high alarm */
+	/* SFP voltage in 0.1mV units */
+	__u16 thresh_sfp_voltage[4];
+	/* SFP Temp in 16-bit signed 1/256 Celcius */
+	__s16 thresh_sfp_temp[4];
+	/* Measured bias current in 2uA units */
+	__u16 thresh_bias_cur[4];
+	/* Measured RX Power */
+	__u16 thresh_rx_power[4];
+	struct sff8436_channel_diags scd[MAX_CHANNEL_NUM];
+};
+
+static struct sff8436_aw_flags {
+	const char *str;        /* Human-readable string, null at the end */
+	int offset;             /* A2-relative adress offset */
+	__u8 value;             /* Alarm is on if (offset & value) != 0. */
+} sff8436_aw_flags[] = {
+	{ "Laser bias current high alarm   (Chan 1)",
+		SFF8436_TX_BIAS_12_AW_OFFSET, (SFF8436_TX_BIAS_1_HALARM) },
+	{ "Laser bias current low alarm    (Chan 1)",
+		SFF8436_TX_BIAS_12_AW_OFFSET, (SFF8436_TX_BIAS_1_LALARM) },
+	{ "Laser bias current high warning (Chan 1)",
+		SFF8436_TX_BIAS_12_AW_OFFSET, (SFF8436_TX_BIAS_1_HWARN) },
+	{ "Laser bias current low warning  (Chan 1)",
+		SFF8436_TX_BIAS_12_AW_OFFSET, (SFF8436_TX_BIAS_1_LWARN) },
+
+	{ "Laser bias current high alarm   (Chan 2)",
+		SFF8436_TX_BIAS_12_AW_OFFSET, (SFF8436_TX_BIAS_2_HALARM) },
+	{ "Laser bias current low alarm    (Chan 2)",
+		SFF8436_TX_BIAS_12_AW_OFFSET, (SFF8436_TX_BIAS_2_LALARM) },
+	{ "Laser bias current high warning (Chan 2)",
+		SFF8436_TX_BIAS_12_AW_OFFSET, (SFF8436_TX_BIAS_2_HWARN) },
+	{ "Laser bias current low warning  (Chan 2)",
+		SFF8436_TX_BIAS_12_AW_OFFSET, (SFF8436_TX_BIAS_2_LWARN) },
+
+	{ "Laser bias current high alarm   (Chan 3)",
+		SFF8436_TX_BIAS_34_AW_OFFSET, (SFF8436_TX_BIAS_3_HALARM) },
+	{ "Laser bias current low alarm    (Chan 3)",
+		SFF8436_TX_BIAS_34_AW_OFFSET, (SFF8436_TX_BIAS_3_LALARM) },
+	{ "Laser bias current high warning (Chan 3)",
+		SFF8436_TX_BIAS_34_AW_OFFSET, (SFF8436_TX_BIAS_3_HWARN) },
+	{ "Laser bias current low warning  (Chan 3)",
+		SFF8436_TX_BIAS_34_AW_OFFSET, (SFF8436_TX_BIAS_3_LWARN) },
+
+	{ "Laser bias current high alarm   (Chan 4)",
+		SFF8436_TX_BIAS_34_AW_OFFSET, (SFF8436_TX_BIAS_4_HALARM) },
+	{ "Laser bias current low alarm    (Chan 4)",
+		SFF8436_TX_BIAS_34_AW_OFFSET, (SFF8436_TX_BIAS_4_LALARM) },
+	{ "Laser bias current high warning (Chan 4)",
+		SFF8436_TX_BIAS_34_AW_OFFSET, (SFF8436_TX_BIAS_4_HWARN) },
+	{ "Laser bias current low warning  (Chan 4)",
+		SFF8436_TX_BIAS_34_AW_OFFSET, (SFF8436_TX_BIAS_4_LWARN) },
+
+	{ "Module temperature high alarm",
+		SFF8436_TEMP_AW_OFFSET, (SFF8436_TEMP_HALARM_STATUS) },
+	{ "Module temperature low alarm",
+		SFF8436_TEMP_AW_OFFSET, (SFF8436_TEMP_LALARM_STATUS) },
+	{ "Module temperature high warning",
+		SFF8436_TEMP_AW_OFFSET, (SFF8436_TEMP_HWARN_STATUS) },
+	{ "Module temperature low warning",
+		SFF8436_TEMP_AW_OFFSET, (SFF8436_TEMP_LWARN_STATUS) },
+
+	{ "Module voltage high alarm",
+		SFF8436_VCC_AW_OFFSET, (SFF8436_VCC_HALARM_STATUS) },
+	{ "Module voltage low alarm",
+		SFF8436_VCC_AW_OFFSET, (SFF8436_VCC_LALARM_STATUS) },
+	{ "Module voltage high warning",
+		SFF8436_VCC_AW_OFFSET, (SFF8436_VCC_HWARN_STATUS) },
+	{ "Module voltage low warning",
+		SFF8436_VCC_AW_OFFSET, (SFF8436_VCC_LWARN_STATUS) },
+
+	{ "Laser rx power high alarm   (Channel 1)",
+		SFF8436_RX_PWR_12_AW_OFFSET, (SFF8436_RX_PWR_1_HALARM) },
+	{ "Laser rx power low alarm    (Channel 1)",
+		SFF8436_RX_PWR_12_AW_OFFSET, (SFF8436_RX_PWR_1_LALARM) },
+	{ "Laser rx power high warning (Channel 1)",
+		SFF8436_RX_PWR_12_AW_OFFSET, (SFF8436_RX_PWR_1_HWARN) },
+	{ "Laser rx power low warning  (Channel 1)",
+		SFF8436_RX_PWR_12_AW_OFFSET, (SFF8436_RX_PWR_1_LWARN) },
+
+	{ "Laser rx power high alarm   (Channel 2)",
+		SFF8436_RX_PWR_12_AW_OFFSET, (SFF8436_RX_PWR_2_HALARM) },
+	{ "Laser rx power low alarm    (Channel 2)",
+		SFF8436_RX_PWR_12_AW_OFFSET, (SFF8436_RX_PWR_2_LALARM) },
+	{ "Laser rx power high warning (Channel 2)",
+		SFF8436_RX_PWR_12_AW_OFFSET, (SFF8436_RX_PWR_2_HWARN) },
+	{ "Laser rx power low warning  (Channel 2)",
+		SFF8436_RX_PWR_12_AW_OFFSET, (SFF8436_RX_PWR_2_LWARN) },
+
+	{ "Laser rx power high alarm   (Channel 3)",
+		SFF8436_RX_PWR_34_AW_OFFSET, (SFF8436_RX_PWR_3_HALARM) },
+	{ "Laser rx power low alarm    (Channel 3)",
+		SFF8436_RX_PWR_34_AW_OFFSET, (SFF8436_RX_PWR_3_LALARM) },
+	{ "Laser rx power high warning (Channel 3)",
+		SFF8436_RX_PWR_34_AW_OFFSET, (SFF8436_RX_PWR_3_HWARN) },
+	{ "Laser rx power low warning  (Channel 3)",
+		SFF8436_RX_PWR_34_AW_OFFSET, (SFF8436_RX_PWR_3_LWARN) },
+
+	{ "Laser rx power high alarm   (Channel 4)",
+		SFF8436_RX_PWR_34_AW_OFFSET, (SFF8436_RX_PWR_4_HALARM) },
+	{ "Laser rx power low alarm    (Channel 4)",
+		SFF8436_RX_PWR_34_AW_OFFSET, (SFF8436_RX_PWR_4_LALARM) },
+	{ "Laser rx power high warning (Channel 4)",
+		SFF8436_RX_PWR_34_AW_OFFSET, (SFF8436_RX_PWR_4_HWARN) },
+	{ "Laser rx power low warning  (Channel 4)",
+		SFF8436_RX_PWR_34_AW_OFFSET, (SFF8436_RX_PWR_4_LWARN) },
+
+	{ NULL, 0, 0 },
+};
+
+static void sff8436_show_identifier(const __u8 *id)
+{
+	printf("\t%-41s : 0x%02x", "Identifier", id[SFF8436_ID_OFFSET]);
+	switch (id[SFF8436_ID_OFFSET]) {
+	case SFF8436_ID_UNKNOWN:
+		printf(" (no module present, unknown, or unspecified)\n");
+		break;
+	case SFF8436_ID_GBIC:
+		printf(" (GBIC)\n");
+		break;
+	case SFF8436_ID_SOLDERED_MODULE:
+		printf(" (module soldered to motherboard)\n");
+		break;
+	case SFF8436_ID_SFP:
+		printf(" (SFP)\n");
+		break;
+	case SFF8436_ID_300_PIN_XBI:
+		printf(" (300 pin XBI)\n");
+		break;
+	case SFF8436_ID_XENPAK:
+		printf(" (XENPAK)\n");
+		break;
+	case SFF8436_ID_XFP:
+		printf(" (XFP)\n");
+		break;
+	case SFF8436_ID_XFF:
+		printf(" (XFF)\n");
+		break;
+	case SFF8436_ID_XFP_E:
+		printf(" (XFP-E)\n");
+		break;
+	case SFF8436_ID_XPAK:
+		printf(" (XPAK)\n");
+		break;
+	case SFF8436_ID_X2:
+		printf(" (X2)\n");
+		break;
+	case SFF8436_ID_DWDM_SFP:
+		printf(" (DWDM-SFP)\n");
+		break;
+	case SFF8436_ID_DWDM_QSFP:
+		printf(" (QSFP)\n");
+		break;
+	case SFF8436_ID_DWDM_QSFP_PLUS:
+		printf(" (QSFP+)\n");
+		break;
+	default:
+		printf(" (reserved or unknown)\n");
+		break;
+	}
+}
+
+static void sff8436_show_ext_identifier(const __u8 *id)
+{
+	printf("\t%-41s : 0x%02x", "Extended identifier",
+			id[SFF8436_EXT_ID_OFFSET]);
+
+	switch (id[SFF8436_EXT_ID_OFFSET] & SFF8436_EXT_ID_PWR_CLASS_MASK) {
+	case SFF8436_EXT_ID_PWR_CLASS_1:
+		printf(" (1.5W max. Power consumption,");
+		break;
+	case SFF8436_EXT_ID_PWR_CLASS_2:
+		printf(" (2.0W max. Power consumption,");
+		break;
+	case SFF8436_EXT_ID_PWR_CLASS_3:
+		printf(" (2.5W max. Power consumption,");
+		break;
+	case SFF8436_EXT_ID_PWR_CLASS_4:
+		printf(" (3.5W max. Power consumption,");
+		break;
+	}
+	if (id[SFF8436_EXT_ID_OFFSET] & SFF8436_EXT_ID_CDR_TX_MASK)
+		printf(" CDR present in TX,");
+	else
+		printf(" No CDR in TX,");
+
+	if (id[SFF8436_EXT_ID_OFFSET] & SFF8436_EXT_ID_CDR_RX_MASK)
+		printf(" CDR present in RX)\n");
+	else
+		printf(" No CDR in RX)\n");
+}
+
+static void sff8436_show_connector(const __u8 *id)
+{
+	printf("\t%-41s : 0x%02x", "Connector", id[SFF8436_CTOR_OFFSET]);
+	switch (id[SFF8436_CTOR_OFFSET]) {
+	case SFF8436_CTOR_UNKNOWN:
+		printf(" (unknown or unspecified)\n");
+		break;
+	case SFF8436_CTOR_SC:
+		printf(" (SC)\n");
+		break;
+	case SFF8436_CTOR_FC_STYLE_1:
+		printf(" (Fibre Channel Style 1 copper)\n");
+		break;
+	case SFF8436_CTOR_FC_STYLE_2:
+		printf(" (Fibre Channel Style 2 copper)\n");
+		break;
+	case SFF8436_CTOR_BNC_TNC:
+		printf(" (BNC/TNC)\n");
+		break;
+	case SFF8436_CTOR_FC_COAX:
+		printf(" (Fibre Channel coaxial headers)\n");
+		break;
+	case SFF8436_CTOR_FIBER_JACK:
+		printf(" (FibreJack)\n");
+		break;
+	case SFF8436_CTOR_LC:
+		printf(" (LC)\n");
+		break;
+	case SFF8436_CTOR_MT_RJ:
+		printf(" (MT-RJ)\n");
+		break;
+	case SFF8436_CTOR_MU:
+		printf(" (MU)\n");
+		break;
+	case SFF8436_CTOR_SG:
+		printf(" (SG)\n");
+		break;
+	case SFF8436_CTOR_OPT_PT:
+		printf(" (Optical pigtail)\n");
+		break;
+	case SFF8436_CTOR_MPO:
+		printf(" (MPO Parallel Optic)\n");
+		break;
+	case SFF8436_CTOR_HSDC_II:
+		printf(" (HSSDC II)\n");
+		break;
+	case SFF8436_CTOR_COPPER_PT:
+		printf(" (Copper pigtail)\n");
+		break;
+	case SFF8436_CTOR_RJ45:
+		printf(" (RJ45)\n");
+		break;
+	case SFF8436_CTOR_NO_SEPARABLE:
+		printf(" (No separable connector)\n");
+		break;
+	default:
+		printf(" (reserved or unknown)\n");
+		break;
+	}
+}
+
+static void sff8436_show_transceiver(const __u8 *id)
+{
+	static const char *pfx =
+		"\tTransceiver type                          :";
+
+	printf("\t%-41s : 0x%02x 0x%02x 0x%02x " \
+			"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
+			"Transceiver codes",
+			id[SFF8436_ETHERNET_COMP_OFFSET],
+			id[SFF8436_SONET_COMP_OFFSET],
+			id[SFF8436_SAS_COMP_OFFSET],
+			id[SFF8436_GIGE_COMP_OFFSET],
+			id[SFF8436_FC_LEN_OFFSET],
+			id[SFF8436_FC_TECH_OFFSET],
+			id[SFF8436_FC_TRANS_MEDIA_OFFSET],
+			id[SFF8436_FC_SPEED_OFFSET]);
+
+	/* 10G/40G Ethernet Compliance Codes */
+	if (id[SFF8436_ETHERNET_COMP_OFFSET] & SFF8436_ETHERNET_RSRVD)
+		printf("%s (reserved or unknown)\n", pfx);
+	if (id[SFF8436_ETHERNET_COMP_OFFSET] & SFF8436_ETHERNET_10G_LRM)
+		printf("%s 10G Ethernet: 10G Base-LRM\n", pfx);
+	if (id[SFF8436_ETHERNET_COMP_OFFSET] & SFF8436_ETHERNET_10G_LR)
+		printf("%s 10G Ethernet: 10G Base-LR\n", pfx);
+	if (id[SFF8436_ETHERNET_COMP_OFFSET] & SFF8436_ETHERNET_10G_SR)
+		printf("%s 10G Ethernet: 10G Base-SR\n", pfx);
+	if (id[SFF8436_ETHERNET_COMP_OFFSET] & SFF8436_ETHERNET_40G_CR4)
+		printf("%s 40G Ethernet: 40G Base-CR4\n", pfx);
+	if (id[SFF8436_ETHERNET_COMP_OFFSET] & SFF8436_ETHERNET_40G_SR4)
+		printf("%s 40G Ethernet: 40G Base-SR4\n", pfx);
+	if (id[SFF8436_ETHERNET_COMP_OFFSET] & SFF8436_ETHERNET_40G_LR4)
+		printf("%s 40G Ethernet: 40G Base-LR4\n", pfx);
+	if (id[SFF8436_ETHERNET_COMP_OFFSET] & SFF8436_ETHERNET_40G_ACTIVE)
+		printf("%s 40G Ethernet: 40G Active Cable (XLPPI)\n", pfx);
+
+	/* SONET Compliance Codes */
+	if (id[SFF8436_SONET_COMP_OFFSET] & (SFF8436_SONET_40G_OTN))
+		printf("%s 40G OTN (OTU3B/OTU3C)\n", pfx);
+	if (id[SFF8436_SONET_COMP_OFFSET] & (SFF8436_SONET_OC48_LR))
+		printf("%s SONET: OC-48, long reach\n", pfx);
+	if (id[SFF8436_SONET_COMP_OFFSET] & (SFF8436_SONET_OC48_IR))
+		printf("%s SONET: OC-48, intermediate reach\n", pfx);
+	if (id[SFF8436_SONET_COMP_OFFSET] & (SFF8436_SONET_OC48_SR))
+		printf("%s SONET: OC-48, short reach\n", pfx);
+
+	/* SAS/SATA Compliance Codes */
+	if (id[SFF8436_SAS_COMP_OFFSET] & (SFF8436_SAS_6G))
+		printf("%s SAS 6.0G\n", pfx);
+	if (id[SFF8436_SAS_COMP_OFFSET] & (SFF8436_SAS_3G))
+		printf("%s SAS 3.0G\n", pfx);
+
+	/* Ethernet Compliance Codes */
+	if (id[SFF8436_GIGE_COMP_OFFSET] & SFF8436_GIGE_1000_BASE_T)
+		printf("%s Ethernet: 1000BASE-T\n", pfx);
+	if (id[SFF8436_GIGE_COMP_OFFSET] & SFF8436_GIGE_1000_BASE_CX)
+		printf("%s Ethernet: 1000BASE-CX\n", pfx);
+	if (id[SFF8436_GIGE_COMP_OFFSET] & SFF8436_GIGE_1000_BASE_LX)
+		printf("%s Ethernet: 1000BASE-LX\n", pfx);
+	if (id[SFF8436_GIGE_COMP_OFFSET] & SFF8436_GIGE_1000_BASE_SX)
+		printf("%s Ethernet: 1000BASE-SX\n", pfx);
+
+	/* Fibre Channel link length */
+	if (id[SFF8436_FC_LEN_OFFSET] & SFF8436_FC_LEN_VERY_LONG)
+		printf("%s FC: very long distance (V)\n", pfx);
+	if (id[SFF8436_FC_LEN_OFFSET] & SFF8436_FC_LEN_SHORT)
+		printf("%s FC: short distance (S)\n", pfx);
+	if (id[SFF8436_FC_LEN_OFFSET] & SFF8436_FC_LEN_INT)
+		printf("%s FC: intermediate distance (I)\n", pfx);
+	if (id[SFF8436_FC_LEN_OFFSET] & SFF8436_FC_LEN_LONG)
+		printf("%s FC: long distance (L)\n", pfx);
+	if (id[SFF8436_FC_LEN_OFFSET] & SFF8436_FC_LEN_MED)
+		printf("%s FC: medium distance (M)\n", pfx);
+
+	/* Fibre Channel transmitter technology */
+	if (id[SFF8436_FC_LEN_OFFSET] & SFF8436_FC_TECH_LONG_LC)
+		printf("%s FC: Longwave laser (LC)\n", pfx);
+	if (id[SFF8436_FC_LEN_OFFSET] & SFF8436_FC_TECH_ELEC_INTER)
+		printf("%s FC: Electrical inter-enclosure (EL)\n", pfx);
+	if (id[SFF8436_FC_TECH_OFFSET] & SFF8436_FC_TECH_ELEC_INTRA)
+		printf("%s FC: Electrical intra-enclosure (EL)\n", pfx);
+	if (id[SFF8436_FC_TECH_OFFSET] & SFF8436_FC_TECH_SHORT_WO_OFC)
+		printf("%s FC: Shortwave laser w/o OFC (SN)\n", pfx);
+	if (id[SFF8436_FC_TECH_OFFSET] & SFF8436_FC_TECH_SHORT_W_OFC)
+		printf("%s FC: Shortwave laser with OFC (SL)\n", pfx);
+	if (id[SFF8436_FC_TECH_OFFSET] & SFF8436_FC_TECH_LONG_LL)
+		printf("%s FC: Longwave laser (LL)\n", pfx);
+
+	/* Fibre Channel transmission media */
+	if (id[SFF8436_FC_TRANS_MEDIA_OFFSET] & SFF8436_FC_TRANS_MEDIA_TW)
+		printf("%s FC: Twin Axial Pair (TW)\n", pfx);
+	if (id[SFF8436_FC_TRANS_MEDIA_OFFSET] & SFF8436_FC_TRANS_MEDIA_TP)
+		printf("%s FC: Twisted Pair (TP)\n", pfx);
+	if (id[SFF8436_FC_TRANS_MEDIA_OFFSET] & SFF8436_FC_TRANS_MEDIA_MI)
+		printf("%s FC: Miniature Coax (MI)\n", pfx);
+	if (id[SFF8436_FC_TRANS_MEDIA_OFFSET] & SFF8436_FC_TRANS_MEDIA_TV)
+		printf("%s FC: Video Coax (TV)\n", pfx);
+	if (id[SFF8436_FC_TRANS_MEDIA_OFFSET] & SFF8436_FC_TRANS_MEDIA_M6)
+		printf("%s FC: Multimode, 62.5m (M6)\n", pfx);
+	if (id[SFF8436_FC_TRANS_MEDIA_OFFSET] & SFF8436_FC_TRANS_MEDIA_M5)
+		printf("%s FC: Multimode, 50m (M5)\n", pfx);
+	if (id[SFF8436_FC_TRANS_MEDIA_OFFSET] & SFF8436_FC_TRANS_MEDIA_OM3)
+		printf("%s FC: Multimode, 50um (OM3)\n", pfx);
+	if (id[SFF8436_FC_TRANS_MEDIA_OFFSET] & SFF8436_FC_TRANS_MEDIA_SM)
+		printf("%s FC: Single Mode (SM)\n", pfx);
+
+	/* Fibre Channel speed */
+	if (id[SFF8436_FC_SPEED_OFFSET] & SFF8436_FC_SPEED_1200_MBPS)
+		printf("%s FC: 1200 MBytes/sec\n", pfx);
+	if (id[SFF8436_FC_SPEED_OFFSET] & SFF8436_FC_SPEED_800_MBPS)
+		printf("%s FC: 800 MBytes/sec\n", pfx);
+	if (id[SFF8436_FC_SPEED_OFFSET] & SFF8436_FC_SPEED_1600_MBPS)
+		printf("%s FC: 1600 MBytes/sec\n", pfx);
+	if (id[SFF8436_FC_SPEED_OFFSET] & SFF8436_FC_SPEED_400_MBPS)
+		printf("%s FC: 400 MBytes/sec\n", pfx);
+	if (id[SFF8436_FC_SPEED_OFFSET] & SFF8436_FC_SPEED_200_MBPS)
+		printf("%s FC: 200 MBytes/sec\n", pfx);
+	if (id[SFF8436_FC_SPEED_OFFSET] & SFF8436_FC_SPEED_100_MBPS)
+		printf("%s FC: 100 MBytes/sec\n", pfx);
+}
+
+static void sff8436_show_encoding(const __u8 *id)
+{
+	printf("\t%-41s : 0x%02x", "Encoding", id[SFF8436_ENCODING_OFFSET]);
+	switch (id[SFF8436_ENCODING_OFFSET]) {
+	case SFF8436_ENCODING_UNSPEC:
+		printf(" (unspecified)\n");
+		break;
+	case SFF8436_ENCODING_8B10B:
+		printf(" (8B/10B)\n");
+		break;
+	case SFF8436_ENCODING_4B5B:
+		printf(" (4B/5B)\n");
+		break;
+	case SFF8436_ENCODING_NRZ:
+		printf(" (NRZ)\n");
+		break;
+	case SFF8436_ENCODING_SONET:
+		printf(" (SONET Scrambled)\n");
+		break;
+	case SFF8436_ENCODING_64B66B:
+		printf(" (64B/66B)\n");
+		break;
+	case SFF8436_ENCODING_MANCHESTER:
+		printf(" (Manchester)\n");
+		break;
+	default:
+		printf(" (reserved or unknown)\n");
+		break;
+	}
+}
+
+static void sff8436_show_rate_identifier(const __u8 *id)
+{
+	/* TODO: Need to fix rate select logic */
+	printf("\t%-41s : 0x%02x\n", "Rate identifier",
+			id[SFF8436_EXT_RS_OFFSET]);
+}
+
+static void sff8436_show_oui(const __u8 *id)
+{
+	printf("\t%-41s : %02x:%02x:%02x\n", "Vendor OUI",
+	       id[SFF8436_VENDOR_OUI_OFFSET],
+	       id[SFF8436_VENDOR_OUI_OFFSET + 1],
+	       id[SFF8436_VENDOR_OUI_OFFSET + 2]);
+}
+
+static void sff8436_show_wavelength_or_copper_compliance(const __u8 *id)
+{
+	printf("\t%-41s : 0x%02x", "Transmitter technology",
+		(id[SFF8436_DEVICE_TECH_OFFSET] & SFF8436_TRANS_TECH_MASK));
+
+	switch (id[SFF8436_DEVICE_TECH_OFFSET] & SFF8436_TRANS_TECH_MASK) {
+	case SFF8436_TRANS_850_VCSEL:
+		printf(" (850 nm VCSEL)\n");
+		break;
+	case SFF8436_TRANS_1310_VCSEL:
+		printf(" (1310 nm VCSEL)\n");
+		break;
+	case SFF8436_TRANS_1550_VCSEL:
+		printf(" (1550 nm VCSEL)\n");
+		break;
+	case SFF8436_TRANS_1310_FP:
+		printf(" (1310 nm FP)\n");
+		break;
+	case SFF8436_TRANS_1310_DFB:
+		printf(" (1310 nm DFB)\n");
+		break;
+	case SFF8436_TRANS_1550_DFB:
+		printf(" (1550 nm DFB)\n");
+		break;
+	case SFF8436_TRANS_1310_EML:
+		printf(" (1310 nm EML)\n");
+		break;
+	case SFF8436_TRANS_1550_EML:
+		printf(" (1550 nm EML)\n");
+		break;
+	case SFF8436_TRANS_OTHERS:
+		printf(" (Others)\n");
+		break;
+	case SFF8436_TRANS_1490_DFB:
+		printf(" (1490 nm DFB)\n");
+		break;
+	case SFF8436_TRANS_COPPER_PAS_UNEQUAL:
+		printf(" (Copper cable unequalized)\n");
+		break;
+	case SFF8436_TRANS_COPPER_PAS_EQUAL:
+		printf(" (Copper cable passive equalized)\n");
+		break;
+	case SFF8436_TRANS_COPPER_LNR_FAR_EQUAL:
+		printf(" (Copper cable, near and far end "
+			"limiting active equalizers)\n");
+		break;
+	case SFF8436_TRANS_COPPER_FAR_EQUAL:
+		printf(" (Copper cable, far end limiting "
+			"active equalizers)\n");
+		break;
+	case SFF8436_TRANS_COPPER_NEAR_EQUAL:
+		printf(" (Copper cable, near end limiting "
+			"active equalizers)\n");
+		break;
+	case SFF8436_TRANS_COPPER_LNR_EQUAL:
+		printf(" (Copper cable, linear active equalizers)\n");
+		break;
+	}
+
+	if ((id[SFF8436_DEVICE_TECH_OFFSET] & SFF8436_TRANS_TECH_MASK)
+			>= SFF8436_TRANS_COPPER_PAS_UNEQUAL) {
+		printf("\t%-41s : %udb\n", "Attenuation at 2.5GHz",
+			id[SFF8436_WAVELEN_HIGH_BYTE_OFFSET]);
+		printf("\t%-41s : %udb\n", "Attenuation at 5.0GHz",
+			id[SFF8436_WAVELEN_LOW_BYTE_OFFSET]);
+	} else {
+		printf("\t%-41s : %.3lfnm\n", "Laser wavelength",
+			(((id[SFF8436_WAVELEN_HIGH_BYTE_OFFSET] << 8) |
+				id[SFF8436_WAVELEN_LOW_BYTE_OFFSET])*0.05));
+		printf("\t%-41s : %.3lfnm\n", "Laser wavelength tolerance",
+			(((id[SFF8436_WAVE_TOL_HIGH_BYTE_OFFSET] << 8) |
+			id[SFF8436_WAVE_TOL_LOW_BYTE_OFFSET])*0.005));
+	}
+}
+
+static void sff8436_show_value_with_unit(const __u8 *id, unsigned int reg,
+					 const char *name, unsigned int mult,
+					 const char *unit)
+{
+	unsigned int val = id[reg];
+
+	printf("\t%-41s : %u%s\n", name, val * mult, unit);
+}
+
+static void sff8436_show_ascii(const __u8 *id, unsigned int first_reg,
+			       unsigned int last_reg, const char *name)
+{
+	unsigned int reg, val;
+
+	printf("\t%-41s : ", name);
+	for (reg = first_reg; reg <= last_reg; reg++) {
+		val = id[reg];
+		putchar(((val >= 32) && (val <= 126)) ? val : '_');
+	}
+	printf("\n");
+}
+
+static double convert_mw_to_dbm(double mw)
+{
+	return (10. * log10(mw / 1000.)) + 30.;
+}
+
+/* Most common case: 16-bit unsigned integer in a certain unit */
+#define OFFSET_TO_U16(offset) \
+	(id[offset] << 8 | id[offset + 1])
+
+/*
+ * 2-byte internal temperature conversions:
+ * First byte is a signed 8-bit integer, which is the temp decimal part
+ * Second byte are 1/256th of degree, which are added to the dec part.
+ */
+#define SFF8436_OFFSET_TO_TEMP(offset) ((__s16)OFFSET_TO_U16(offset))
+
+static void sff8436_dom_parse(const __u8 *id, struct sff8436_diags *sd)
+{
+	int i = 0;
+
+	/* Monitoring Thresholds for Alarms and Warnings */
+	sd->thresh_sfp_voltage[HALRM] = OFFSET_TO_U16(SFF8436_VCC_HALRM);
+	sd->thresh_sfp_voltage[LALRM] = OFFSET_TO_U16(SFF8436_VCC_LALRM);
+	sd->thresh_sfp_voltage[HWARN] = OFFSET_TO_U16(SFF8436_VCC_HWARN);
+	sd->thresh_sfp_voltage[LWARN] = OFFSET_TO_U16(SFF8436_VCC_LWARN);
+
+	sd->thresh_sfp_temp[HALRM] = SFF8436_OFFSET_TO_TEMP(SFF8436_TEMP_HALRM);
+	sd->thresh_sfp_temp[LALRM] = SFF8436_OFFSET_TO_TEMP(SFF8436_TEMP_LALRM);
+	sd->thresh_sfp_temp[HWARN] = SFF8436_OFFSET_TO_TEMP(SFF8436_TEMP_HWARN);
+	sd->thresh_sfp_temp[LWARN] = SFF8436_OFFSET_TO_TEMP(SFF8436_TEMP_LWARN);
+
+	sd->thresh_bias_cur[HALRM] = OFFSET_TO_U16(SFF8436_TX_BIAS_HALRM);
+	sd->thresh_bias_cur[LALRM] = OFFSET_TO_U16(SFF8436_TX_BIAS_LALRM);
+	sd->thresh_bias_cur[HWARN] = OFFSET_TO_U16(SFF8436_TX_BIAS_HWARN);
+	sd->thresh_bias_cur[LWARN] = OFFSET_TO_U16(SFF8436_TX_BIAS_LWARN);
+
+	sd->thresh_rx_power[HALRM] = OFFSET_TO_U16(SFF8436_RX_PWR_HALRM);
+	sd->thresh_rx_power[LALRM] = OFFSET_TO_U16(SFF8436_RX_PWR_LALRM);
+	sd->thresh_rx_power[HWARN] = OFFSET_TO_U16(SFF8436_RX_PWR_HWARN);
+	sd->thresh_rx_power[LWARN] = OFFSET_TO_U16(SFF8436_RX_PWR_LWARN);
+
+	/* Current Values for Module */
+	sd->sfp_voltage = OFFSET_TO_U16(SFF8436_VCC_CURR);
+	sd->sfp_temp = SFF8436_OFFSET_TO_TEMP(SFF8436_TEMP_CURR);
+
+	/* Channel Specific Data */
+	for (i = 0; i < MAX_CHANNEL_NUM; i++) {
+		u8 rx_power_offset, tx_bias_offset;
+
+		switch (i) {
+		case 0:
+			rx_power_offset = SFF8436_RX_PWR_1_OFFSET;
+			tx_bias_offset = SFF8436_TX_BIAS_1_OFFSET;
+			break;
+		case 1:
+			rx_power_offset = SFF8436_RX_PWR_2_OFFSET;
+			tx_bias_offset = SFF8436_TX_BIAS_2_OFFSET;
+			break;
+		case 2:
+			rx_power_offset = SFF8436_RX_PWR_3_OFFSET;
+			tx_bias_offset = SFF8436_TX_BIAS_3_OFFSET;
+			break;
+		case 3:
+			rx_power_offset = SFF8436_RX_PWR_4_OFFSET;
+			tx_bias_offset = SFF8436_TX_BIAS_4_OFFSET;
+			break;
+		default:
+			printf(" Invalid channel: %d\n", i);
+			break;
+		}
+		sd->scd[i].bias_cur = OFFSET_TO_U16(tx_bias_offset);
+		sd->scd[i].rx_power = OFFSET_TO_U16(rx_power_offset);
+	}
+
+}
+
+static void sff8436_show_dom(const __u8 *id)
+{
+	struct sff8436_diags sd;
+	char *rx_power_string = NULL;
+	char power_string[MAX_DESC_SIZE];
+	int i;
+
+	/*
+	 * There is no clear identifier to signify the existance of
+	 * optical diagnostics similar to SFF-8472. So checking existance
+	 * of page 3, will provide the gurantee for existance of alarms
+	 * and thresholds
+	 */
+	sd.supports_alarms = id[SFF8436_STATUS_2_OFFSET] &
+						SFF8436_STATUS_PAGE_3_PRESENT;
+	sd.rx_power_type = id[SFF8436_DIAG_TYPE_OFFSET] &
+						SFF8436_RX_PWR_TYPE_MASK;
+
+	sff8436_dom_parse(id, &sd);
+
+# define PRINT_xX_PWR(string, var)                             \
+	printf("\t%-41s : %.4f mW / %.2f dBm\n", (string),           \
+	       (double)((var) / 10000.),                             \
+	       convert_mw_to_dbm((double)((var) / 10000.)))
+
+#define PRINT_BIAS(string, bias_cur)                            \
+	printf("\t%-41s : %.3f mA\n", (string),                       \
+	       (double)(bias_cur / 500.))
+
+#define PRINT_TEMP(string, temp)                                    \
+	printf("\t%-41s : %.2f degrees C / %.2f degrees F\n", (string),   \
+	       (double)(temp / 256.), (double)(temp / 256. * 1.8 + 32.))
+
+
+#define PRINT_VCC(string, sfp_voltage)                               \
+	printf("\t%-41s : %.4f V\n", (string),                             \
+	       (double)(sfp_voltage / 10000.))
+
+#define PRINT_THRESH_BIAS(string, index)                              \
+	PRINT_BIAS(string, sd.thresh_bias_cur[(index)])
+
+# define PRINT_xX_THRESH_PWR(string, var, index)                       \
+	PRINT_xX_PWR(string, (var)[(index)])
+
+#define PRINT_THRESH_TEMP(string, index)                               \
+	PRINT_TEMP(string, sd.thresh_sfp_temp[(index)])
+
+#define PRINT_THRESH_VCC(string, index)                                 \
+	PRINT_VCC(string, sd.thresh_sfp_temp[(index)])
+
+	for (i = 0; i < MAX_CHANNEL_NUM; i++) {
+		snprintf(power_string, MAX_DESC_SIZE, "%s (Channel %d)",
+					"Laser bias current", i+1);
+		PRINT_BIAS(power_string, sd.scd[i].bias_cur);
+	}
+
+	if (!sd.rx_power_type)
+		rx_power_string = "Receiver signal OMA";
+	else
+		rx_power_string = "Rcvr signal avg optical power";
+
+	for (i = 0; i < MAX_CHANNEL_NUM; i++) {
+		snprintf(power_string, MAX_DESC_SIZE, "%s(Channel %d)",
+					rx_power_string, i+1);
+		PRINT_xX_PWR(power_string, sd.scd[i].rx_power);
+	}
+
+	PRINT_TEMP("Module temperature", sd.sfp_temp);
+	PRINT_VCC("Module voltage", sd.sfp_voltage);
+
+	printf("\t%-41s : %s\n", "Alarm/warning flags implemented",
+	       (!sd.supports_alarms ? "Yes" : "No"));
+	if (!sd.supports_alarms) {
+
+		for (i = 0; sff8436_aw_flags[i].str; ++i) {
+			printf("\t%-41s : %s\n", sff8436_aw_flags[i].str,
+			       id[sff8436_aw_flags[i].offset]
+			       & sff8436_aw_flags[i].value ? "On" : "Off");
+		}
+
+		PRINT_THRESH_BIAS("Laser bias current high alarm threshold",
+							HALRM);
+		PRINT_THRESH_BIAS("Laser bias current low alarm threshold",
+							LALRM);
+		PRINT_THRESH_BIAS("Laser bias current high warning threshold",
+							HWARN);
+		PRINT_THRESH_BIAS("Laser bias current low warning threshold",
+							LWARN);
+
+		PRINT_THRESH_TEMP("Module temperature high alarm threshold",
+							HALRM);
+		PRINT_THRESH_TEMP("Module temperature low alarm threshold",
+							LALRM);
+		PRINT_THRESH_TEMP("Module temperature high warning threshold",
+							HWARN);
+		PRINT_THRESH_TEMP("Module temperature low warning threshold",
+							LWARN);
+
+		PRINT_THRESH_VCC("Module voltage high alarm threshold",
+							HALRM);
+		PRINT_THRESH_VCC("Module voltage low alarm threshold",
+							LALRM);
+		PRINT_THRESH_VCC("Module voltage high warning threshold",
+							HWARN);
+		PRINT_THRESH_VCC("Module voltage low warning threshold",
+							LWARN);
+
+		PRINT_xX_THRESH_PWR("Laser rx power high alarm threshold",
+			     sd.thresh_rx_power, HALRM);
+		PRINT_xX_THRESH_PWR("Laser rx power low alarm threshold",
+			     sd.thresh_rx_power, LALRM);
+		PRINT_xX_THRESH_PWR("Laser rx power high warning threshold",
+			     sd.thresh_rx_power, HWARN);
+		PRINT_xX_THRESH_PWR("Laser rx power low warning threshold",
+			     sd.thresh_rx_power, LWARN);
+	}
+
+}
+void sff8436_show_all(const __u8 *id)
+{
+
+	sff8436_show_identifier(id);
+	if (id[SFF8436_ID_OFFSET] == 0x0d) {
+		sff8436_show_ext_identifier(id);
+		sff8436_show_connector(id);
+		sff8436_show_transceiver(id);
+		sff8436_show_encoding(id);
+		sff8436_show_value_with_unit(id, SFF8436_BR_NOMINAL_OFFSET,
+				"BR, Nominal", 100, "Mbps");
+		sff8436_show_rate_identifier(id);
+		sff8436_show_value_with_unit(id, SFF8436_SM_LEN_OFFSET,
+			     "Length (SMF,km)", 1, "km");
+		sff8436_show_value_with_unit(id, SFF8436_OM3_LEN_OFFSET,
+				"Length (OM3 50um)", 2, "m");
+		sff8436_show_value_with_unit(id, SFF8436_OM2_LEN_OFFSET,
+				"Length (OM2 50um)", 1, "m");
+		sff8436_show_value_with_unit(id, SFF8436_OM1_LEN_OFFSET,
+			     "Length (OM1 62.5um)", 1, "m");
+		sff8436_show_value_with_unit(id, SFF8436_CBL_LEN_OFFSET,
+			     "Length (Copper or Active cable)", 1, "m");
+		sff8436_show_wavelength_or_copper_compliance(id);
+		sff8436_show_ascii(id, SFF8436_VENDOR_NAME_START_OFFSET,
+			       SFF8436_VENDOR_NAME_END_OFFSET, "Vendor name");
+		sff8436_show_oui(id);
+		sff8436_show_ascii(id, SFF8436_VENDOR_PN_START_OFFSET,
+			       SFF8436_VENDOR_PN_END_OFFSET, "Vendor PN");
+		sff8436_show_ascii(id, SFF8436_VENDOR_REV_START_OFFSET,
+			       SFF8436_VENDOR_REV_END_OFFSET, "Vendor rev");
+		sff8436_show_ascii(id, SFF8436_VENDOR_SN_START_OFFSET,
+			       SFF8436_VENDOR_SN_END_OFFSET, "Vendor SN");
+		sff8436_show_dom(id);
+	}
+}
diff --git a/qsfp.h b/qsfp.h
new file mode 100644
index 0000000..28107fa
--- /dev/null
+++ b/qsfp.h
@@ -0,0 +1,541 @@
+/*
+ * SFF 8436 standards based QSFP EEPROM Field Definitions
+ *
+ * Vidya Ravipati <vidya@cumulusnetworks.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef QSFP_H__
+#define QSFP_H__
+
+
+/*------------------------------------------------------------------------------
+ *
+ * QSFP EEPROM data structures
+ *
+ * register info from SFF-8436 Rev 4.8
+ */
+
+/*------------------------------------------------------------------------------
+ *
+ * Lower Memory Page 00h
+ * Measurement, Diagnostic and Control Functions
+ *
+ */
+/* Identifier - 0 */
+#define	SFF8436_ID_OFFSET				0x00
+#define	 SFF8436_ID_UNKNOWN				0x00
+#define	 SFF8436_ID_GBIC				0x01
+#define	 SFF8436_ID_SOLDERED_MODULE		0x02
+#define	 SFF8436_ID_SFP					0x03
+#define	 SFF8436_ID_300_PIN_XBI			0x04
+#define	 SFF8436_ID_XENPAK				0x05
+#define	 SFF8436_ID_XFP					0x06
+#define	 SFF8436_ID_XFF					0x07
+#define	 SFF8436_ID_XFP_E				0x08
+#define	 SFF8436_ID_XPAK				0x09
+#define	 SFF8436_ID_X2					0x0A
+#define	 SFF8436_ID_DWDM_SFP			0x0B
+#define	 SFF8436_ID_DWDM_QSFP			0x0C
+#define	 SFF8436_ID_DWDM_QSFP_PLUS		0x0D
+
+#define	SFF8436_STATUS_1_OFFSET		0x01
+#define	SFF8436_STATUS_2_OFFSET		0x02
+/* Flat Memory:0- Paging, 1- Page 0 only */
+#define	 SFF8436_STATUS_PAGE_3_PRESENT		(1 << 2)
+#define	 SFF8436_STATUS_INTL_OUTPUT			(1 << 1)
+#define	 SFF8436_STATUS_DATA_NOT_READY		(1 << 0)
+
+/* Channel Status Interrupt Flags - 3-5 */
+#define	SFF8436_LOS_AW_OFFSET	0x03
+#define	 SFF8436_TX4_LOS_AW		(1 << 7)
+#define	 SFF8436_TX3_LOS_AW		(1 << 6)
+#define	 SFF8436_TX2_LOS_AW		(1 << 5)
+#define	 SFF8436_TX1_LOS_AW		(1 << 4)
+#define	 SFF8436_RX4_LOS_AW		(1 << 3)
+#define	 SFF8436_RX3_LOS_AW		(1 << 2)
+#define	 SFF8436_RX2_LOS_AW		(1 << 1)
+#define	 SFF8436_RX1_LOS_AW		(1 << 0)
+
+#define	SFF8436_FAULT_AW_OFFSET	0x04
+#define	 SFF8436_TX4_FAULT_AW	(1 << 3)
+#define	 SFF8436_TX3_FAULT_AW	(1 << 2)
+#define	 SFF8436_TX2_FAULT_AW	(1 << 1)
+#define	 SFF8436_TX1_FAULT_AW	(1 << 0)
+
+/* Module Monitor Interrupt Flags - 6-8 */
+#define	SFF8436_TEMP_AW_OFFSET	0x06
+#define	 SFF8436_TEMP_HALARM_STATUS		(1 << 7)
+#define	 SFF8436_TEMP_LALARM_STATUS		(1 << 6)
+#define	 SFF8436_TEMP_HWARN_STATUS		(1 << 5)
+#define	 SFF8436_TEMP_LWARN_STATUS		(1 << 4)
+
+#define	SFF8436_VCC_AW_OFFSET	0x07
+#define	 SFF8436_VCC_HALARM_STATUS		(1 << 7)
+#define	 SFF8436_VCC_LALARM_STATUS		(1 << 6)
+#define	 SFF8436_VCC_HWARN_STATUS		(1 << 5)
+#define	 SFF8436_VCC_LWARN_STATUS		(1 << 4)
+
+/* Channel Monitor Interrupt Flags - 9-21 */
+#define	SFF8436_RX_PWR_12_AW_OFFSET	0x09
+#define	 SFF8436_RX_PWR_1_HALARM		(1 << 7)
+#define	 SFF8436_RX_PWR_1_LALARM		(1 << 6)
+#define	 SFF8436_RX_PWR_1_HWARN			(1 << 5)
+#define	 SFF8436_RX_PWR_1_LWARN			(1 << 4)
+#define	 SFF8436_RX_PWR_2_HALARM		(1 << 3)
+#define	 SFF8436_RX_PWR_2_LALARM		(1 << 2)
+#define	 SFF8436_RX_PWR_2_HWARN			(1 << 1)
+#define	 SFF8436_RX_PWR_2_LWARN			(1 << 0)
+
+#define	SFF8436_RX_PWR_34_AW_OFFSET	0x0A
+#define	 SFF8436_RX_PWR_3_HALARM		(1 << 7)
+#define	 SFF8436_RX_PWR_3_LALARM		(1 << 6)
+#define	 SFF8436_RX_PWR_3_HWARN			(1 << 5)
+#define	 SFF8436_RX_PWR_3_LWARN			(1 << 4)
+#define	 SFF8436_RX_PWR_4_HALARM		(1 << 3)
+#define	 SFF8436_RX_PWR_4_LALARM		(1 << 2)
+#define	 SFF8436_RX_PWR_4_HWARN			(1 << 1)
+#define	 SFF8436_RX_PWR_4_LWARN			(1 << 0)
+
+#define	SFF8436_TX_BIAS_12_AW_OFFSET	0x0B
+#define	 SFF8436_TX_BIAS_1_HALARM		(1 << 7)
+#define	 SFF8436_TX_BIAS_1_LALARM		(1 << 6)
+#define	 SFF8436_TX_BIAS_1_HWARN		(1 << 5)
+#define	 SFF8436_TX_BIAS_1_LWARN		(1 << 4)
+#define	 SFF8436_TX_BIAS_2_HALARM		(1 << 3)
+#define	 SFF8436_TX_BIAS_2_LALARM		(1 << 2)
+#define	 SFF8436_TX_BIAS_2_HWARN		(1 << 1)
+#define	 SFF8436_TX_BIAS_2_LWARN		(1 << 0)
+
+#define	SFF8436_TX_BIAS_34_AW_OFFSET	0xC
+#define	 SFF8436_TX_BIAS_3_HALARM		(1 << 7)
+#define	 SFF8436_TX_BIAS_3_LALARM		(1 << 6)
+#define	 SFF8436_TX_BIAS_3_HWARN		(1 << 5)
+#define	 SFF8436_TX_BIAS_3_LWARN		(1 << 4)
+#define	 SFF8436_TX_BIAS_4_HALARM		(1 << 3)
+#define	 SFF8436_TX_BIAS_4_LALARM		(1 << 2)
+#define	 SFF8436_TX_BIAS_4_HWARN		(1 << 1)
+#define	 SFF8436_TX_BIAS_4_LWARN		(1 << 0)
+
+/* Module Monitoring Values - 22-33 */
+#define	SFF8436_TEMP_CURR			0x16
+#define	SFF8436_TEMP_MSB_OFFSET		0x16
+#define	SFF8436_TEMP_LSB_OFFSET		0x17
+
+#define	SFF8436_VCC_CURR			0x1A
+#define	SFF8436_VCC_MSB_OFFSET		0x1A
+#define	SFF8436_VCC_LSB_OFFSET		0x1B
+
+/* Channel Monitoring Values - 34-81 */
+#define	SFF8436_RX_PWR_1_OFFSET		0x22
+#define	SFF8436_RX_PWR_2_OFFSET		0x24
+#define	SFF8436_RX_PWR_3_OFFSET		0x26
+#define	SFF8436_RX_PWR_4_OFFSET		0x28
+
+#define	SFF8436_TX_BIAS_1_OFFSET	0x2A
+#define	SFF8436_TX_BIAS_2_OFFSET	0x2C
+#define	SFF8436_TX_BIAS_3_OFFSET	0x2E
+#define	SFF8436_TX_BIAS_4_OFFSET	0x30
+
+/* Control Bytes - 86 - 99 */
+#define	SFF8436_TX_DISABLE_OFFSET	0x56
+#define	 SFF8436_TX_DISABLE_4			(1 << 3)
+#define	 SFF8436_TX_DISABLE_3			(1 << 2)
+#define	 SFF8436_TX_DISABLE_2			(1 << 1)
+#define	 SFF8436_TX_DISABLE_1			(1 << 0)
+
+#define	SFF8436_RX_RATE_SELECT_OFFSET	0x57
+#define	 SFF8436_RX_RATE_SELECT_4_MASK		(3 << 6)
+#define	 SFF8436_RX_RATE_SELECT_3_MASK		(3 << 4)
+#define	 SFF8436_RX_RATE_SELECT_2_MASK		(3 << 2)
+#define	 SFF8436_RX_RATE_SELECT_1_MASK		(3 << 0)
+
+#define	SFF8436_TX_RATE_SELECT_OFFSET	0x58
+#define	 SFF8436_TX_RATE_SELECT_4_MASK		(3 << 6)
+#define	 SFF8436_TX_RATE_SELECT_3_MASK		(3 << 4)
+#define	 SFF8436_TX_RATE_SELECT_2_MASK		(3 << 2)
+#define	 SFF8436_TX_RATE_SELECT_1_MASK		(3 << 0)
+
+#define	SFF8436_RX_APP_SELECT_4_OFFSET	0x58
+#define	SFF8436_RX_APP_SELECT_3_OFFSET	0x59
+#define	SFF8436_RX_APP_SELECT_2_OFFSET	0x5A
+#define	SFF8436_RX_APP_SELECT_1_OFFSET	0x5B
+
+#define	SFF8436_PWR_MODE_OFFSET		0x5D
+#define	 SFF8436_LOW_PWR_MODE			(1 << 1)
+#define	 SFF8436_PWR_OVERRIDE			(1 << 0)
+
+#define	SFF8436_TX_APP_SELECT_4_OFFSET	0x5E
+#define	SFF8436_TX_APP_SELECT_3_OFFSET	0x5F
+#define	SFF8436_TX_APP_SELECT_2_OFFSET	0x60
+#define	SFF8436_TX_APP_SELECT_1_OFFSET	0x61
+
+#define	SFF8436_LOS_MASK_OFFSET		0x64
+#define	 SFF8436_TX_LOS_4_MASK			(1 << 7)
+#define	 SFF8436_TX_LOS_3_MASK			(1 << 6)
+#define	 SFF8436_TX_LOS_2_MASK			(1 << 5)
+#define	 SFF8436_TX_LOS_1_MASK			(1 << 4)
+#define	 SFF8436_RX_LOS_4_MASK			(1 << 3)
+#define	 SFF8436_RX_LOS_3_MASK			(1 << 2)
+#define	 SFF8436_RX_LOS_2_MASK			(1 << 1)
+#define	 SFF8436_RX_LOS_1_MASK			(1 << 0)
+
+#define	SFF8436_FAULT_MASK_OFFSET	0x65
+#define	 SFF8436_TX_FAULT_1_MASK		(1 << 3)
+#define	 SFF8436_TX_FAULT_2_MASK		(1 << 2)
+#define	 SFF8436_TX_FAULT_3_MASK		(1 << 1)
+#define	 SFF8436_TX_FAULT_4_MASK		(1 << 0)
+
+#define	SFF8436_TEMP_MASK_OFFSET	0x67
+#define	 SFF8436_TEMP_HALARM_MASK		(1 << 7)
+#define	 SFF8436_TEMP_LALARM_MASK		(1 << 6)
+#define	 SFF8436_TEMP_HWARN_MASK		(1 << 5)
+#define	 SFF8436_TEMP_LWARN_MASK		(1 << 4)
+
+#define	SFF8436_VCC_MASK_OFFSET		0x68
+#define	 SFF8436_VCC_HALARM_MASK		(1 << 7)
+#define	 SFF8436_VCC_LALARM_MASK		(1 << 6)
+#define	 SFF8436_VCC_HWARN_MASK			(1 << 5)
+#define	 SFF8436_VCC_LWARN_MASK			(1 << 4)
+
+/*------------------------------------------------------------------------------
+ *
+ * Upper Memory Page 00h
+ * Serial ID - Base ID, Extended ID and Vendor Specific ID fields
+ *
+ */
+/* Identifier - 128 */
+/* Identifier values same as Lower Memory Page 00h */
+#define	SFF8436_UPPER_PAGE_0_ID_OFFSET		0x80
+
+/* Extended Identifier - 128 */
+#define SFF8436_EXT_ID_OFFSET		0x81
+#define	 SFF8436_EXT_ID_PWR_CLASS_MASK		0xC0
+#define	  SFF8436_EXT_ID_PWR_CLASS_1		(0 << 6)
+#define	  SFF8436_EXT_ID_PWR_CLASS_2		(1 << 6)
+#define	  SFF8436_EXT_ID_PWR_CLASS_3		(2 << 6)
+#define	  SFF8436_EXT_ID_PWR_CLASS_4		(3 << 6)
+#define	 SFF8436_EXT_ID_CLIE_MASK		    0x10
+#define	  SFF8436_EXT_ID_CLIEI_CODE_PRESENT	(1 << 4)
+#define	 SFF8436_EXT_ID_CDR_TX_MASK			0x08
+#define	  SFF8436_EXT_ID_CDR_TX_PRESENT		(1 << 3)
+#define	 SFF8436_EXT_ID_CDR_RX_MASK			0x04
+#define	  SFF8436_EXT_ID_CDR_RX_PRESENT		(1 << 2)
+
+/* Connector Values offset - 130 */
+#define	SFF8436_CTOR_OFFSET		0x82
+#define	 SFF8436_CTOR_UNKNOWN			0x00
+#define	 SFF8436_CTOR_SC				0x01
+#define	 SFF8436_CTOR_FC_STYLE_1		0x02
+#define	 SFF8436_CTOR_FC_STYLE_2		0x03
+#define	 SFF8436_CTOR_BNC_TNC			0x04
+#define	 SFF8436_CTOR_FC_COAX			0x05
+#define	 SFF8436_CTOR_FIBER_JACK		0x06
+#define	 SFF8436_CTOR_LC				0x07
+#define	 SFF8436_CTOR_MT_RJ				0x08
+#define	 SFF8436_CTOR_MU				0x09
+#define	 SFF8436_CTOR_SG				0x0A
+#define	 SFF8436_CTOR_OPT_PT			0x0B
+#define	 SFF8436_CTOR_MPO				0x0C
+/* 0D-1Fh --- Reserved */
+#define	 SFF8436_CTOR_HSDC_II			0x20
+#define	 SFF8436_CTOR_COPPER_PT			0x21
+#define	 SFF8436_CTOR_RJ45				0x22
+#define	 SFF8436_CTOR_NO_SEPARABLE		0x23
+
+/* Specification Compliance - 131-138 */
+/* Ethernet Compliance Codes - 131 */
+#define	SFF8436_ETHERNET_COMP_OFFSET	0x83
+#define	 SFF8436_ETHERNET_RSRVD			(1 << 7)
+#define	 SFF8436_ETHERNET_10G_LRM		(1 << 6)
+#define	 SFF8436_ETHERNET_10G_LR		(1 << 5)
+#define	 SFF8436_ETHERNET_10G_SR		(1 << 4)
+#define	 SFF8436_ETHERNET_40G_CR4		(1 << 3)
+#define	 SFF8436_ETHERNET_40G_SR4		(1 << 2)
+#define	 SFF8436_ETHERNET_40G_LR4		(1 << 1)
+#define	 SFF8436_ETHERNET_40G_ACTIVE	(1 << 0)
+
+/* SONET Compliance Codes - 132 */
+#define	SFF8436_SONET_COMP_OFFSET	0x84
+#define	 SFF8436_SONET_40G_OTN			(1 << 3)
+#define	 SFF8436_SONET_OC48_LR			(1 << 2)
+#define	 SFF8436_SONET_OC48_IR			(1 << 1)
+#define	 SFF8436_SONET_OC48_SR			(1 << 0)
+
+/* SAS/SATA Complaince Codes - 133 */
+#define	SFF8436_SAS_COMP_OFFSET		0x85
+#define	 SFF8436_SAS_6G				    (1 << 5)
+#define	 SFF8436_SAS_3G				    (1 << 4)
+
+/* Gigabit Ethernet Compliance Codes - 134 */
+#define	SFF8436_GIGE_COMP_OFFSET	0x86
+#define	 SFF8436_GIGE_1000_BASE_T		(1 << 3)
+#define	 SFF8436_GIGE_1000_BASE_CX		(1 << 2)
+#define	 SFF8436_GIGE_1000_BASE_LX		(1 << 1)
+#define	 SFF8436_GIGE_1000_BASE_SX		(1 << 0)
+
+
+/* Fibre Channel Link length/Transmitter Tech. - 135,136 */
+#define	SFF8436_FC_LEN_OFFSET		0x87
+#define	 SFF8436_FC_LEN_VERY_LONG		(1 << 7)
+#define	 SFF8436_FC_LEN_SHORT			(1 << 6)
+#define	 SFF8436_FC_LEN_INT				(1 << 5)
+#define	 SFF8436_FC_LEN_LONG			(1 << 4)
+#define	 SFF8436_FC_LEN_MED				(1 << 3)
+#define	 SFF8436_FC_TECH_LONG_LC		(1 << 1)
+#define	 SFF8436_FC_TECH_ELEC_INTER		(1 << 0)
+
+#define	SFF8436_FC_TECH_OFFSET		0x88
+#define	 SFF8436_FC_TECH_ELEC_INTRA			(1 << 7)
+#define	 SFF8436_FC_TECH_SHORT_WO_OFC		(1 << 6)
+#define	 SFF8436_FC_TECH_SHORT_W_OFC		(1 << 5)
+#define	 SFF8436_FC_TECH_LONG_LL			(1 << 4)
+
+
+/* Fibre Channel Transmitter Media - 137 */
+#define	SFF8436_FC_TRANS_MEDIA_OFFSET	0x89
+/* Twin Axial Pair */
+#define	 SFF8436_FC_TRANS_MEDIA_TW		(1 << 7)
+/* Shielded Twisted Pair */
+#define	 SFF8436_FC_TRANS_MEDIA_TP		(1 << 6)
+/* Miniature Coax */
+#define	 SFF8436_FC_TRANS_MEDIA_MI		(1 << 5)
+/* Video Coax */
+#define	 SFF8436_FC_TRANS_MEDIA_TV		(1 << 4)
+/* Multi-mode 62.5m */
+#define	 SFF8436_FC_TRANS_MEDIA_M6		(1 << 3)
+/* Multi-mode 50m */
+#define	 SFF8436_FC_TRANS_MEDIA_M5		(1 << 2)
+/* Multi-mode 50um */
+#define	 SFF8436_FC_TRANS_MEDIA_OM3		(1 << 1)
+/* Single Mode */
+#define	 SFF8436_FC_TRANS_MEDIA_SM		(1 << 0)
+
+/* Fibre Channel Speed - 138 */
+#define	SFF8436_FC_SPEED_OFFSET		0x8A
+#define	 SFF8436_FC_SPEED_1200_MBPS		(1 << 7)
+#define	 SFF8436_FC_SPEED_800_MBPS		(1 << 6)
+#define	 SFF8436_FC_SPEED_1600_MBPS		(1 << 5)
+#define	 SFF8436_FC_SPEED_400_MBPS		(1 << 4)
+#define	 SFF8436_FC_SPEED_200_MBPS		(1 << 2)
+#define	 SFF8436_FC_SPEED_100_MBPS		(1 << 0)
+
+/* Encoding - 139 */
+#define	SFF8436_ENCODING_OFFSET		0x8B
+#define	 SFF8436_ENCODING_MANCHESTER	0x06
+#define	 SFF8436_ENCODING_64B66B		0x05
+#define	 SFF8436_ENCODING_SONET			0x04
+#define	 SFF8436_ENCODING_NRZ			0x03
+#define	 SFF8436_ENCODING_4B5B			0x02
+#define	 SFF8436_ENCODING_8B10B			0x01
+#define	 SFF8436_ENCODING_UNSPEC		0x00
+
+/* BR, Nominal - 140 */
+#define	SFF8436_BR_NOMINAL_OFFSET	0x8C
+
+/* Extended RateSelect - 141 */
+#define	SFF8436_EXT_RS_OFFSET		0x8D
+#define	 SFF8436_EXT_RS_V1			(1 << 0)
+
+/* Length (Standard SM Fiber)-km - 142 */
+#define	SFF8436_SM_LEN_OFFSET		0x8E
+
+/* Length (OM3)-Unit 2m - 143 */
+#define	SFF8436_OM3_LEN_OFFSET		0x8F
+
+/* Length (OM2)-Unit 1m - 144 */
+#define	SFF8436_OM2_LEN_OFFSET		0x90
+
+/* Length (OM1)-Unit 1m - 145 */
+#define	SFF8436_OM1_LEN_OFFSET		0x91
+
+/* Cable Assembly Length -Unit 1m - 146 */
+#define	SFF8436_CBL_LEN_OFFSET		0x92
+
+/* Device Technology - 147 */
+#define	SFF8436_DEVICE_TECH_OFFSET	0x93
+/* Transmitter Technology */
+#define	 SFF8436_TRANS_TECH_MASK			0xF0
+/* Copper cable, linear active equalizers */
+#define	 SFF8436_TRANS_COPPER_LNR_EQUAL		(15 << 4)
+/* Copper cable, near end limiting active equalizers */
+#define	 SFF8436_TRANS_COPPER_NEAR_EQUAL	(14 << 4)
+/* Copper cable, far end limiting active equalizers */
+#define	 SFF8436_TRANS_COPPER_FAR_EQUAL		(13 << 4)
+/* Copper cable, near & far end limiting active equalizers */
+#define	 SFF8436_TRANS_COPPER_LNR_FAR_EQUAL	(12 << 4)
+/* Copper cable, passive equalized */
+#define	 SFF8436_TRANS_COPPER_PAS_EQUAL		(11 << 4)
+/* Copper cable, unequalized */
+#define	 SFF8436_TRANS_COPPER_PAS_UNEQUAL	(10 << 4)
+/* 1490 nm DFB */
+#define	 SFF8436_TRANS_1490_DFB				(9 << 4)
+/* Others */
+#define	 SFF8436_TRANS_OTHERS				(8 << 4)
+/* 1550 nm EML */
+#define	 SFF8436_TRANS_1550_EML				(7 << 4)
+/* 1310 nm EML */
+#define	 SFF8436_TRANS_1310_EML				(6 << 4)
+/* 1550 nm DFB */
+#define	 SFF8436_TRANS_1550_DFB				(5 << 4)
+/* 1310 nm DFB */
+#define	 SFF8436_TRANS_1310_DFB				(4 << 4)
+/* 1310 nm FP */
+#define	 SFF8436_TRANS_1310_FP				(3 << 4)
+/* 1550 nm VCSEL */
+#define	 SFF8436_TRANS_1550_VCSEL			(2 << 4)
+/* 1310 nm VCSEL */
+#define	 SFF8436_TRANS_1310_VCSEL			(1 << 4)
+/* 850 nm VCSEL */
+#define	 SFF8436_TRANS_850_VCSEL			(0 << 4)
+
+ /* Active/No wavelength control */
+#define	 SFF8436_DEV_TECH_ACTIVE_WAVE_LEN	(1 << 3)
+/* Cooled transmitter */
+#define	 SFF8436_DEV_TECH_COOL_TRANS		(1 << 2)
+/* APD/Pin Detector */
+#define	 SFF8436_DEV_TECH_APD_DETECTOR		(1 << 1)
+/* Transmitter tunable */
+#define	 SFF8436_DEV_TECH_TUNABLE			(1 << 0)
+
+/* Vendor Name - 148-163 */
+#define	 SFF8436_VENDOR_NAME_START_OFFSET	0x94
+#define	 SFF8436_VENDOR_NAME_END_OFFSET		0xA3
+
+/* Extended Module Codes - 164 */
+#define	 SFF8436_EXT_MOD_CODE_OFFSET	0xA4
+#define	  SFF8436_EXT_MOD_INFINIBAND_EDR	(1 << 4)
+#define	  SFF8436_EXT_MOD_INFINIBAND_FDR	(1 << 3)
+#define	  SFF8436_EXT_MOD_INFINIBAND_QDR	(1 << 2)
+#define	  SFF8436_EXT_MOD_INFINIBAND_DDR	(1 << 1)
+#define	  SFF8436_EXT_MOD_INFINIBAND_SDR	(1 << 0)
+
+/* Vendor OUI - 165-167 */
+#define	 SFF8436_VENDOR_OUI_OFFSET			0xA5
+#define	  SFF8436_VENDOR_OUI_LEN			3
+
+/* Vendor OUI - 165-167 */
+#define	 SFF8436_VENDOR_PN_START_OFFSET		0xA8
+#define	 SFF8436_VENDOR_PN_END_OFFSET		0xB7
+
+/* Vendor Revision - 184-185 */
+#define	 SFF8436_VENDOR_REV_START_OFFSET	0xB8
+#define	 SFF8436_VENDOR_REV_END_OFFSET	0xB8
+
+/* Wavelength - 186-187 */
+#define	 SFF8436_WAVELEN_HIGH_BYTE_OFFSET	0xBA
+#define	 SFF8436_WAVELEN_LOW_BYTE_OFFSET	0xBB
+
+/* Wavelength  Tolerance- 188-189 */
+#define	 SFF8436_WAVE_TOL_HIGH_BYTE_OFFSET	0xBC
+#define	 SFF8436_WAVE_TOL_LOW_BYTE_OFFSET	0xBD
+
+/* Max case temp - Other than 70 C - 190 */
+#define	 SFF8436_MAXCASE_TEMP_OFFSET	0xBE
+
+/* CC_BASE - 191 */
+#define	 SFF8436_CC_BASE_OFFSET		0xBF
+
+/* Option Values - 192-195 */
+#define	 SFF8436_OPTION_1_OFFSET	0xC0
+#define	 SFF8436_OPTION_2_OFFSET	0xC1
+/* Rx output amplitude */
+#define	  SFF8436_O2_RX_OUTPUT_AMP		(1 << 0)
+#define	 SFF8436_OPTION_3_OFFSET	0xC2
+/* Rx Squelch Disable */
+#define	  SFF8436_O3_RX_SQL_DSBL		(1 << 3)
+/* Rx Output Disable capable */
+#define	  SFF8436_O3_RX_OUTPUT_DSBL		(1 << 2)
+/* Tx Squelch Disable */
+#define	  SFF8436_O3_TX_SQL_DSBL		(1 << 1)
+/* Tx Squelch Impl */
+#define	  SFF8436_O3_TX_SQL_IMPL		(1 << 0)
+#define	 SFF8436_OPTION_4_OFFSET	0xC3
+/* Memory Page 02 present */
+#define	  SFF8436_O4_PAGE_02_PRESENT	(1 << 7)
+/* Memory Page 01 present */
+#define	  SFF8436_O4_PAGE_01_PRESENT	(1 << 6)
+/* Rate Select implemented */
+#define	  SFF8436_O4_RATE_SELECT		(1 << 5)
+/* Tx_DISABLE implemented */
+#define	  SFF8436_O4_TX_DISABLE			(1 << 4)
+/* Tx_FAULT implemented */
+#define	  SFF8436_O4_TX_FAULT			(1 << 3)
+/* Tx Squelch implemented */
+#define	  SFF8436_O4_TX_SQUELCH			(1 << 2)
+/* Tx Loss of Signal */
+#define	  SFF8436_O4_TX_LOS			    (1 << 1)
+
+/* Vendor SN - 196-211 */
+#define	 SFF8436_VENDOR_SN_START_OFFSET	0xC4
+#define	 SFF8436_VENDOR_SN_END_OFFSET	0xD3
+
+/* Vendor Date - 212-219 */
+#define	 SFF8436_DATE_YEAR_OFFSET	0xD4
+#define	  SFF8436_DATE_YEAR_LEN			2
+#define	 SFF8436_DATE_MONTH_OFFSET	0xD6
+#define	  SFF8436_DATE_MONTH_LEN		2
+#define	 SFF8436_DATE_DAY_OFFSET	0xD8
+#define	  SFF8436_DATE_DAY_LEN			2
+
+/* Diagnostic Monitoring Type - 220 */
+#define	 SFF8436_DIAG_TYPE_OFFSET	0xDC
+#define	  SFF8436_RX_PWR_TYPE_MASK		0x8
+#define	   SFF8436_RX_PWR_TYPE_AVG_PWR	(1 << 3)
+#define	   SFF8436_RX_PWR_TYPE_OMA		(0 << 3)
+
+/* Enhanced Options - 221 */
+#define	 SFF8436_ENH_OPTIONS_OFFSET	0xDD
+#define	  SFF8436_RATE_SELECT_EXT_SUPPORT		(1 << 3)
+#define	  SFF8436_RATE_SELECT_APP_TABLE_SUPPORT	(1 << 2)
+
+/* Check code - 223 */
+#define	 SFF8436_CC_EXT_OFFSET		0xDF
+#define	  SFF8436_CC_EXT_LEN			1
+
+
+/*------------------------------------------------------------------------------
+ *
+ * Upper Memory Page 03h
+ * Contains module thresholds, channel thresholds and masks,
+ * and optional channel controls
+ *
+ * Offset - Page Num(3) * PageSize(0x80) + Page offset
+ */
+
+/* Module Thresholds (48 Bytes) 128-175 */
+/* MSB at low address, LSB at high address */
+#define	SFF8436_TEMP_HALRM			0x200
+#define	SFF8436_TEMP_LALRM			0x202
+#define	SFF8436_TEMP_HWARN			0x204
+#define	SFF8436_TEMP_LWARN			0x206
+
+#define	SFF8436_VCC_HALRM			0x210
+#define	SFF8436_VCC_LALRM			0x212
+#define	SFF8436_VCC_HWARN			0x214
+#define	SFF8436_VCC_LWARN			0x216
+
+#define	SFF8436_RX_PWR_HALRM		0x230
+#define	SFF8436_RX_PWR_LALRM		0x232
+#define	SFF8436_RX_PWR_HWARN		0x234
+#define	SFF8436_RX_PWR_LWARN		0x236
+
+#define	SFF8436_TX_BIAS_HALRM		0x238
+#define	SFF8436_TX_BIAS_LALRM		0x23A
+#define	SFF8436_TX_BIAS_HWARN		0x23C
+#define	SFF8436_TX_BIAS_LWARN		0x23E
+
+#endif /* QSFP_H__ */
-- 
1.7.10.4

^ permalink raw reply related

* Re: Query regarding sk_filter
From: Alexei Starovoitov @ 2015-01-10  0:51 UTC (permalink / raw)
  To: Kumar Sanghvi; +Cc: netdev@vger.kernel.org
In-Reply-To: <20150109112302.GA9428@kumar-pc.asicdesigners.com>

On Fri, Jan 9, 2015 at 3:23 AM, Kumar Sanghvi <kumaras@chelsio.com> wrote:
> Hi netdev team,
>
> I have a query regarding sk_filter call in tcp receive path:
>
> In 'tcp_v4_rcv' function, if sk is found by __inet_lookup_skb then,
> down the line, there is a call to sk_filter to ensure if the incoming packet
> is allowed to be processed for that sk.
>
> However, in 'tcp_v4_hnd_req' function, if nsk is found by inet_lookup_established
> then, later, there does not seem to be a sk_filter call for that nsk in the receive
> path processing.
>
> I am wondering shouldn't there be a sk_filter call on nsk found in 'tcp_v4_hnd_req'
> function ? Or, probably I am missing something.

hmm. I'm not sure what you're seeing.
tcp_v4_hnd_req() is called from tcp_v4_do_rcv() which is called
after sk_filter() check is done in tcp_v4_rcv() (either directly
or via prequeue/backlog)

> I am running some high rate syn-flood tests and trying to understand
> the sk_filter behaviour in this case.

are you saying not all of syn packets are reaching filter?

^ permalink raw reply

* Re: [PATCH RFC net-next] ip_tunnel: create percpu gro_cell
From: Eric Dumazet @ 2015-01-10  1:02 UTC (permalink / raw)
  To: Martin Lau; +Cc: netdev, kernel-team
In-Reply-To: <20150109231703.GF3842288@devbig242.prn2.facebook.com>

On Fri, 2015-01-09 at 15:17 -0800, Martin Lau wrote:
> Is the spin_lock() still needed?

Think about cpu hotplug, we can have interesting things here.

Basically no cost at all once mem is percpu.

^ permalink raw reply

* Re: Clarification regarding IFLA_BRPORT_LEARNING_SYNC and aging of fdb entries learnt via br_fdb_external_learn_add()
From: B Viswanath @ 2015-01-10  2:31 UTC (permalink / raw)
  To: Scott Feldman; +Cc: Arad, Ronen, Jiri Pirko, Siva Mannem, Netdev
In-Reply-To: <CAE4R7bCVCwPNq44_Ax2RQvtdZg_LCHGTQW0RrRAs-jCiDUduzQ@mail.gmail.com>

Hi Scot,

I think we can see the problem in case 1 itself.

Driver's can't periodically update kernel about refreshing the fdb
entry in reality. Some of the switches I worked on a while ago have
16K entries in a MAC table, Surely it has grown folds now. For the
driver to be able to refresh kernel periodically would be a nightmare,
performance wise, to poll this many entries from hardware, see which
of them is updated.

The driver is updating the kernel about learnt entry. I think it makes
sence to have driver update the kernel about ageing too.

Thanks
Viswanath

On 10 January 2015 at 00:17, Scott Feldman <sfeldma@gmail.com> wrote:
> On Fri, Jan 9, 2015 at 8:15 AM, Arad, Ronen <ronen.arad@intel.com> wrote:
>>
>>
>>>-----Original Message-----
>>>From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org] On
>>>Behalf Of Scott Feldman
>>>Sent: Friday, January 09, 2015 3:47 AM
>>>To: Jiri Pirko
>>>Cc: Siva Mannem; Netdev
>>>Subject: Re: Clarification regarding IFLA_BRPORT_LEARNING_SYNC and aging of
>>>fdb entries learnt via br_fdb_external_learn_add()
>>>
>>>On Wed, Jan 7, 2015 at 4:53 AM, Jiri Pirko <jiri@resnulli.us> wrote:
>>>> Tue, Dec 30, 2014 at 07:20:21PM CET, siva.mannem.lnx@gmail.com wrote:
>>>>>Hi,
>>>>>
>>>>>I am trying to understand the ongoing switch device offload effort and
>>>>>am following the discussions. I have a question regarding
>>>>>IFLA_BRPORT_LEARNING_SYNC flag and how aging happens when this flag is
>>>>>enabled on a port that is attached to a bridge that has vlan filtering
>>>>>enabled.
>>>>>
>>>>>If I understand correctly, when  IFLA_BRPORT_LEARNING_SYNC is set on a
>>>>>bridge port, fdb entries that are learnt externally(may be learnt by
>>>>>hardware and driver is notified) are synced to bridges fdb using
>>>>>br_fdb_external_learn_add(). The fdb
>>>>>entries(fdb->added_by_external_learn set to true) that are learnt via
>>>>>this method are also deleted by the aging logic after the aging time
>>>>>even though L2 data forwadring  happens in hardware.
>>>
>>>This is correct...
>>>
>>>>> Is there a way
>>>>>where aging can be disabled for these entries? and let the entries be
>>>>>removed only via br_fdb_external_learn_delete()? or am I missing
>>>>>something?
>>>>
>>>> Currently extenaly learned fdb entries are indeed removed during aging
>>>> cleanup. I believe that br_fdb_cleanup should check added_by_external_learn
>>>> and not remove that fdbs. What do you think Scott?
>>>
>>>Something like that would work, if we added another brport flag to
>>>control that.  With the current arrangement, using bridge for aging
>>>out entries, we want br_fdb_cleanup removing the external_learned
>>>fdbs, but if there was another brport flag we could fine tune that.
>>>Say new flag is IFLA_BRPORT_AGING_OFFLOAD or something like that.  I'm
>>>not sure how aging settings for the bridge are pushed down to offload
>>>hw, or if there is a different set for hw.
>>>
>>>But, isn't it nice to let Linux bridge control aging?  That way,
>>>bridge -s fdb dump shows nice statistics on fdb entries.  Hardware
>>>isn't involved in the aging processes (other than being told to remove
>>>an entry).  Simple hardware equals simple driver.  Linux remains
>>>control point.
>>>
>> It is indeed simpler. However, if the overhead of reading hit bits from the HW
>> and updating freshness of entries using br_fdb_external_learn_add() is too
>> expensive, it would force such platforms to disable learning sync altogether.
>> Therefore, I believe aging offload flag (could be sufficient at bridge level)
>> and external aging interval (possibly longer than the software aging interval)
>> will encourage drivers to use leaning sync.
>>>-scott
>
> I'm not sure I follow that last part.
>
> Can we list out the use-cases to see what's missing?
>
> Case 1: bridge ages out learned_sync'ed entries
>
> bridge port learning: off
> offload port learning: on
> offload port learning_sync: on
>
> Driver calls br_fdb_external_learn_add() periodically to refresh
> bridge fdb entry
> to keep it from going stale.
> Bridge removes aged out fdb entries (and indirectly tells offload
> device to do the same).
>
> Case 2: offload device/bridge age out entries independently
>
> bridge port learning: on
> offload port learning: on
> offload port learning_sync: off
>
> Bridge ages out its stale learned entries, independent of offload device.
> Offload device ages out its stale learned entries, independent of bridge.
>
> Case 3: ?
>
> Please help me finish the use-case list so we can see what's missing.
>
> -scott
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH net-next 16/16] tipc: make netlink support net namespace
From: Ying Xue @ 2015-01-10  6:04 UTC (permalink / raw)
  To: Sergei Shtylyov, davem
  Cc: jon.maloy, Tero.Aho, netdev, Paul.Gortmaker, tipc-discussion
In-Reply-To: <54AFDABB.3080103@cogentembedded.com>

On 01/09/2015 09:42 PM, Sergei Shtylyov wrote:
> Hello.
> 
> On 1/9/2015 10:27 AM, Ying Xue wrote:
> 
>> Currently tipc module only allows users sitting on "init_net" namespace
>> to configure it through netlink interface. But now almost each tipc
>> component is able to be aware of net namespace, so it's time to open
>> the permission for users residing in other namespaces, allowing them
>> to configure their own tipc stack instance through netlink interface.
> 
>> Signed-off-by: Ying Xue <ying.xue@windriver.com>
>> Tested-by: Tero Aho <Tero.Aho@coriant.com>
>> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
>> ---
>>   net/tipc/netlink.c |    7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
>> diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
>> index 282b596..fe0f513 100644
>> --- a/net/tipc/netlink.c
>> +++ b/net/tipc/netlink.c
>> @@ -54,7 +54,8 @@ static int handle_cmd(struct sk_buff *skb, struct
>> genl_info *info)
>>       int hdr_space = nlmsg_total_size(GENL_HDRLEN + TIPC_GENL_HDRLEN);
>>       u16 cmd;
>>
>> -    if ((req_userhdr->cmd & 0xC000) && (!netlink_capable(skb,
>> CAP_NET_ADMIN)))
>> +    if ((req_userhdr->cmd & 0xC000) &&
>> +        (!netlink_net_capable(skb, CAP_NET_ADMIN)))
> 
>    Why? Also, it seems like unrelated change...
> 

Without above change, the line length is over 80 characters. Of course,
this change is not much related to what the patch is really doing.

Regards,
Ying

> [...]
> 
> WBR, Sergei
> 
> 
> 


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net

^ permalink raw reply

* RE: Clarification regarding IFLA_BRPORT_LEARNING_SYNC and aging of fdb entries learnt via br_fdb_external_learn_add()
From: Arad, Ronen @ 2015-01-10  6:51 UTC (permalink / raw)
  To: Scott Feldman, Netdev; +Cc: Jiri Pirko, Siva Mannem
In-Reply-To: <CAE4R7bCVCwPNq44_Ax2RQvtdZg_LCHGTQW0RrRAs-jCiDUduzQ@mail.gmail.com>

[...]
>> It is indeed simpler. However, if the overhead of reading hit bits from the
>HW
>> and updating freshness of entries using br_fdb_external_learn_add() is too
>> expensive, it would force such platforms to disable learning sync
>altogether.
>> Therefore, I believe aging offload flag (could be sufficient at bridge
>level)
>> and external aging interval (possibly longer than the software aging
>interval)
>> will encourage drivers to use leaning sync.
>>>-scott
>
>I'm not sure I follow that last part.
>
>Can we list out the use-cases to see what's missing?
>
>Case 1: bridge ages out learned_sync'ed entries
>
>bridge port learning: off
>offload port learning: on
>offload port learning_sync: on
>
>Driver calls br_fdb_external_learn_add() periodically to refresh
>bridge fdb entry
>to keep it from going stale.
>Bridge removes aged out fdb entries (and indirectly tells offload
>device to do the same).
>
>Case 2: offload device/bridge age out entries independently
>
>bridge port learning: on
>offload port learning: on
>offload port learning_sync: off
>
>Bridge ages out its stale learned entries, independent of offload device.
>Offload device ages out its stale learned entries, independent of bridge.
>
>Case 3: ?
>
>Please help me finish the use-case list so we can see what's missing.


Case 3: offload device ages out external entries and notifies bridge

bridge port learning: on or off (Bridge only learns from packets seen (Rx/Tx))
offload port learning: on
offload port learning_sync: on
bridge aging of external learn: off
offload device aging: on

Switch port/device driver ages entries (could be by HW aging or soft aging in
driver/firmware),
notifies bridge about aged entries using br_fdb_externallearn_del().
This allows efficient HW aging and batched notification at a pace independent 
of bridge aging interval.
User still enjoys a single VLAN-aware FDB within the bridge module and having 
all entries in one place. Externally learned entries are identified as such by 
iproute2 "bridge fdb show" command. Device does not have to implement
ndo_bridge_fdb_dump() for each offload port as the bridge module provides it
for the common FDB.

Case 4: bridge ages owned and external entries at different intervals

bridge port learning: on (Effectively only for Rx/Tx traffic seen by               
                          software bridge)
offload port learning: on (transient traffic and RxTx, overlap with bridge
                           learned entries possible)
offload port learning_sync: on
bridge aging of external learn: on
offload device aging: off
bridge aging interval for owned entries: T1
bridge aging interval for external entries: T2 (Typically T2 > T1)

This allows for fine-tuning the overhead of periodic updates of entries
freshness from offload port device.

The bottom line of cases 3-4 is that it is desirable to use the common bridge
FDB as long as bridge aging of externally learned entries could be controlled
by the offload device: Either be at a longer interval or disabled.

>
>-scott
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [Question] vxlan_features_check()
From: Sriharsha Basavapatna @ 2015-01-10  6:52 UTC (permalink / raw)
  To: Jesse Gross, Tom Herbert; +Cc: netdev@vger.kernel.org

Hi Jesse, Tom,

The current implementation of vxlan_features_check() disables csum/gso flags
for only a subset of Non-VxLAN tunnels - those with tunnel outer transport type
of UDP. Is there any reason why this was not done for non-UDP tunnels like
GRE too ? This can avoid additional code in the driver ndo_features_check()
to disable those flags for non-UDP tunnels.  Please let me know if I'm
missing something here.

The current code in vxlan_features_check() is this:
        if ((l4_hdr == IPPROTO_UDP) &&
            (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
             skb->inner_protocol != htons(ETH_P_TEB) ||
             (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
              sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
                return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);

That should change to:
        if (l4_hdr != IPPROTO_UDP ||
            skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
            skb->inner_protocol != htons(ETH_P_TEB) ||
            (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
            sizeof(struct udphdr) + sizeof(struct vxlanhdr)))
                return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);

Thanks,
-Harsha

^ permalink raw reply

* [PATCH net] drivers: net: xen-netfront: remove residual dead code
From: Vincenzo Maffione @ 2015-01-10  9:20 UTC (permalink / raw)
  To: netdev
  Cc: xen-devel, david.vrabel, boris.ostrovsky, konrad.wilk,
	Vincenzo Maffione

This patch removes some unused arrays from the netfront private
data structures. These arrays were used in "flip" receive mode.

Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com>
---
 drivers/net/xen-netfront.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 22bcb4e..a4e5048 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -144,10 +144,6 @@ struct netfront_queue {
 	struct sk_buff *rx_skbs[NET_RX_RING_SIZE];
 	grant_ref_t gref_rx_head;
 	grant_ref_t grant_rx_ref[NET_RX_RING_SIZE];
-
-	unsigned long rx_pfn_array[NET_RX_RING_SIZE];
-	struct multicall_entry rx_mcl[NET_RX_RING_SIZE+1];
-	struct mmu_update rx_mmu[NET_RX_RING_SIZE];
 };
 
 struct netfront_info {
-- 
2.2.1

^ permalink raw reply related

* [PATCH 1/1] MAINTAINERS: remove ath5k mailing list
From: Jiri Slaby @ 2015-01-10 11:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, Jiri Slaby, Nick Kossifidis,
	Luis R. Rodriguez, linux-wireless, Michael Renzmann

The list is in the process of closing.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Nick Kossifidis <mickflemm@gmail.com>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Cc: linux-wireless@vger.kernel.org
Cc: "Michael Renzmann" <mrenzmann@madwifi-project.org>
---
 MAINTAINERS | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 0519e79197ad..5ce30f9810b1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1596,7 +1596,6 @@ M:	Jiri Slaby <jirislaby@gmail.com>
 M:	Nick Kossifidis <mickflemm@gmail.com>
 M:	"Luis R. Rodriguez" <mcgrof@do-not-panic.com>
 L:	linux-wireless@vger.kernel.org
-L:	ath5k-devel@lists.ath5k.org
 W:	http://wireless.kernel.org/en/users/Drivers/ath5k
 S:	Maintained
 F:	drivers/net/wireless/ath/ath5k/
-- 
2.2.1

^ permalink raw reply related

* Re: [PATCH net-next v2] tcp: avoid reducing cwnd when ACK+DSACK is received
From: Sébastien Barré @ 2015-01-10 11:51 UTC (permalink / raw)
  To: Yuchung Cheng, Eric Dumazet
  Cc: Neal Cardwell, David Miller, Netdev, Gregory Detal,
	Nandita Dukkipati
In-Reply-To: <CAK6E8=dhW=0hRYHjjgBh0KwKOQfzHhwY2egusQ8S4tsoJb0Nsg@mail.gmail.com>

All,

Le 09/01/2015 20:43, Yuchung Cheng a écrit :
>
> Sebastien: I suggest breaking down by ACK types for readability. e.g.,
>
> /* This routine deals with acks during a TLP episode.
>   * We mark the end of a TLP episode on receiving TLP dupack or when
>   * ack is after tlp_high_seq.
>   * Ref: loss detection algorithm in draft-dukkipati-tcpm-tcp-loss-probe.
>   */
> static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag)
> {
>          struct tcp_sock *tp = tcp_sk(sk);
>
>          if (before(ack, tp->tlp_high_seq))
>                  return;
>
>          if (flag & FLAG_DSACKING_ACK) {
>                  /* This DSACK means original and TLP probe arrived; no loss */
>                  tp->tlp_high_seq = 0;
>          } else if (after(ack, tp->tlp_high_seq)) {
>                  /* ACK advances: there was a loss, so reduce cwnd. Reset
>                   * tlp_high_seq in tcp_init_cwnd_reduction()
Indeed, hadn't seen that.
>                   */
>                  tcp_init_cwnd_reduction(sk);
>                  tcp_set_ca_state(sk, TCP_CA_CWR);
>                  tcp_end_cwnd_reduction(sk);
>                  tcp_try_keep_open(sk);
>                  NET_INC_STATS_BH(sock_net(sk),
>                                   LINUX_MIB_TCPLOSSPROBERECOVERY);
>          } else if (!(flag & (FLAG_SND_UNA_ADVANCED |
>                               FLAG_NOT_DUP | FLAG_DATA_SACKED))) {
>                  /* Pure dupack: original and TLP probe arrived; no loss */
>                  tp->tlp_high_seq = 0;
>          }
> }
That looks much more readable compared to my v2.
It is currently passing our tests (These are in fact MPTCP tests appart 
from Neal's packetdrill that I will add, but actually the MPTCP stack 
happens to reveal this situation quite easily, I think because in MPTCP, 
we store the send queue in the "meta-flow", which currently cannot be 
used for tail loss probes).

As probably everyone will be happy with this (Eric as well ?), I suggest 
I prepare a v3 once all our tests are passed as well, with Yuchung's 
structure and Neal's packetdrill test in the commit text. Will also add 
proper credit as there is now stuff from several people in those few 
lines now :-).

Looks good ?

Thanks again for your fast and helpful interactions !

Sébastien.

>
>>

^ permalink raw reply

* Re: Query regarding sk_filter
From: Kumar Sanghvi @ 2015-01-10 12:40 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: netdev@vger.kernel.org
In-Reply-To: <CAADnVQKNF43g4RdMTRbPJ2m_XYwyekpmHb93UyarWJB-z8iGAQ@mail.gmail.com>

On Friday, January 01/09/15, 2015 at 16:51:46 -0800, Alexei Starovoitov wrote:
> On Fri, Jan 9, 2015 at 3:23 AM, Kumar Sanghvi <kumaras@chelsio.com> wrote:
> > Hi netdev team,
> >
> > I have a query regarding sk_filter call in tcp receive path:
> >
> > In 'tcp_v4_rcv' function, if sk is found by __inet_lookup_skb then,
> > down the line, there is a call to sk_filter to ensure if the incoming packet
> > is allowed to be processed for that sk.
> >
> > However, in 'tcp_v4_hnd_req' function, if nsk is found by inet_lookup_established
> > then, later, there does not seem to be a sk_filter call for that nsk in the receive
> > path processing.
> >
> > I am wondering shouldn't there be a sk_filter call on nsk found in 'tcp_v4_hnd_req'
> > function ? Or, probably I am missing something.
> 
> hmm. I'm not sure what you're seeing.

This is more of a question out of curiosity :)

> tcp_v4_hnd_req() is called from tcp_v4_do_rcv() which is called
> after sk_filter() check is done in tcp_v4_rcv() (either directly
> or via prequeue/backlog)

Ok.
> 
> > I am running some high rate syn-flood tests and trying to understand
> > the sk_filter behaviour in this case.
> 
> are you saying not all of syn packets are reaching filter?

No, not saying that.

I was thinking more in terms of below:-
(BTW, I am unsure if case B described below is actually possible.
I am describing it hypothetically.
So, please correct me if I am smoking cracks and my understanding is wrong)

One more thing I forgot to clarify is: the syn-flood test that I am running uses the 
same 4-tuple of actual clients establishing connections with server.

Lets say there is iperf TCP server running on DUT.
There are some short-lived iperf clients establishing connections.
The syn-flood uses the same 4-tuple which the iperf clients use.

The two cases that I was thinking of are:

A) Connection is established on DUT.
-------------------------------------
Now, if a SYN comes with same 4-tuple then, in tcp_v4_rcv, a child socket would be
found from __inet_lookup_skb and the subsequent sk_filter would run for that child socket.


B) Connection is in process of establishing.
-------------------------------------------
Here, lets say a SYN comes (using the same 4-tuple as iperf client whose connection is in process 
of establishing)  and in tcp_v4_rcv, there is no existing established connection
found yet. So, listen socket would be returned via __inet_lookup_skb and subsequent sk_filter
would run on listen socket.

Further, as this SYN packet is processed, a child socket is found in tcp_v4_hnd_req.
And then, tcp_child_process would then get called from tcp_v4_do_rcv.

So, unlike case A), here the sk_filter ran on listen socket rather than the child socket.
Or does the sk_filter would run on child socket from some other part ?

May be, the question that I should have asked is : do child socket and parent listening socket have the 
same sk_filter applied i.e. do child socket inherit sk_filter from parent listening socket ?


Thank you for your response.
-Kumar.

^ permalink raw reply

* [PATCH net-next v3 0/4] bridge: support for vlan range in setlink/dellink
From: roopa @ 2015-01-10 15:31 UTC (permalink / raw)
  To: netdev, shemminger, vyasevic; +Cc: wkok, sfeldma

From: Roopa Prabhu <roopa@cumulusnetworks.com>

This series adds new flags in IFLA_BRIDGE_VLAN_INFO to indicate
vlan range.

Will post corresponding iproute2 patches if these get accepted.

v1-> v2
    - changed patches to use a nested list attribute
    IFLA_BRIDGE_VLAN_INFO_LIST as suggested by scott feldman
    - dropped notification changes from the series. Will post them
    separately after this range message is accepted.

v2 -> v3
    - incorporated some review feedback
    - include patches to fill vlan ranges during getlink
    - Dropped IFLA_BRIDGE_VLAN_INFO_LIST. I think it may get
    confusing to userspace if we introduce yet another way to
    send lists. With getlink already sending nested
    IFLA_BRIDGE_VLAN_INFO in IFLA_AF_SPEC, It seems better to
    use the existing format for lists and just use the flags from v2
    to mark vlan ranges

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>

Roopa Prabhu (4):
  bridge: new flags to represent vlan info ranges
  bridge: add support to parse multiple vlan info attributes in
    IFLA_AF_SPEC
  rtnetlink: new filter RTEXT_FILTER_BRVLAN_COMPRESSED
  bridge: new function to pack vlans into ranges during gets

 include/uapi/linux/if_bridge.h |    2 +
 include/uapi/linux/rtnetlink.h |    1 +
 net/bridge/br_netlink.c        |  243 +++++++++++++++++++++++++++++++---------
 3 files changed, 195 insertions(+), 51 deletions(-)

-- 
1.7.10.4

^ permalink raw reply

* [PATCH net-next v3 1/3] bridge: support for multiple vlans and vlan ranges in setlink and dellink requests
From: roopa @ 2015-01-10 15:31 UTC (permalink / raw)
  To: netdev, shemminger, vyasevic; +Cc: wkok, sfeldma

From: Roopa Prabhu <roopa@cumulusnetworks.com>

This patch changes bridge IFLA_AF_SPEC netlink attribute parser to
look for more than one IFLA_BRIDGE_VLAN_INFO attribute. This allows
userspace to pack more than one vlan in the setlink msg.

The dumps were already sending more than one vlan info in the getlink msg.

This patch also adds bridge_vlan_info flags BRIDGE_VLAN_INFO_RANGE_BEGIN and
BRIDGE_VLAN_INFO_RANGE_END to indicate start and end of vlan range

This patch also deletes unused ifla_br_policy.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 include/uapi/linux/if_bridge.h |    2 +
 net/bridge/br_netlink.c        |  104 ++++++++++++++++++++++++++--------------
 2 files changed, 70 insertions(+), 36 deletions(-)

diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index b03ee8f..eaaea62 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -125,6 +125,8 @@ enum {
 #define BRIDGE_VLAN_INFO_MASTER	(1<<0)	/* Operate on Bridge device as well */
 #define BRIDGE_VLAN_INFO_PVID	(1<<1)	/* VLAN is PVID, ingress untagged */
 #define BRIDGE_VLAN_INFO_UNTAGGED	(1<<2)	/* VLAN egresses untagged */
+#define BRIDGE_VLAN_INFO_RANGE_BEGIN	(1<<3) /* VLAN is start of vlan range */
+#define BRIDGE_VLAN_INFO_RANGE_END	(1<<4) /* VLAN is end of vlan range */
 
 struct bridge_vlan_info {
 	__u16 flags;
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 9f5eb55..6f616a2 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -218,57 +218,89 @@ out:
 	return err;
 }
 
-static const struct nla_policy ifla_br_policy[IFLA_MAX+1] = {
-	[IFLA_BRIDGE_FLAGS]	= { .type = NLA_U16 },
-	[IFLA_BRIDGE_MODE]	= { .type = NLA_U16 },
-	[IFLA_BRIDGE_VLAN_INFO]	= { .type = NLA_BINARY,
-				    .len = sizeof(struct bridge_vlan_info), },
-};
+static int br_vlan_info(struct net_bridge *br, struct net_bridge_port *p,
+			int cmd, struct bridge_vlan_info *vinfo)
+{
+	int err = 0;
+
+	switch (cmd) {
+	case RTM_SETLINK:
+		if (p) {
+			err = nbp_vlan_add(p, vinfo->vid, vinfo->flags);
+			if (err)
+				break;
+
+			if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
+				err = br_vlan_add(p->br, vinfo->vid,
+						  vinfo->flags);
+		} else {
+			err = br_vlan_add(br, vinfo->vid, vinfo->flags);
+		}
+		break;
+
+	case RTM_DELLINK:
+		if (p) {
+			nbp_vlan_delete(p, vinfo->vid);
+			if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
+				br_vlan_delete(p->br, vinfo->vid);
+		} else {
+			br_vlan_delete(br, vinfo->vid);
+		}
+		break;
+	}
+
+	return err;
+}
 
 static int br_afspec(struct net_bridge *br,
 		     struct net_bridge_port *p,
 		     struct nlattr *af_spec,
 		     int cmd)
 {
-	struct nlattr *tb[IFLA_BRIDGE_MAX+1];
+	struct bridge_vlan_info *vinfo_start = NULL;
+	struct bridge_vlan_info *vinfo = NULL;
+	struct nlattr *attr;
 	int err = 0;
+	int rem;
 
-	err = nla_parse_nested(tb, IFLA_BRIDGE_MAX, af_spec, ifla_br_policy);
-	if (err)
-		return err;
+	nla_for_each_nested(attr, af_spec, rem) {
+		if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO)
+			continue;
+		if (nla_len(attr) != sizeof(struct bridge_vlan_info))
+			return -EINVAL;
+		vinfo = nla_data(attr);
+		if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) {
+			if (vinfo_start)
+				return -EINVAL;
+			vinfo_start = vinfo;
+			continue;
+		}
+
+		if (vinfo_start) {
+			struct bridge_vlan_info tmp_vinfo;
+			int v;
 
-	if (tb[IFLA_BRIDGE_VLAN_INFO]) {
-		struct bridge_vlan_info *vinfo;
+			if (!(vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END))
+				return -EINVAL;
 
-		vinfo = nla_data(tb[IFLA_BRIDGE_VLAN_INFO]);
+			if (vinfo->vid <= vinfo_start->vid)
+				return -EINVAL;
 
-		if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
-			return -EINVAL;
+			memcpy(&tmp_vinfo, vinfo_start,
+			       sizeof(struct bridge_vlan_info));
 
-		switch (cmd) {
-		case RTM_SETLINK:
-			if (p) {
-				err = nbp_vlan_add(p, vinfo->vid, vinfo->flags);
+			for (v = vinfo_start->vid; v <= vinfo->vid; v++) {
+				tmp_vinfo.vid = v;
+				err = br_vlan_info(br, p, cmd, &tmp_vinfo);
 				if (err)
 					break;
-
-				if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
-					err = br_vlan_add(p->br, vinfo->vid,
-							  vinfo->flags);
-			} else
-				err = br_vlan_add(br, vinfo->vid, vinfo->flags);
-
-			break;
-
-		case RTM_DELLINK:
-			if (p) {
-				nbp_vlan_delete(p, vinfo->vid);
-				if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
-					br_vlan_delete(p->br, vinfo->vid);
-			} else
-				br_vlan_delete(br, vinfo->vid);
-			break;
+			}
+			vinfo_start = NULL;
+		} else {
+			err = br_vlan_info(br, p, cmd, vinfo);
 		}
+		if (err)
+			break;
 	}
 
 	return err;
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH net-next v3 2/3] rtnetlink: new filter RTEXT_FILTER_BRVLAN_COMPRESSED
From: roopa @ 2015-01-10 15:31 UTC (permalink / raw)
  To: netdev, shemminger, vyasevic; +Cc: wkok, sfeldma

From: Roopa Prabhu <roopa@cumulusnetworks.com>

This filter is same as RTEXT_FILTER_BRVLAN except that it tries
to compress the consecutive vlans into ranges.

This helps on systems with large number of configured vlans.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 include/uapi/linux/rtnetlink.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 9c9b8b4..d5a5316 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -634,6 +634,7 @@ struct tcamsg {
 /* New extended info filters for IFLA_EXT_MASK */
 #define RTEXT_FILTER_VF		(1 << 0)
 #define RTEXT_FILTER_BRVLAN	(1 << 1)
+#define RTEXT_FILTER_BRVLAN_COMPRESSED	(1 << 2)
 
 /* End of information exported to user level */
 
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH net-next v3 3/3] bridge: new function to pack vlans into ranges during gets
From: roopa @ 2015-01-10 15:31 UTC (permalink / raw)
  To: netdev, shemminger, vyasevic; +Cc: wkok, sfeldma

From: Roopa Prabhu <roopa@cumulusnetworks.com>

This patch adds new function to pack vlans into ranges
whereever applicable using the flags BRIDGE_VLAN_INFO_RANGE_BEGIN
and BRIDGE VLAN_INFO_RANGE_END

Old vlan packing code is moved to a new function and continues to be
called when filter_mask is RTEXT_FILTER_BRVLAN.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 net/bridge/br_netlink.c |  145 ++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 124 insertions(+), 21 deletions(-)

diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 6f616a2..0b03879 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -67,6 +67,118 @@ static int br_port_fill_attrs(struct sk_buff *skb,
 	return 0;
 }
 
+static int br_fill_ifvlaninfo_range(struct sk_buff *skb, u16 vid_start,
+				    u16 vid_end, u16 flags)
+{
+	struct  bridge_vlan_info vinfo;
+
+	if ((vid_end - vid_start) > 0) {
+		/* add range to skb */
+		vinfo.vid = vid_start;
+		vinfo.flags = flags | BRIDGE_VLAN_INFO_RANGE_BEGIN;
+		if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
+			    sizeof(vinfo), &vinfo))
+			goto nla_put_failure;
+
+		vinfo.flags &= ~BRIDGE_VLAN_INFO_RANGE_BEGIN;
+
+		vinfo.vid = vid_end;
+		vinfo.flags = flags | BRIDGE_VLAN_INFO_RANGE_END;
+		if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
+			    sizeof(vinfo), &vinfo))
+			goto nla_put_failure;
+	} else {
+		vinfo.vid = vid_start;
+		vinfo.flags = flags;
+		if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
+			    sizeof(vinfo), &vinfo))
+			goto nla_put_failure;
+	}
+
+	return 0;
+
+nla_put_failure:
+	return -EMSGSIZE;
+}
+
+static int br_fill_ifvlaninfo_compressed(struct sk_buff *skb,
+					 const struct net_port_vlans *pv)
+{
+	u16 vid_range_start = 0, vid_range_end = 0;
+	u16 vid_range_flags;
+	u16 pvid, vid, flags;
+	int err = 0;
+
+	/* Pack IFLA_BRIDGE_VLAN_INFO's for every vlan
+	 * and mark vlan info with begin and end flags
+	 * if vlaninfo represents a range
+	 */
+	pvid = br_get_pvid(pv);
+	for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
+		flags = 0;
+		if (vid == pvid)
+			flags |= BRIDGE_VLAN_INFO_PVID;
+
+		if (test_bit(vid, pv->untagged_bitmap))
+			flags |= BRIDGE_VLAN_INFO_UNTAGGED;
+
+		if (vid_range_start == 0) {
+			goto initvars;
+		} else if ((vid - vid_range_end) == 1 &&
+			flags == vid_range_flags) {
+			vid_range_end = vid;
+			continue;
+		} else {
+			err = br_fill_ifvlaninfo_range(skb, vid_range_start,
+						       vid_range_end,
+						       vid_range_flags);
+			if (err)
+				return err;
+		}
+
+initvars:
+		vid_range_start = vid;
+		vid_range_end = vid;
+		vid_range_flags = flags;
+	}
+
+	/* Call it once more to send any left over vlans */
+	err = br_fill_ifvlaninfo_range(skb, vid_range_start,
+				       vid_range_end,
+				       vid_range_flags);
+	if (err)
+		return err;
+
+	return 0;
+}
+
+static int br_fill_ifvlaninfo(struct sk_buff *skb,
+			      const struct net_port_vlans *pv)
+{
+	struct bridge_vlan_info vinfo;
+	u16 pvid, vid;
+
+	pvid = br_get_pvid(pv);
+	for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
+		vinfo.vid = vid;
+		vinfo.flags = 0;
+		if (vid == pvid)
+			vinfo.flags |= BRIDGE_VLAN_INFO_PVID;
+
+		if (test_bit(vid, pv->untagged_bitmap))
+			vinfo.flags |= BRIDGE_VLAN_INFO_UNTAGGED;
+
+		if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
+			    sizeof(vinfo), &vinfo))
+			goto nla_put_failure;
+	}
+
+	return 0;
+
+nla_put_failure:
+	return -EMSGSIZE;
+}
+
 /*
  * Create one netlink message for one interface
  * Contains port and master info as well as carrier and bridge state.
@@ -121,12 +233,11 @@ static int br_fill_ifinfo(struct sk_buff *skb,
 	}
 
 	/* Check if  the VID information is requested */
-	if (filter_mask & RTEXT_FILTER_BRVLAN) {
-		struct nlattr *af;
+	if ((filter_mask & RTEXT_FILTER_BRVLAN) ||
+	    (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)) {
 		const struct net_port_vlans *pv;
-		struct bridge_vlan_info vinfo;
-		u16 vid;
-		u16 pvid;
+		struct nlattr *af;
+		int err;
 
 		if (port)
 			pv = nbp_get_vlan_info(port);
@@ -140,21 +251,12 @@ static int br_fill_ifinfo(struct sk_buff *skb,
 		if (!af)
 			goto nla_put_failure;
 
-		pvid = br_get_pvid(pv);
-		for_each_set_bit(vid, pv->vlan_bitmap, VLAN_N_VID) {
-			vinfo.vid = vid;
-			vinfo.flags = 0;
-			if (vid == pvid)
-				vinfo.flags |= BRIDGE_VLAN_INFO_PVID;
-
-			if (test_bit(vid, pv->untagged_bitmap))
-				vinfo.flags |= BRIDGE_VLAN_INFO_UNTAGGED;
-
-			if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
-				    sizeof(vinfo), &vinfo))
-				goto nla_put_failure;
-		}
-
+		if (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)
+			err = br_fill_ifvlaninfo_compressed(skb, pv);
+		else
+			err = br_fill_ifvlaninfo(skb, pv);
+		if (err)
+			goto nla_put_failure;
 		nla_nest_end(skb, af);
 	}
 
@@ -209,7 +311,8 @@ int br_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 	int err = 0;
 	struct net_bridge_port *port = br_port_get_rtnl(dev);
 
-	if (!port && !(filter_mask & RTEXT_FILTER_BRVLAN))
+	if (!port && !(filter_mask & RTEXT_FILTER_BRVLAN) &&
+	    !(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED))
 		goto out;
 
 	err = br_fill_ifinfo(skb, port, pid, seq, RTM_NEWLINK, NLM_F_MULTI,
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH 3/3] rtlwifi: btcoexist: Remove some unused functions
From: Rickard Strandqvist @ 2015-01-10 16:24 UTC (permalink / raw)
  To: Larry Finger, Chaoming Li
  Cc: Rickard Strandqvist, Kalle Valo, Greg Kroah-Hartman,
	Masanari Iida, Sachin Kamat, linux-wireless, netdev, linux-kernel
In-Reply-To: <1420907079-27102-1-git-send-email-rickard_strandqvist@spectrumdigital.se>

Removes some functions that are not used anywhere:
ex_halbtc8821a2ant_periodical() ex_halbtc8821a2ant_halt_notify()
ex_halbtc8821a2ant_bt_info_notify()
ex_halbtc8821a2ant_special_packet_notify()
ex_halbtc8821a2ant_connect_notify() ex_halbtc8821a2ant_scan_notify()
ex_halbtc8821a2ant_lps_notify() ex_halbtc8821a2ant_ips_notify()
ex_halbtc8821a2ant_display_coex_info() ex_halbtc8821a2ant_init_coex_dm()
ex_halbtc8821a2ant_init_hwconfig()

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 .../wireless/rtlwifi/btcoexist/halbtc8821a2ant.c   |  548 --------------------
 .../wireless/rtlwifi/btcoexist/halbtc8821a2ant.h   |   51 --
 2 files changed, 599 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.c
index cf819f0..7d7b81d 100644
--- a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -3290,346 +3290,6 @@ static void halbtc8821a2ant_run_coexist_mechanism(struct btc_coexist *btcoexist)
  * extern function start with EXhalbtc8821a2ant_
  *============================================================
  */
-void ex_halbtc8821a2ant_init_hwconfig(struct btc_coexist *btcoexist)
-{
-	u8 u1tmp = 0;
-
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-		  "[BTCoex], 2Ant Init HW Config!!\n");
-
-	/* backup rf 0x1e value */
-	coex_dm->bt_rf0x1e_backup =
-		btcoexist->btc_get_rf_reg(btcoexist, BTC_RF_A, 0x1e, 0xfffff);
-
-	/* 0x790[5:0] = 0x5 */
-	u1tmp = btcoexist->btc_read_1byte(btcoexist, 0x790);
-	u1tmp &= 0xc0;
-	u1tmp |= 0x5;
-	btcoexist->btc_write_1byte(btcoexist, 0x790, u1tmp);
-
-	/*Antenna config */
-	halbtc8821a2ant_set_ant_path(btcoexist,
-				     BTC_ANT_WIFI_AT_MAIN, true, false);
-
-	/* PTA parameter */
-	halbtc8821a2ant_coex_table(btcoexist,
-				   FORCE_EXEC, 0x55555555, 0x55555555,
-				   0xffff, 0x3);
-
-	/* Enable counter statistics */
-	/*0x76e[3] = 1, WLAN_Act control by PTA*/
-	btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc);
-	btcoexist->btc_write_1byte(btcoexist, 0x778, 0x3);
-	btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1);
-}
-
-void
-ex_halbtc8821a2ant_init_coex_dm(
-	struct btc_coexist *btcoexist
-	)
-{
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-		  "[BTCoex], Coex Mechanism Init!!\n");
-
-	halbtc8821a2ant_init_coex_dm(btcoexist);
-}
-
-void
-ex_halbtc8821a2ant_display_coex_info(
-	struct btc_coexist *btcoexist
-	)
-{
-	struct btc_board_info *board_info = &btcoexist->board_info;
-	struct btc_stack_info *stack_info = &btcoexist->stack_info;
-	struct rtl_priv *rtlpriv = btcoexist->adapter;
-	u8 u1tmp[4], i, bt_info_ext, ps_tdma_case = 0;
-	u32 u4tmp[4];
-	bool roam = false, scan = false, link = false, wifi_under_5g = false;
-	bool bt_hs_on = false, wifi_busy = false;
-	long wifi_rssi = 0, bt_hs_rssi = 0;
-	u32 wifi_bw, wifi_traffic_dir;
-	u8 wifi_dot_11_chnl, wifi_hs_chnl;
-	u32 fw_ver = 0, bt_patch_ver = 0;
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n ============[BT Coexist info]============");
-
-	if (!board_info->bt_exist) {
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n BT not exists !!!");
-		return;
-	}
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:",
-		   board_info->pg_ant_num, board_info->btdm_ant_num);
-
-	if (btcoexist->manual_control) {
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s", "[Action Manual control]!!");
-	}
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %s / %d", "BT stack/ hci ext ver",
-		   ((stack_info->profile_notified) ? "Yes" : "No"),
-		   stack_info->hci_version);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER, &bt_patch_ver);
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d_%d/ 0x%x/ 0x%x(%d)",
-		   "CoexVer/ FwVer/ PatchVer",
-		   glcoex_ver_date_8821a_2ant, glcoex_ver_8821a_2ant,
-		   fw_ver, bt_patch_ver, bt_patch_ver);
-
-	btcoexist->btc_get(btcoexist,
-		BTC_GET_BL_HS_OPERATION, &bt_hs_on);
-	btcoexist->btc_get(btcoexist,
-		BTC_GET_U1_WIFI_DOT11_CHNL, &wifi_dot_11_chnl);
-	btcoexist->btc_get(btcoexist,
-		BTC_GET_U1_WIFI_HS_CHNL, &wifi_hs_chnl);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d / %d(%d)",
-		   "Dot11 channel / HsMode(HsChnl)",
-		   wifi_dot_11_chnl, bt_hs_on, wifi_hs_chnl);
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %02x %02x %02x ",
-		   "H2C Wifi inform bt chnl Info",
-		   coex_dm->wifi_chnl_info[0], coex_dm->wifi_chnl_info[1],
-		   coex_dm->wifi_chnl_info[2]);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi);
-	btcoexist->btc_get(btcoexist, BTC_GET_S4_HS_RSSI, &bt_hs_rssi);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %ld/ %ld", "Wifi rssi/ HS rssi",
-		   wifi_rssi, bt_hs_rssi);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d/ %d/ %d ", "Wifi link/ roam/ scan",
-		   link, roam, scan);
-
-	btcoexist->btc_get(btcoexist,
-		BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g);
-	btcoexist->btc_get(btcoexist,
-		BTC_GET_U4_WIFI_BW, &wifi_bw);
-	btcoexist->btc_get(btcoexist,
-		BTC_GET_BL_WIFI_BUSY, &wifi_busy);
-	btcoexist->btc_get(btcoexist,
-		BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifi_traffic_dir);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %s / %s/ %s ", "Wifi status",
-		   (wifi_under_5g ? "5G" : "2.4G"),
-		   ((BTC_WIFI_BW_LEGACY == wifi_bw) ? "Legacy" :
-		    (((BTC_WIFI_BW_HT40 == wifi_bw) ? "HT40" : "HT20"))),
-		   ((!wifi_busy) ? "idle" :
-		    ((BTC_WIFI_TRAFFIC_TX == wifi_traffic_dir) ?
-		     "uplink" : "downlink")));
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]",
-		   ((coex_sta->c2h_bt_inquiry_page) ? ("inquiry/page scan") :
-		    ((BT_8821A_2ANT_BT_STATUS_IDLE == coex_dm->bt_status)
-		     ? "idle" : ((BT_8821A_2ANT_BT_STATUS_CON_IDLE ==
-		     coex_dm->bt_status) ? "connected-idle" : "busy"))),
-		    coex_sta->bt_rssi, coex_sta->bt_retry_cnt);
-
-	if (stack_info->profile_notified) {
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP",
-			   stack_info->sco_exist, stack_info->hid_exist,
-			   stack_info->pan_exist, stack_info->a2dp_exist);
-
-		btcoexist->btc_disp_dbg_msg(btcoexist,
-					    BTC_DBG_DISP_BT_LINK_INFO);
-	}
-
-	bt_info_ext = coex_sta->bt_info_ext;
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %s",
-		   "BT Info A2DP rate",
-		   (bt_info_ext&BIT0) ? "Basic rate" : "EDR rate");
-
-	for (i = 0; i < BT_INFO_SRC_8821A_2ANT_MAX; i++) {
-		if (coex_sta->bt_info_c2h_cnt[i]) {
-			RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-				   "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)",
-				   glbt_info_src_8821a_2ant[i],
-				   coex_sta->bt_info_c2h[i][0],
-				   coex_sta->bt_info_c2h[i][1],
-				   coex_sta->bt_info_c2h[i][2],
-				   coex_sta->bt_info_c2h[i][3],
-				   coex_sta->bt_info_c2h[i][4],
-				   coex_sta->bt_info_c2h[i][5],
-				   coex_sta->bt_info_c2h[i][6],
-				   coex_sta->bt_info_c2h_cnt[i]);
-		}
-	}
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %s/%s",
-		   "PS state, IPS/LPS",
-		   ((coex_sta->under_ips ? "IPS ON" : "IPS OFF")),
-		   ((coex_sta->under_lps ? "LPS ON" : "LPS OFF")));
-	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
-
-	/* Sw mechanism*/
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s",
-		   "============[Sw mechanism]============");
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d/ %d/ %d/ %d ",
-		   "SM1[ShRf/ LpRA/ LimDig/ btLna]",
-		   coex_dm->cur_rf_rx_lpf_shrink, coex_dm->cur_low_penalty_ra,
-		   coex_dm->limited_dig, coex_dm->cur_bt_lna_constrain);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d/ %d/ %d(0x%x) ",
-		   "SM2[AgcT/ AdcB/ SwDacSwing(lvl)]",
-		   coex_dm->cur_agc_table_en, coex_dm->cur_adc_back_off,
-		   coex_dm->cur_dac_swing_on, coex_dm->cur_dac_swing_lvl);
-
-	/* Fw mechanism*/
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s",
-		   "============[Fw mechanism]============");
-
-	if (!btcoexist->manual_control) {
-		ps_tdma_case = coex_dm->cur_ps_tdma;
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s = %02x %02x %02x %02x %02x case-%d",
-			   "PS TDMA",
-			   coex_dm->ps_tdma_para[0], coex_dm->ps_tdma_para[1],
-			   coex_dm->ps_tdma_para[2], coex_dm->ps_tdma_para[3],
-			   coex_dm->ps_tdma_para[4], ps_tdma_case);
-
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct",
-			   coex_dm->cur_dec_bt_pwr,
-			   coex_dm->cur_ignore_wlan_act);
-	}
-
-	/* Hw setting*/
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s", "============[Hw setting]============");
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x", "RF-A, 0x1e initVal",
-		   coex_dm->bt_rf0x1e_backup);
-
-	u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x778);
-	u1tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0x6cc);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x ",
-		   "0x778 (W_Act)/ 0x6cc (CoTab Sel)",
-		   u1tmp[0], u1tmp[1]);
-
-	u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x8db);
-	u1tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0xc5b);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x",
-		   "0x8db(ADC)/0xc5b[29:25](DAC)",
-		   ((u1tmp[0]&0x60)>>5), ((u1tmp[1]&0x3e)>>1));
-
-	u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xcb4);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x",
-		   "0xcb4[7:0](ctrl)/ 0xcb4[29:28](val)",
-		   u4tmp[0]&0xff, ((u4tmp[0]&0x30000000)>>28));
-
-	u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x40);
-	u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x4c);
-	u4tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x974);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x",
-		   "0x40/ 0x4c[24:23]/ 0x974",
-		   u1tmp[0], ((u4tmp[0]&0x01800000)>>23), u4tmp[1]);
-
-	u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x550);
-	u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x522);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x",
-		   "0x550(bcn ctrl)/0x522",
-		   u4tmp[0], u1tmp[0]);
-
-	u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc50);
-	u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0xa0a);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x",
-		   "0xc50(DIG)/0xa0a(CCK-TH)",
-		   u4tmp[0], u1tmp[0]);
-
-	u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xf48);
-	u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0xa5b);
-	u1tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0xa5c);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x",
-		   "OFDM-FA/ CCK-FA",
-		   u4tmp[0], (u1tmp[0]<<8) + u1tmp[1]);
-
-	u4tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x6c0);
-	u4tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x6c4);
-	u4tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0x6c8);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x",
-		   "0x6c0/0x6c4/0x6c8",
-		   u4tmp[0], u4tmp[1], u4tmp[2]);
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d/ %d",
-		   "0x770 (hi-pri Rx/Tx)",
-		   coex_sta->high_priority_rx, coex_sta->high_priority_tx);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d/ %d",
-		   "0x774(low-pri Rx/Tx)",
-		   coex_sta->low_priority_rx, coex_sta->low_priority_tx);
-
-	/* Tx mgnt queue hang or not, 0x41b should = 0xf, ex: 0xd ==>hang*/
-	u1tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x41b);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x",
-		   "0x41b (mgntQ hang chk == 0xf)",
-		   u1tmp[0]);
-
-	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-void ex_halbtc8821a2ant_ips_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	if (BTC_IPS_ENTER == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], IPS ENTER notify\n");
-		coex_sta->under_ips = true;
-		halbtc8821a2ant_coex_all_off(btcoexist);
-	} else if (BTC_IPS_LEAVE == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], IPS LEAVE notify\n");
-		coex_sta->under_ips = false;
-		/*halbtc8821a2ant_init_coex_dm(btcoexist);*/
-	}
-}
-
-void ex_halbtc8821a2ant_lps_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	if (BTC_LPS_ENABLE == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], LPS ENABLE notify\n");
-		coex_sta->under_lps = true;
-	} else if (BTC_LPS_DISABLE == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], LPS DISABLE notify\n");
-		coex_sta->under_lps = false;
-	}
-}
-
-void ex_halbtc8821a2ant_scan_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	if (BTC_SCAN_START == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], SCAN START notify\n");
-	} else if (BTC_SCAN_FINISH == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], SCAN FINISH notify\n");
-	}
-}
-
-void ex_halbtc8821a2ant_connect_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	if (BTC_ASSOCIATE_START == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], CONNECT START notify\n");
-	} else if (BTC_ASSOCIATE_FINISH == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], CONNECT FINISH notify\n");
-	}
-}
-
 void ex_halbtc8821a2ant_media_status_notify(struct btc_coexist *btcoexist,
 					    u8 type)
 {
@@ -3669,211 +3329,3 @@ void ex_halbtc8821a2ant_media_status_notify(struct btc_coexist *btcoexist,
 
 	btcoexist->btc_fill_h2c(btcoexist, 0x66, 3, h2c_parameter);
 }
-
-void ex_halbtc8821a2ant_special_packet_notify(struct btc_coexist *btcoexist,
-					      u8 type) {
-	if (type == BTC_PACKET_DHCP) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], DHCP Packet notify\n");
-	}
-}
-
-void ex_halbtc8821a2ant_bt_info_notify(struct btc_coexist *btcoexist,
-				       u8 *tmp_buf, u8 length)
-{
-	u8		bt_info = 0;
-	u8		i, rsp_source = 0;
-	static u32	set_bt_lna_cnt, set_bt_psd_mode;
-	bool		bt_busy = false, limited_dig = false;
-	bool		wifi_connected = false, bt_hs_on = false;
-
-	coex_sta->c2h_bt_info_req_sent = false;
-
-	rsp_source = tmp_buf[0]&0xf;
-	if (rsp_source >= BT_INFO_SRC_8821A_2ANT_MAX)
-		rsp_source = BT_INFO_SRC_8821A_2ANT_WIFI_FW;
-	coex_sta->bt_info_c2h_cnt[rsp_source]++;
-
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-		  "[BTCoex], Bt info[%d], length = %d, hex data = [",
-		  rsp_source, length);
-	for (i = 0; i < length; i++) {
-		coex_sta->bt_info_c2h[rsp_source][i] = tmp_buf[i];
-		if (i == 1)
-			bt_info = tmp_buf[i];
-		if (i == length-1) {
-			BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-				  "0x%02x]\n", tmp_buf[i]);
-		} else {
-			BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-				  "0x%02x, ", tmp_buf[i]);
-		}
-	}
-
-	if (BT_INFO_SRC_8821A_2ANT_WIFI_FW != rsp_source) {
-		coex_sta->bt_retry_cnt =	/* [3:0]*/
-			coex_sta->bt_info_c2h[rsp_source][2]&0xf;
-
-		coex_sta->bt_rssi =
-			coex_sta->bt_info_c2h[rsp_source][3]*2+10;
-
-		coex_sta->bt_info_ext =
-			coex_sta->bt_info_c2h[rsp_source][4];
-
-		/* Here we need to resend some wifi info to BT*/
-		/* because bt is reset and loss of the info.*/
-		if ((coex_sta->bt_info_ext & BIT1)) {
-			btcoexist->btc_get(btcoexist,
-				BTC_GET_BL_WIFI_CONNECTED, &wifi_connected);
-			if (wifi_connected) {
-				ex_halbtc8821a2ant_media_status_notify(btcoexist,
-					BTC_MEDIA_CONNECT);
-			} else {
-				ex_halbtc8821a2ant_media_status_notify(btcoexist,
-					BTC_MEDIA_DISCONNECT);
-			}
-
-			set_bt_psd_mode = 0;
-		}
-		if (set_bt_psd_mode <= 3) {
-			halbtc8821a2ant_set_bt_psd_mode(btcoexist, FORCE_EXEC,
-							0x0); /*fix CH-BW mode*/
-			set_bt_psd_mode++;
-		}
-
-		if (coex_dm->cur_bt_lna_constrain) {
-			if (!(coex_sta->bt_info_ext & BIT2)) {
-				if (set_bt_lna_cnt <= 3) {
-					btc8821a2_set_bt_lna_const(btcoexist,
-								   FORCE_EXEC,
-								   true);
-					set_bt_lna_cnt++;
-				}
-			}
-		} else {
-			set_bt_lna_cnt = 0;
-		}
-
-		if ((coex_sta->bt_info_ext & BIT3)) {
-			halbtc8821a2ant_ignore_wlan_act(btcoexist,
-							FORCE_EXEC, false);
-		} else {
-			/* BT already NOT ignore Wlan active, do nothing here.*/
-		}
-
-		if ((coex_sta->bt_info_ext & BIT4)) {
-			/* BT auto report already enabled, do nothing*/
-		} else {
-			halbtc8821a2ant_bt_auto_report(btcoexist,
-						       FORCE_EXEC, true);
-		}
-	}
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on);
-	/* check BIT2 first ==> check if bt is under inquiry or page scan*/
-	if (bt_info & BT_INFO_8821A_2ANT_B_INQ_PAGE) {
-		coex_sta->c2h_bt_inquiry_page = true;
-		coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_NON_IDLE;
-	} else {
-		coex_sta->c2h_bt_inquiry_page = false;
-		if (bt_info == 0x1) {
-			/* connection exists but not busy*/
-			coex_sta->bt_link_exist = true;
-			coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_CON_IDLE;
-		} else if (bt_info & BT_INFO_8821A_2ANT_B_CONNECTION) {
-			/* connection exists and some link is busy*/
-			coex_sta->bt_link_exist = true;
-			if (bt_info & BT_INFO_8821A_2ANT_B_FTP)
-				coex_sta->pan_exist = true;
-			else
-				coex_sta->pan_exist = false;
-			if (bt_info & BT_INFO_8821A_2ANT_B_A2DP)
-				coex_sta->a2dp_exist = true;
-			else
-				coex_sta->a2dp_exist = false;
-			if (bt_info & BT_INFO_8821A_2ANT_B_HID)
-				coex_sta->hid_exist = true;
-			else
-				coex_sta->hid_exist = false;
-			if (bt_info & BT_INFO_8821A_2ANT_B_SCO_ESCO)
-				coex_sta->sco_exist = true;
-			else
-				coex_sta->sco_exist = false;
-			coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_NON_IDLE;
-		} else {
-			coex_sta->bt_link_exist = false;
-			coex_sta->pan_exist = false;
-			coex_sta->a2dp_exist = false;
-			coex_sta->hid_exist = false;
-			coex_sta->sco_exist = false;
-			coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_IDLE;
-		}
-
-		if (bt_hs_on)
-			coex_dm->bt_status = BT_8821A_2ANT_BT_STATUS_NON_IDLE;
-	}
-
-	if (BT_8821A_2ANT_BT_STATUS_NON_IDLE == coex_dm->bt_status)
-		bt_busy = true;
-	else
-		bt_busy = false;
-	btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bt_busy);
-
-	if (BT_8821A_2ANT_BT_STATUS_IDLE != coex_dm->bt_status)
-		limited_dig = true;
-	else
-		limited_dig = false;
-	coex_dm->limited_dig = limited_dig;
-	btcoexist->btc_set(btcoexist,
-		BTC_SET_BL_BT_LIMITED_DIG, &limited_dig);
-
-	halbtc8821a2ant_run_coexist_mechanism(btcoexist);
-}
-
-void ex_halbtc8821a2ant_halt_notify(struct btc_coexist *btcoexist)
-{
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-		  "[BTCoex], Halt notify\n");
-
-	halbtc8821a2ant_ignore_wlan_act(btcoexist, FORCE_EXEC, true);
-	ex_halbtc8821a2ant_media_status_notify(btcoexist, BTC_MEDIA_DISCONNECT);
-}
-
-void ex_halbtc8821a2ant_periodical(struct btc_coexist *btcoexist)
-{
-	static u8	dis_ver_info_cnt;
-	u32		fw_ver = 0, bt_patch_ver = 0;
-	struct btc_board_info *board_info = &btcoexist->board_info;
-	struct btc_stack_info *stack_info = &btcoexist->stack_info;
-
-	BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-		  "[BTCoex], ==========================Periodical===========================\n");
-
-	if (dis_ver_info_cnt <= 5) {
-		dis_ver_info_cnt += 1;
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], ****************************************************************\n");
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], Ant PG Num/ Ant Mech/ Ant Pos = %d/ %d/ %d\n",
-			  board_info->pg_ant_num,
-			  board_info->btdm_ant_num,
-			  board_info->btdm_ant_pos);
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], BT stack/ hci ext ver = %s / %d\n",
-			  ((stack_info->profile_notified) ? "Yes" : "No"),
-			  stack_info->hci_version);
-		btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER,
-				   &bt_patch_ver);
-		btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], CoexVer/ FwVer/ PatchVer = %d_%x/ 0x%x/ 0x%x(%d)\n",
-			  glcoex_ver_date_8821a_2ant, glcoex_ver_8821a_2ant,
-			  fw_ver, bt_patch_ver, bt_patch_ver);
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], ****************************************************************\n");
-	}
-
-	halbtc8821a2ant_query_bt_info(btcoexist);
-	halbtc8821a2ant_monitor_bt_ctr(btcoexist);
-	btc8821a2ant_mon_bt_en_dis(btcoexist);
-}
diff --git a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.h b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.h
index b4cf1f5..4c95842 100644
--- a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.h
+++ b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.h
@@ -148,58 +148,7 @@ struct coex_sta_8821a_2ant {
  *===========================================
  */
 void
-ex_halbtc8821a2ant_init_hwconfig(
-	struct btc_coexist *btcoexist
-	);
-void
-ex_halbtc8821a2ant_init_coex_dm(
-	struct btc_coexist *btcoexist
-	);
-void
-ex_halbtc8821a2ant_ips_notify(
-	struct btc_coexist *btcoexist,
-	u8 type
-	);
-void
-ex_halbtc8821a2ant_lps_notify(
-	struct btc_coexist *btcoexist,
-	u8 type
-	);
-void
-ex_halbtc8821a2ant_scan_notify(
-	struct btc_coexist *btcoexist,
-	u8 type
-	);
-void
-ex_halbtc8821a2ant_connect_notify(
-	struct btc_coexist *btcoexist,
-	u8 type
-	);
-void
 ex_halbtc8821a2ant_media_status_notify(
 	struct btc_coexist *btcoexist,
 	u8 type
 	);
-void
-ex_halbtc8821a2ant_special_packet_notify(
-	struct btc_coexist *btcoexist,
-	u8 type
-	);
-void
-ex_halbtc8821a2ant_bt_info_notify(
-	struct btc_coexist *btcoexist,
-	u8 *tmp_buf,
-	u8 length
-	);
-void
-ex_halbtc8821a2ant_halt_notify(
-	struct btc_coexist *btcoexist
-	);
-void
-ex_halbtc8821a2ant_periodical(
-	struct btc_coexist *btcoexist
-	);
-void
-ex_halbtc8821a2ant_display_coex_info(
-	struct btc_coexist *btcoexist
-	);
-- 
1.7.10.4

^ permalink raw reply related

* Re: [Question] vxlan_features_check()
From: Tom Herbert @ 2015-01-10 16:23 UTC (permalink / raw)
  To: Sriharsha Basavapatna; +Cc: Jesse Gross, netdev@vger.kernel.org
In-Reply-To: <31318D46B5DF3F4AB71CC057601E9FEB12BFBC57@CMEXMB1.ad.emulex.com>

On Fri, Jan 9, 2015 at 10:52 PM, Sriharsha Basavapatna
<Sriharsha.Basavapatna@emulex.com> wrote:
> Hi Jesse, Tom,
>
> The current implementation of vxlan_features_check() disables csum/gso flags
> for only a subset of Non-VxLAN tunnels - those with tunnel outer transport type
> of UDP. Is there any reason why this was not done for non-UDP tunnels like
> GRE too ? This can avoid additional code in the driver ndo_features_check()
> to disable those flags for non-UDP tunnels.  Please let me know if I'm
> missing something here.
>
> The current code in vxlan_features_check() is this:
>         if ((l4_hdr == IPPROTO_UDP) &&
>             (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
>              skb->inner_protocol != htons(ETH_P_TEB) ||
>              (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
>               sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
>                 return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
>
> That should change to:
>         if (l4_hdr != IPPROTO_UDP ||
>             skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
>             skb->inner_protocol != htons(ETH_P_TEB) ||
>             (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
>             sizeof(struct udphdr) + sizeof(struct vxlanhdr)))
>                 return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
>
No, this isn't correct. vxlan_features_check is only commenting on
vxlan support. If a driver supports GRE GRO (NETIF_F_GSO_GRE is a
feature) and there are limitations then it can create it's own
features check.

> Thanks,
> -Harsha
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH 1/3] rtlwifi: btcoexist: Remove some unused functions
From: Rickard Strandqvist @ 2015-01-10 16:24 UTC (permalink / raw)
  To: Larry Finger, Chaoming Li
  Cc: Rickard Strandqvist, Kalle Valo, Greg Kroah-Hartman,
	Masanari Iida, Sachin Kamat, linux-wireless, netdev, linux-kernel

Removes some functions that are not used anywhere:
ex_halbtc8821a1ant_periodical() ex_halbtc8821a1ant_pnp_notify()
ex_halbtc8821a1ant_halt_notify() ex_halbtc8821a1ant_bt_info_notify()
ex_halbtc8821a1ant_special_packet_notify() ex_halbtc8821a1ant_connect_notify()
ex_halbtc8821a1ant_scan_notify() ex_halbtc8821a1ant_lps_notify()
ex_halbtc8821a1ant_ips_notify() ex_halbtc8821a1ant_display_coex_info()
ex_halbtc8821a1ant_init_coex_dm() ex_halbtc8821a1ant_init_hwconfig()

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 .../wireless/rtlwifi/btcoexist/halbtc8821a1ant.c   |  707 --------------------
 .../wireless/rtlwifi/btcoexist/halbtc8821a1ant.h   |   14 -
 2 files changed, 721 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.c b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.c
index b72e537..a86e6b6 100644
--- a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.c
+++ b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.c
@@ -2213,435 +2213,6 @@ static void halbtc8821a1ant_init_hw_config(struct btc_coexist *btcoexist,
 /*============================================================*/
 /* extern function start with EXhalbtc8821a1ant_*/
 /*============================================================*/
-void ex_halbtc8821a1ant_init_hwconfig(struct btc_coexist *btcoexist)
-{
-	halbtc8821a1ant_init_hw_config(btcoexist, true);
-}
-
-void ex_halbtc8821a1ant_init_coex_dm(struct btc_coexist *btcoexist)
-{
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-		  "[BTCoex], Coex Mechanism Init!!\n");
-
-	btcoexist->stop_coex_dm = false;
-
-	halbtc8821a1ant_init_coex_dm(btcoexist);
-
-	halbtc8821a1ant_query_bt_info(btcoexist);
-}
-
-void ex_halbtc8821a1ant_display_coex_info(struct btc_coexist *btcoexist)
-{
-	struct btc_board_info *board_info = &btcoexist->board_info;
-	struct btc_stack_info *stack_info = &btcoexist->stack_info;
-	struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
-	struct rtl_priv *rtlpriv = btcoexist->adapter;
-	u8 u1_tmp[4], i, bt_info_ext, ps_tdma_case = 0;
-	u16 u2_tmp[4];
-	u32 u4_tmp[4];
-	bool roam = false, scan = false, link = false, wifi_under_5g = false;
-	bool bt_hs_on = false, wifi_busy = false;
-	long wifi_rssi = 0, bt_hs_rssi = 0;
-	u32 wifi_bw, wifi_traffic_dir;
-	u8 wifi_dot11_chnl, wifi_hs_chnl;
-	u32 fw_ver = 0, bt_patch_ver = 0;
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n ============[BT Coexist info]============");
-
-	if (btcoexist->manual_control) {
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n ============[Under Manual Control]============");
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n ==========================================");
-	}
-	if (btcoexist->stop_coex_dm) {
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n ============[Coex is STOPPED]============");
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n ==========================================");
-	}
-
-	if (!board_info->bt_exist) {
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n BT not exists !!!");
-		return;
-	}
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d/ %d/ %d",
-		   "Ant PG Num/ Ant Mech/ Ant Pos:",
-		   board_info->pg_ant_num,
-		   board_info->btdm_ant_num,
-		   board_info->btdm_ant_pos);
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %s / %d", "BT stack/ hci ext ver",
-		   ((stack_info->profile_notified) ? "Yes" : "No"),
-		stack_info->hci_version);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER,
-			   &bt_patch_ver);
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d_%x/ 0x%x/ 0x%x(%d)",
-		   "CoexVer/ FwVer/ PatchVer",
-		   glcoex_ver_date_8821a_1ant,
-		   glcoex_ver_8821a_1ant,
-		   fw_ver, bt_patch_ver,
-		   bt_patch_ver);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION,
-			   &bt_hs_on);
-	btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_DOT11_CHNL,
-			   &wifi_dot11_chnl);
-	btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_HS_CHNL,
-			   &wifi_hs_chnl);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d / %d(%d)",
-		   "Dot11 channel / HsChnl(HsMode)",
-		   wifi_dot11_chnl, wifi_hs_chnl, bt_hs_on);
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %02x %02x %02x ",
-		   "H2C Wifi inform bt chnl Info",
-		   coex_dm->wifi_chnl_info[0], coex_dm->wifi_chnl_info[1],
-		   coex_dm->wifi_chnl_info[2]);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi);
-	btcoexist->btc_get(btcoexist, BTC_GET_S4_HS_RSSI, &bt_hs_rssi);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d/ %d", "Wifi rssi/ HS rssi",
-		   (int)wifi_rssi, (int)bt_hs_rssi);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d/ %d/ %d ", "Wifi link/ roam/ scan",
-		   link, roam, scan);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G,
-			   &wifi_under_5g);
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW,
-			   &wifi_bw);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY,
-			   &wifi_busy);
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION,
-			   &wifi_traffic_dir);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %s / %s/ %s ", "Wifi status",
-		   (wifi_under_5g ? "5G" : "2.4G"),
-		   ((BTC_WIFI_BW_LEGACY == wifi_bw) ? "Legacy" :
-		   (((BTC_WIFI_BW_HT40 == wifi_bw) ? "HT40" : "HT20"))),
-		   ((!wifi_busy) ? "idle" :
-		   ((BTC_WIFI_TRAFFIC_TX == wifi_traffic_dir) ?
-		   "uplink" : "downlink")));
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]",
-		   ((btcoexist->bt_info.bt_disabled) ? ("disabled") :
-		   ((coex_sta->c2h_bt_inquiry_page) ? ("inquiry/page scan") :
-		   ((BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE ==
-		     coex_dm->bt_status) ?
-		   "non-connected idle" :
-		   ((BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE ==
-		     coex_dm->bt_status) ?
-		   "connected-idle" : "busy")))),
-		   coex_sta->bt_rssi, coex_sta->bt_retry_cnt);
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP",
-		   bt_link_info->sco_exist,
-		   bt_link_info->hid_exist,
-		   bt_link_info->pan_exist,
-		   bt_link_info->a2dp_exist);
-	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_BT_LINK_INFO);
-
-	bt_info_ext = coex_sta->bt_info_ext;
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %s",
-		   "BT Info A2DP rate",
-		   (bt_info_ext&BIT0) ?
-		   "Basic rate" : "EDR rate");
-
-	for (i = 0; i < BT_INFO_SRC_8821A_1ANT_MAX; i++) {
-		if (coex_sta->bt_info_c2h_cnt[i]) {
-			RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-				   "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)",
-				   glbt_info_src_8821a_1ant[i],
-				   coex_sta->bt_info_c2h[i][0],
-				   coex_sta->bt_info_c2h[i][1],
-				   coex_sta->bt_info_c2h[i][2],
-				   coex_sta->bt_info_c2h[i][3],
-				   coex_sta->bt_info_c2h[i][4],
-				   coex_sta->bt_info_c2h[i][5],
-				   coex_sta->bt_info_c2h[i][6],
-				   coex_sta->bt_info_c2h_cnt[i]);
-		}
-	}
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %s/%s, (0x%x/0x%x)",
-		   "PS state, IPS/LPS, (lps/rpwm)",
-		   ((coex_sta->under_ips ? "IPS ON" : "IPS OFF")),
-		   ((coex_sta->under_Lps ? "LPS ON" : "LPS OFF")),
-		   btcoexist->bt_info.lps_val,
-		   btcoexist->bt_info.rpwm_val);
-	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
-
-	if (!btcoexist->manual_control) {
-		/* Sw mechanism*/
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s", "============[Sw mechanism]============");
-
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s = %d", "SM[LowPenaltyRA]",
-			   coex_dm->cur_low_penalty_ra);
-
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s = %s/ %s/ %d ",
-			   "DelBA/ BtCtrlAgg/ AggSize",
-			   (btcoexist->bt_info.reject_agg_pkt ? "Yes" : "No"),
-			   (btcoexist->bt_info.bt_ctrl_buf_size ? "Yes" : "No"),
-			   btcoexist->bt_info.agg_buf_size);
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s = 0x%x ", "Rate Mask",
-			   btcoexist->bt_info.ra_mask);
-
-		/* Fw mechanism*/
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s",
-			   "============[Fw mechanism]============");
-
-		ps_tdma_case = coex_dm->cur_ps_tdma;
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)",
-			   "PS TDMA",
-			   coex_dm->ps_tdma_para[0],
-			   coex_dm->ps_tdma_para[1],
-			   coex_dm->ps_tdma_para[2],
-			   coex_dm->ps_tdma_para[3],
-			   coex_dm->ps_tdma_para[4],
-			   ps_tdma_case,
-			   coex_dm->auto_tdma_adjust);
-
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s = 0x%x ",
-			   "Latest error condition(should be 0)",
-			   coex_dm->error_condition);
-
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s = %d ", "IgnWlanAct",
-			   coex_dm->cur_ignore_wlan_act);
-	}
-
-	/* Hw setting*/
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s", "============[Hw setting]============");
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x",
-		   "backup ARFR1/ARFR2/RL/AMaxTime",
-		   coex_dm->backup_arfr_cnt1,
-		   coex_dm->backup_arfr_cnt2,
-		   coex_dm->backup_retry_limit,
-		   coex_dm->backup_ampdu_max_time);
-
-	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x430);
-	u4_tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x434);
-	u2_tmp[0] = btcoexist->btc_read_2byte(btcoexist, 0x42a);
-	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x456);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x",
-		   "0x430/0x434/0x42a/0x456",
-		   u4_tmp[0], u4_tmp[1], u2_tmp[0], u1_tmp[0]);
-
-	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x778);
-	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc58);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x/ 0x%x", "0x778/ 0xc58[29:25]",
-		   u1_tmp[0], (u4_tmp[0]&0x3e000000) >> 25);
-
-	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x8db);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x", "0x8db[6:5]",
-		   ((u1_tmp[0]&0x60)>>5));
-
-	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x975);
-	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xcb4);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x/ 0x%x/ 0x%x",
-		   "0xcb4[29:28]/0xcb4[7:0]/0x974[9:8]",
-		   (u4_tmp[0] & 0x30000000)>>28,
-		    u4_tmp[0] & 0xff,
-		    u1_tmp[0] & 0x3);
-
-	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x40);
-	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x4c);
-	u1_tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0x64);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x/ 0x%x/ 0x%x",
-		   "0x40/0x4c[24:23]/0x64[0]",
-		   u1_tmp[0], ((u4_tmp[0]&0x01800000)>>23), u1_tmp[1]&0x1);
-
-	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x550);
-	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x522);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x/ 0x%x", "0x550(bcn ctrl)/0x522",
-		   u4_tmp[0], u1_tmp[0]);
-
-	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc50);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x", "0xc50(dig)",
-		   u4_tmp[0]&0xff);
-
-	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xf48);
-	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0xa5d);
-	u1_tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0xa5c);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x/ 0x%x", "OFDM-FA/ CCK-FA",
-		   u4_tmp[0], (u1_tmp[0]<<8) + u1_tmp[1]);
-
-	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x6c0);
-	u4_tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x6c4);
-	u4_tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0x6c8);
-	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x6cc);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x",
-		   "0x6c0/0x6c4/0x6c8/0x6cc(coexTable)",
-		   u4_tmp[0], u4_tmp[1], u4_tmp[2], u1_tmp[0]);
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d/ %d", "0x770(high-pri rx/tx)",
-		   coex_sta->high_priority_rx, coex_sta->high_priority_tx);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d/ %d", "0x774(low-pri rx/tx)",
-		   coex_sta->low_priority_rx, coex_sta->low_priority_tx);
-#if (BT_AUTO_REPORT_ONLY_8821A_1ANT == 1)
-	halbtc8821a1ant_monitor_bt_ctr(btcoexist);
-#endif
-	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-void ex_halbtc8821a1ant_ips_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	if (btcoexist->manual_control || btcoexist->stop_coex_dm)
-		return;
-
-	if (BTC_IPS_ENTER == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], IPS ENTER notify\n");
-		coex_sta->under_ips = true;
-		halbtc8821a1ant_set_ant_path(btcoexist,
-					     BTC_ANT_PATH_BT, false, true);
-		/*set PTA control*/
-		halbtc8821a1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 8);
-		halbtc8821a1ant_coex_table_with_type(btcoexist,
-						     NORMAL_EXEC, 0);
-	} else if (BTC_IPS_LEAVE == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], IPS LEAVE notify\n");
-		coex_sta->under_ips = false;
-
-		halbtc8821a1ant_run_coexist_mechanism(btcoexist);
-	}
-}
-
-void ex_halbtc8821a1ant_lps_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	if (btcoexist->manual_control || btcoexist->stop_coex_dm)
-		return;
-
-	if (BTC_LPS_ENABLE == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], LPS ENABLE notify\n");
-		coex_sta->under_Lps = true;
-	} else if (BTC_LPS_DISABLE == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], LPS DISABLE notify\n");
-		coex_sta->under_Lps = false;
-	}
-}
-
-void ex_halbtc8821a1ant_scan_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	bool wifi_connected = false, bt_hs_on = false;
-
-	if (btcoexist->manual_control ||
-	    btcoexist->stop_coex_dm ||
-	    btcoexist->bt_info.bt_disabled)
-		return;
-
-	btcoexist->btc_get(btcoexist,
-		 BTC_GET_BL_HS_OPERATION, &bt_hs_on);
-	btcoexist->btc_get(btcoexist,
-		 BTC_GET_BL_WIFI_CONNECTED, &wifi_connected);
-
-	halbtc8821a1ant_query_bt_info(btcoexist);
-
-	if (coex_sta->c2h_bt_inquiry_page) {
-		halbtc8821a1ant_action_bt_inquiry(btcoexist);
-		return;
-	} else if (bt_hs_on) {
-		halbtc8821a1ant_action_hs(btcoexist);
-		return;
-	}
-
-	if (BTC_SCAN_START == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], SCAN START notify\n");
-		if (!wifi_connected) {
-			/* non-connected scan*/
-			btc8821a1ant_act_wifi_not_conn_scan(btcoexist);
-		} else {
-			/* wifi is connected*/
-			halbtc8821a1ant_action_wifi_connected_scan(btcoexist);
-		}
-	} else if (BTC_SCAN_FINISH == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], SCAN FINISH notify\n");
-		if (!wifi_connected) {
-			/* non-connected scan*/
-			halbtc8821a1ant_action_wifi_not_connected(btcoexist);
-		} else {
-			halbtc8821a1ant_action_wifi_connected(btcoexist);
-		}
-	}
-}
-
-void ex_halbtc8821a1ant_connect_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	bool	wifi_connected = false, bt_hs_on = false;
-
-	if (btcoexist->manual_control ||
-	    btcoexist->stop_coex_dm ||
-	    btcoexist->bt_info.bt_disabled)
-		return;
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on);
-	if (coex_sta->c2h_bt_inquiry_page) {
-		halbtc8821a1ant_action_bt_inquiry(btcoexist);
-		return;
-	} else if (bt_hs_on) {
-		halbtc8821a1ant_action_hs(btcoexist);
-		return;
-	}
-
-	if (BTC_ASSOCIATE_START == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], CONNECT START notify\n");
-		btc8821a1ant_act_wifi_not_conn_scan(btcoexist);
-	} else if (BTC_ASSOCIATE_FINISH == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], CONNECT FINISH notify\n");
-
-		btcoexist->btc_get(btcoexist,
-			 BTC_GET_BL_WIFI_CONNECTED, &wifi_connected);
-		if (!wifi_connected) {
-			/* non-connected scan*/
-			halbtc8821a1ant_action_wifi_not_connected(btcoexist);
-		} else {
-			halbtc8821a1ant_action_wifi_connected(btcoexist);
-		}
-	}
-}
 
 void ex_halbtc8821a1ant_media_status_notify(struct btc_coexist *btcoexist,
 					    u8 type)
@@ -2690,281 +2261,3 @@ void ex_halbtc8821a1ant_media_status_notify(struct btc_coexist *btcoexist,
 	btcoexist->btc_fill_h2c(btcoexist, 0x66, 3, h2c_parameter);
 }
 
-void ex_halbtc8821a1ant_special_packet_notify(struct btc_coexist *btcoexist,
-					      u8 type)
-{
-	bool bt_hs_on = false;
-
-	if (btcoexist->manual_control ||
-	    btcoexist->stop_coex_dm ||
-	    btcoexist->bt_info.bt_disabled)
-		return;
-
-	coex_sta->special_pkt_period_cnt = 0;
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on);
-	if (coex_sta->c2h_bt_inquiry_page) {
-		halbtc8821a1ant_action_bt_inquiry(btcoexist);
-		return;
-	} else if (bt_hs_on) {
-		halbtc8821a1ant_action_hs(btcoexist);
-		return;
-	}
-
-	if (BTC_PACKET_DHCP == type ||
-	    BTC_PACKET_EAPOL == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], special Packet(%d) notify\n", type);
-		btc8821a1ant_act_wifi_conn_sp_pkt(btcoexist);
-	}
-}
-
-void ex_halbtc8821a1ant_bt_info_notify(struct btc_coexist *btcoexist,
-				       u8 *tmp_buf, u8 length)
-{
-	u8 bt_info = 0;
-	u8 i, rsp_source = 0;
-	bool wifi_connected = false;
-	bool bt_busy = false;
-	bool wifi_under_5g = false;
-
-	coex_sta->c2h_bt_info_req_sent = false;
-
-	btcoexist->btc_get(btcoexist,
-		 BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g);
-
-	rsp_source = tmp_buf[0]&0xf;
-	if (rsp_source >= BT_INFO_SRC_8821A_1ANT_MAX)
-		rsp_source = BT_INFO_SRC_8821A_1ANT_WIFI_FW;
-	coex_sta->bt_info_c2h_cnt[rsp_source]++;
-
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-		  "[BTCoex], Bt info[%d], length = %d, hex data = [",
-		  rsp_source, length);
-	for (i = 0; i < length; i++) {
-		coex_sta->bt_info_c2h[rsp_source][i] = tmp_buf[i];
-		if (i == 1)
-			bt_info = tmp_buf[i];
-		if (i == length-1) {
-			BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-				  "0x%02x]\n", tmp_buf[i]);
-		} else {
-			BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-				  "0x%02x, ", tmp_buf[i]);
-		}
-	}
-
-	if (BT_INFO_SRC_8821A_1ANT_WIFI_FW != rsp_source) {
-		coex_sta->bt_retry_cnt =	/* [3:0]*/
-			coex_sta->bt_info_c2h[rsp_source][2]&0xf;
-
-		coex_sta->bt_rssi =
-			coex_sta->bt_info_c2h[rsp_source][3]*2+10;
-
-		coex_sta->bt_info_ext =
-			coex_sta->bt_info_c2h[rsp_source][4];
-
-		/* Here we need to resend some wifi info to BT*/
-		/* because bt is reset and loss of the info.*/
-		if (coex_sta->bt_info_ext & BIT1) {
-			BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-				  "[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n");
-			btcoexist->btc_get(btcoexist,
-					   BTC_GET_BL_WIFI_CONNECTED,
-					   &wifi_connected);
-			if (wifi_connected) {
-				ex_halbtc8821a1ant_media_status_notify(btcoexist,
-							       BTC_MEDIA_CONNECT);
-			} else {
-				ex_halbtc8821a1ant_media_status_notify(btcoexist,
-							       BTC_MEDIA_DISCONNECT);
-			}
-		}
-
-		if ((coex_sta->bt_info_ext & BIT3) && !wifi_under_5g) {
-			if (!btcoexist->manual_control &&
-			    !btcoexist->stop_coex_dm) {
-				BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-					  "[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n");
-				halbtc8821a1ant_ignore_wlan_act(btcoexist,
-								FORCE_EXEC,
-								false);
-			}
-		}
-#if (BT_AUTO_REPORT_ONLY_8821A_1ANT == 0)
-		if (!(coex_sta->bt_info_ext & BIT4)) {
-			BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-				  "[BTCoex], BT ext info bit4 check, set BT to enable Auto Report!!\n");
-			halbtc8821a1ant_bt_auto_report(btcoexist,
-						       FORCE_EXEC, true);
-		}
-#endif
-	}
-
-	/* check BIT2 first ==> check if bt is under inquiry or page scan*/
-	if (bt_info & BT_INFO_8821A_1ANT_B_INQ_PAGE)
-		coex_sta->c2h_bt_inquiry_page = true;
-	else
-		coex_sta->c2h_bt_inquiry_page = false;
-
-	/* set link exist status*/
-	if (!(bt_info&BT_INFO_8821A_1ANT_B_CONNECTION)) {
-		coex_sta->bt_link_exist = false;
-		coex_sta->pan_exist = false;
-		coex_sta->a2dp_exist = false;
-		coex_sta->hid_exist = false;
-		coex_sta->sco_exist = false;
-	} else {
-		/* connection exists*/
-		coex_sta->bt_link_exist = true;
-		if (bt_info & BT_INFO_8821A_1ANT_B_FTP)
-			coex_sta->pan_exist = true;
-		else
-			coex_sta->pan_exist = false;
-		if (bt_info & BT_INFO_8821A_1ANT_B_A2DP)
-			coex_sta->a2dp_exist = true;
-		else
-			coex_sta->a2dp_exist = false;
-		if (bt_info & BT_INFO_8821A_1ANT_B_HID)
-			coex_sta->hid_exist = true;
-		else
-			coex_sta->hid_exist = false;
-		if (bt_info & BT_INFO_8821A_1ANT_B_SCO_ESCO)
-			coex_sta->sco_exist = true;
-		else
-			coex_sta->sco_exist = false;
-	}
-
-	halbtc8821a1ant_update_bt_link_info(btcoexist);
-
-	if (!(bt_info&BT_INFO_8821A_1ANT_B_CONNECTION)) {
-		coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE;
-		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-			  "[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n");
-	} else if (bt_info == BT_INFO_8821A_1ANT_B_CONNECTION) {
-		/* connection exists but no busy*/
-		coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE;
-		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-			  "[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n");
-	} else if ((bt_info&BT_INFO_8821A_1ANT_B_SCO_ESCO) ||
-		(bt_info&BT_INFO_8821A_1ANT_B_SCO_BUSY)) {
-		coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_SCO_BUSY;
-		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-			  "[BTCoex], BtInfoNotify(), BT SCO busy!!!\n");
-	} else if (bt_info&BT_INFO_8821A_1ANT_B_ACL_BUSY) {
-		if (BT_8821A_1ANT_BT_STATUS_ACL_BUSY != coex_dm->bt_status)
-			coex_dm->auto_tdma_adjust = false;
-		coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_ACL_BUSY;
-		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-			  "[BTCoex], BtInfoNotify(), BT ACL busy!!!\n");
-	} else {
-		coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_MAX;
-		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-			  "[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n");
-	}
-
-	if ((BT_8821A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) ||
-	    (BT_8821A_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) ||
-	    (BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status))
-		bt_busy = true;
-	else
-		bt_busy = false;
-	btcoexist->btc_set(btcoexist,
-			   BTC_SET_BL_BT_TRAFFIC_BUSY, &bt_busy);
-
-	halbtc8821a1ant_run_coexist_mechanism(btcoexist);
-}
-
-void ex_halbtc8821a1ant_halt_notify(struct btc_coexist *btcoexist)
-{
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-		  "[BTCoex], Halt notify\n");
-
-	btcoexist->stop_coex_dm = true;
-
-	halbtc8821a1ant_set_ant_path(btcoexist,
-				     BTC_ANT_PATH_BT, false, true);
-	halbtc8821a1ant_ignore_wlan_act(btcoexist, FORCE_EXEC, true);
-
-	halbtc8821a1ant_power_save_state(btcoexist,
-					 BTC_PS_WIFI_NATIVE, 0x0, 0x0);
-	halbtc8821a1ant_ps_tdma(btcoexist, FORCE_EXEC, false, 0);
-
-	ex_halbtc8821a1ant_media_status_notify(btcoexist,
-					       BTC_MEDIA_DISCONNECT);
-}
-
-void ex_halbtc8821a1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state)
-{
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-		  "[BTCoex], Pnp notify\n");
-
-	if (BTC_WIFI_PNP_SLEEP == pnp_state) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], Pnp notify to SLEEP\n");
-		btcoexist->stop_coex_dm = true;
-		halbtc8821a1ant_ignore_wlan_act(btcoexist, FORCE_EXEC, true);
-		halbtc8821a1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
-						 0x0, 0x0);
-		halbtc8821a1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 9);
-	} else if (BTC_WIFI_PNP_WAKE_UP == pnp_state) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], Pnp notify to WAKE UP\n");
-		btcoexist->stop_coex_dm = false;
-		halbtc8821a1ant_init_hw_config(btcoexist, false);
-		halbtc8821a1ant_init_coex_dm(btcoexist);
-		halbtc8821a1ant_query_bt_info(btcoexist);
-	}
-}
-
-void
-ex_halbtc8821a1ant_periodical(
-	struct btc_coexist *btcoexist) {
-	static u8	dis_ver_info_cnt;
-	u32		fw_ver = 0, bt_patch_ver = 0;
-	struct btc_board_info *board_info = &btcoexist->board_info;
-	struct btc_stack_info *stack_info = &btcoexist->stack_info;
-
-	BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-		  "[BTCoex], ==========================Periodical===========================\n");
-
-	if (dis_ver_info_cnt <= 5) {
-		dis_ver_info_cnt += 1;
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], ****************************************************************\n");
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], Ant PG Num/ Ant Mech/ Ant Pos = %d/ %d/ %d\n",
-			  board_info->pg_ant_num,
-			  board_info->btdm_ant_num,
-			  board_info->btdm_ant_pos);
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], BT stack/ hci ext ver = %s / %d\n",
-			  ((stack_info->profile_notified) ? "Yes" : "No"),
-			  stack_info->hci_version);
-		btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER,
-				   &bt_patch_ver);
-		btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], CoexVer/ FwVer/ PatchVer = %d_%x/ 0x%x/ 0x%x(%d)\n",
-			glcoex_ver_date_8821a_1ant,
-			glcoex_ver_8821a_1ant,
-			fw_ver, bt_patch_ver,
-			bt_patch_ver);
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], ****************************************************************\n");
-	}
-
-#if (BT_AUTO_REPORT_ONLY_8821A_1ANT == 0)
-	halbtc8821a1ant_query_bt_info(btcoexist);
-	halbtc8821a1ant_monitor_bt_ctr(btcoexist);
-	btc8821a1ant_mon_bt_en_dis(btcoexist);
-#else
-	if (halbtc8821a1ant_Is_wifi_status_changed(btcoexist) ||
-	    coex_dm->auto_tdma_adjust) {
-		if (coex_sta->special_pkt_period_cnt > 2)
-			halbtc8821a1ant_run_coexist_mechanism(btcoexist);
-	}
-
-	coex_sta->special_pkt_period_cnt++;
-#endif
-}
diff --git a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.h b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.h
index 20e9048..c3eab15 100644
--- a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.h
+++ b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.h
@@ -168,21 +168,7 @@ struct coex_sta_8821a_1ant {
  * The following is interface which will notify coex module.
  *===========================================
  */
-void ex_halbtc8821a1ant_init_hwconfig(struct btc_coexist *btcoexist);
-void ex_halbtc8821a1ant_init_coex_dm(struct btc_coexist *btcoexist);
-void ex_halbtc8821a1ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
-void ex_halbtc8821a1ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
-void ex_halbtc8821a1ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
-void ex_halbtc8821a1ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
 void ex_halbtc8821a1ant_media_status_notify(struct btc_coexist *btcoexist,
 					    u8 type);
-void ex_halbtc8821a1ant_special_packet_notify(struct btc_coexist *btcoexist,
-					      u8 type);
-void ex_halbtc8821a1ant_bt_info_notify(struct btc_coexist *btcoexist,
-				       u8 *tmpbuf, u8 length);
-void ex_halbtc8821a1ant_halt_notify(struct btc_coexist *btcoexist);
-void ex_halbtc8821a1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnpstate);
-void ex_halbtc8821a1ant_periodical(struct btc_coexist *btcoexist);
-void ex_halbtc8821a1ant_display_coex_info(struct btc_coexist *btcoexist);
 void ex_halbtc8821a1ant_dbg_control(struct btc_coexist *btcoexist, u8 op_code,
 				    u8 op_len, u8 *data);
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH 2/3] rtlwifi: btcoexist: Remove some unused functions
From: Rickard Strandqvist @ 2015-01-10 16:24 UTC (permalink / raw)
  To: Larry Finger, Chaoming Li
  Cc: Rickard Strandqvist, Kalle Valo, Greg Kroah-Hartman,
	Masanari Iida, Sachin Kamat,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1420907079-27102-1-git-send-email-rickard_strandqvist-IW2WV5XWFqGZkjO+N0TKoMugMpMbD5Xr@public.gmane.org>

Removes some functions that are not used anywhere:
ex_halbtc8723b1ant_periodical() ex_halbtc8723b1ant_coex_dm_reset()
ex_halbtc8723b1ant_pnp_notify() ex_halbtc8723b1ant_halt_notify()
ex_halbtc8723b1ant_bt_info_notify() ex_halbtc8723b1ant_special_packet_notify()
ex_halbtc8723b1ant_connect_notify() ex_halbtc8723b1ant_scan_notify()
ex_halbtc8723b1ant_lps_notify() ex_halbtc8723b1ant_ips_notify()
ex_halbtc8723b1ant_display_coex_info() ex_halbtc8723b1ant_init_coex_dm()
ex_halbtc8723b1ant_init_hwconfig()

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist-IW2WV5XWFqGZkjO+N0TKoMugMpMbD5Xr@public.gmane.org>
---
 .../wireless/rtlwifi/btcoexist/halbtc8723b1ant.c   |  748 --------------------
 .../wireless/rtlwifi/btcoexist/halbtc8723b1ant.h   |   15 -
 2 files changed, 763 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b1ant.c b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b1ant.c
index c4acd40..f4245dc 100644
--- a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b1ant.c
+++ b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b1ant.c
@@ -2376,457 +2376,6 @@ static void halbtc8723b1ant_wifi_off_hw_cfg(struct btc_coexist *btcoexist)
  * extern function start with EXhalbtc8723b1ant_
  **************************************************************/
 
-void ex_halbtc8723b1ant_init_hwconfig(struct btc_coexist *btcoexist)
-{
-	halbtc8723b1ant_init_hw_config(btcoexist, true);
-}
-
-void ex_halbtc8723b1ant_init_coex_dm(struct btc_coexist *btcoexist)
-{
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-		  "[BTCoex], Coex Mechanism Init!!\n");
-
-	btcoexist->stop_coex_dm = false;
-
-	halbtc8723b1ant_init_coex_dm(btcoexist);
-
-	halbtc8723b1ant_query_bt_info(btcoexist);
-}
-
-void ex_halbtc8723b1ant_display_coex_info(struct btc_coexist *btcoexist)
-{
-	struct btc_board_info *board_info = &btcoexist->board_info;
-	struct btc_stack_info *stack_info = &btcoexist->stack_info;
-	struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
-	struct rtl_priv *rtlpriv = btcoexist->adapter;
-	u8 u8tmp[4], i, bt_info_ext, pstdmacase = 0;
-	u16 u16tmp[4];
-	u32 u32tmp[4];
-	bool roam = false, scan = false;
-	bool link = false, wifi_under_5g = false;
-	bool bt_hs_on = false, wifi_busy = false;
-	s32 wifi_rssi = 0, bt_hs_rssi = 0;
-	u32 wifi_bw, wifi_traffic_dir, fa_ofdm, fa_cck, wifi_link_status;
-	u8 wifi_dot11_chnl, wifi_hs_chnl;
-	u32 fw_ver = 0, bt_patch_ver = 0;
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n ============[BT Coexist info]============");
-
-	if (btcoexist->manual_control) {
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n ============[Under Manual Control]==========");
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n ==========================================");
-	}
-	if (btcoexist->stop_coex_dm) {
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n ============[Coex is STOPPED]============");
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n ==========================================");
-	}
-
-	if (!board_info->bt_exist) {
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n BT not exists !!!");
-		return;
-	}
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d/ %d/ %d",
-		   "Ant PG Num/ Ant Mech/ Ant Pos:",
-		   board_info->pg_ant_num, board_info->btdm_ant_num,
-		   board_info->btdm_ant_pos);
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %s / %d",
-		   "BT stack/ hci ext ver",
-		   ((stack_info->profile_notified) ? "Yes" : "No"),
-		   stack_info->hci_version);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER, &bt_patch_ver);
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d_%x/ 0x%x/ 0x%x(%d)",
-		   "CoexVer/ FwVer/ PatchVer",
-		   glcoex_ver_date_8723b_1ant, glcoex_ver_8723b_1ant,
-		   fw_ver, bt_patch_ver, bt_patch_ver);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on);
-	btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_DOT11_CHNL,
-			   &wifi_dot11_chnl);
-	btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_HS_CHNL, &wifi_hs_chnl);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d / %d(%d)",
-		   "Dot11 channel / HsChnl(HsMode)",
-		   wifi_dot11_chnl, wifi_hs_chnl, bt_hs_on);
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %02x %02x %02x ",
-		   "H2C Wifi inform bt chnl Info",
-		   coex_dm->wifi_chnl_info[0], coex_dm->wifi_chnl_info[1],
-		   coex_dm->wifi_chnl_info[2]);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi);
-	btcoexist->btc_get(btcoexist, BTC_GET_S4_HS_RSSI, &bt_hs_rssi);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d/ %d",
-		   "Wifi rssi/ HS rssi", wifi_rssi, bt_hs_rssi);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d/ %d/ %d ",
-		   "Wifi link/ roam/ scan", link, roam, scan);
-
-	btcoexist->btc_get(btcoexist , BTC_GET_BL_WIFI_UNDER_5G,
-			   &wifi_under_5g);
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy);
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION,
-			   &wifi_traffic_dir);
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %s / %s/ %s ",
-		   "Wifi status", (wifi_under_5g ? "5G" : "2.4G"),
-		   ((BTC_WIFI_BW_LEGACY == wifi_bw) ? "Legacy" :
-			(((BTC_WIFI_BW_HT40 == wifi_bw) ? "HT40" : "HT20"))),
-		   ((!wifi_busy) ? "idle" :
-			((BTC_WIFI_TRAFFIC_TX == wifi_traffic_dir) ?
-				"uplink" : "downlink")));
-
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS,
-			   &wifi_link_status);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d/ %d/ %d/ %d/ %d",
-		   "sta/vwifi/hs/p2pGo/p2pGc",
-		   ((wifi_link_status & WIFI_STA_CONNECTED) ? 1 : 0),
-		   ((wifi_link_status & WIFI_AP_CONNECTED) ? 1 : 0),
-		   ((wifi_link_status & WIFI_HS_CONNECTED) ? 1 : 0),
-		   ((wifi_link_status & WIFI_P2P_GO_CONNECTED) ? 1 : 0),
-		   ((wifi_link_status & WIFI_P2P_GC_CONNECTED) ? 1 : 0));
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = [%s/ %d/ %d] ",
-		   "BT [status/ rssi/ retryCnt]",
-		   ((btcoexist->bt_info.bt_disabled) ? ("disabled") :
-		    ((coex_sta->c2h_bt_inquiry_page) ? ("inquiry/page scan") :
-		     ((BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE ==
-		       coex_dm->bt_status) ?
-		      "non-connected idle" :
-		      ((BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE ==
-			coex_dm->bt_status) ?
-		       "connected-idle" : "busy")))),
-		     coex_sta->bt_rssi, coex_sta->bt_retry_cnt);
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %d / %d / %d / %d",
-		   "SCO/HID/PAN/A2DP", bt_link_info->sco_exist,
-		   bt_link_info->hid_exist, bt_link_info->pan_exist,
-		   bt_link_info->a2dp_exist);
-	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_BT_LINK_INFO);
-
-	bt_info_ext = coex_sta->bt_info_ext;
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %s",
-		   "BT Info A2DP rate",
-		   (bt_info_ext & BIT0) ? "Basic rate" : "EDR rate");
-
-	for (i = 0; i < BT_INFO_SRC_8723B_1ANT_MAX; i++) {
-		if (coex_sta->bt_info_c2h_cnt[i]) {
-			RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-				   "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)",
-				   GLBtInfoSrc8723b1Ant[i],
-				   coex_sta->bt_info_c2h[i][0],
-				   coex_sta->bt_info_c2h[i][1],
-				   coex_sta->bt_info_c2h[i][2],
-				   coex_sta->bt_info_c2h[i][3],
-				   coex_sta->bt_info_c2h[i][4],
-				   coex_sta->bt_info_c2h[i][5],
-				   coex_sta->bt_info_c2h[i][6],
-				   coex_sta->bt_info_c2h_cnt[i]);
-		}
-	}
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = %s/%s, (0x%x/0x%x)",
-		   "PS state, IPS/LPS, (lps/rpwm)",
-		   ((coex_sta->under_ips ? "IPS ON" : "IPS OFF")),
-		   ((coex_sta->under_lps ? "LPS ON" : "LPS OFF")),
-		   btcoexist->bt_info.lps_val,
-		   btcoexist->bt_info.rpwm_val);
-	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
-
-	if (!btcoexist->manual_control) {
-		/* Sw mechanism	*/
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s",
-			   "============[Sw mechanism]============");
-
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d/",
-			   "SM[LowPenaltyRA]", coex_dm->cur_low_penalty_ra);
-
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %s/ %s/ %d ",
-			   "DelBA/ BtCtrlAgg/ AggSize",
-			   (btcoexist->bt_info.reject_agg_pkt ? "Yes" : "No"),
-			   (btcoexist->bt_info.bt_ctrl_buf_size ? "Yes" : "No"),
-			   btcoexist->bt_info.agg_buf_size);
-
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x ",
-			   "Rate Mask", btcoexist->bt_info.ra_mask);
-
-		/* Fw mechanism	*/
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s",
-			   "============[Fw mechanism]============");
-
-		pstdmacase = coex_dm->cur_ps_tdma;
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-			   "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)",
-			   "PS TDMA", coex_dm->ps_tdma_para[0],
-			   coex_dm->ps_tdma_para[1], coex_dm->ps_tdma_para[2],
-			   coex_dm->ps_tdma_para[3], coex_dm->ps_tdma_para[4],
-			   pstdmacase, coex_dm->auto_tdma_adjust);
-
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d ",
-			   "IgnWlanAct", coex_dm->cur_ignore_wlan_act);
-
-		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x ",
-			   "Latest error condition(should be 0)",
-			   coex_dm->error_condition);
-	}
-
-	/* Hw setting */
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s",
-		   "============[Hw setting]============");
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x",
-		   "backup ARFR1/ARFR2/RL/AMaxTime", coex_dm->backup_arfr_cnt1,
-		   coex_dm->backup_arfr_cnt2, coex_dm->backup_retry_limit,
-		   coex_dm->backup_ampdu_max_time);
-
-	u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x430);
-	u32tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x434);
-	u16tmp[0] = btcoexist->btc_read_2byte(btcoexist, 0x42a);
-	u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x456);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x",
-		   "0x430/0x434/0x42a/0x456",
-		   u32tmp[0], u32tmp[1], u16tmp[0], u8tmp[0]);
-
-	u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x778);
-	u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x6cc);
-	u32tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x880);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x",
-		   "0x778/0x6cc/0x880[29:25]", u8tmp[0], u32tmp[0],
-		   (u32tmp[1] & 0x3e000000) >> 25);
-
-	u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x948);
-	u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x67);
-	u8tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0x765);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x",
-		   "0x948/ 0x67[5] / 0x765",
-		   u32tmp[0], ((u8tmp[0] & 0x20) >> 5), u8tmp[1]);
-
-	u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x92c);
-	u32tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x930);
-	u32tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0x944);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x",
-		   "0x92c[1:0]/ 0x930[7:0]/0x944[1:0]",
-		   u32tmp[0] & 0x3, u32tmp[1] & 0xff, u32tmp[2] & 0x3);
-
-	u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x39);
-	u8tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0x40);
-	u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x4c);
-	u8tmp[2] = btcoexist->btc_read_1byte(btcoexist, 0x64);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-		   "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x",
-		   "0x38[11]/0x40/0x4c[24:23]/0x64[0]",
-		   ((u8tmp[0] & 0x8)>>3), u8tmp[1],
-		   ((u32tmp[0] & 0x01800000) >> 23), u8tmp[2] & 0x1);
-
-	u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x550);
-	u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x522);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x",
-		   "0x550(bcn ctrl)/0x522", u32tmp[0], u8tmp[0]);
-
-	u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc50);
-	u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x49c);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x",
-		   "0xc50(dig)/0x49c(null-drop)", u32tmp[0] & 0xff, u8tmp[0]);
-
-	u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xda0);
-	u32tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0xda4);
-	u32tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0xda8);
-	u32tmp[3] = btcoexist->btc_read_4byte(btcoexist, 0xcf0);
-
-	u8tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0xa5b);
-	u8tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0xa5c);
-
-	fa_ofdm = ((u32tmp[0] & 0xffff0000) >> 16) +
-		  ((u32tmp[1] & 0xffff0000) >> 16) +
-		   (u32tmp[1] & 0xffff) +
-		   (u32tmp[2] & 0xffff) +
-		  ((u32tmp[3] & 0xffff0000) >> 16) +
-		   (u32tmp[3] & 0xffff);
-	fa_cck = (u8tmp[0] << 8) + u8tmp[1];
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x",
-		   "OFDM-CCA/OFDM-FA/CCK-FA",
-		   u32tmp[0] & 0xffff, fa_ofdm, fa_cck);
-
-	u32tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x6c0);
-	u32tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x6c4);
-	u32tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0x6c8);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x",
-		   "0x6c0/0x6c4/0x6c8(coexTable)",
-		   u32tmp[0], u32tmp[1], u32tmp[2]);
-
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d/ %d",
-		   "0x770(high-pri rx/tx)", coex_sta->high_priority_rx,
-		   coex_sta->high_priority_tx);
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d/ %d",
-		   "0x774(low-pri rx/tx)", coex_sta->low_priority_rx,
-		   coex_sta->low_priority_tx);
-#if (BT_AUTO_REPORT_ONLY_8723B_1ANT == 1)
-	halbtc8723b1ant_monitor_bt_ctr(btcoexist);
-#endif
-	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_COEX_STATISTICS);
-}
-
-void ex_halbtc8723b1ant_ips_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	if (btcoexist->manual_control || btcoexist->stop_coex_dm)
-		return;
-
-	if (BTC_IPS_ENTER == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], IPS ENTER notify\n");
-		coex_sta->under_ips = true;
-
-		halbtc8723b1ant_SetAntPath(btcoexist, BTC_ANT_PATH_BT,
-					   false, true);
-		/* set PTA control */
-		halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 0);
-		halbtc8723b1ant_coex_table_with_type(btcoexist,
-						     NORMAL_EXEC, 0);
-		halbtc8723b1ant_wifi_off_hw_cfg(btcoexist);
-	} else if (BTC_IPS_LEAVE == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], IPS LEAVE notify\n");
-		coex_sta->under_ips = false;
-
-		halbtc8723b1ant_init_hw_config(btcoexist, false);
-		halbtc8723b1ant_init_coex_dm(btcoexist);
-		halbtc8723b1ant_query_bt_info(btcoexist);
-	}
-}
-
-void ex_halbtc8723b1ant_lps_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	if (btcoexist->manual_control || btcoexist->stop_coex_dm)
-		return;
-
-	if (BTC_LPS_ENABLE == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], LPS ENABLE notify\n");
-		coex_sta->under_lps = true;
-	} else if (BTC_LPS_DISABLE == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], LPS DISABLE notify\n");
-		coex_sta->under_lps = false;
-	}
-}
-
-void ex_halbtc8723b1ant_scan_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	bool wifi_connected = false, bt_hs_on = false;
-	u32 wifi_link_status = 0;
-	u32 num_of_wifi_link = 0;
-	bool bt_ctrl_agg_buf_size = false;
-	u8 agg_buf_size = 5;
-
-	if (btcoexist->manual_control || btcoexist->stop_coex_dm ||
-	    btcoexist->bt_info.bt_disabled)
-		return;
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED,
-			   &wifi_connected);
-
-	halbtc8723b1ant_query_bt_info(btcoexist);
-
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS,
-			   &wifi_link_status);
-	num_of_wifi_link = wifi_link_status >> 16;
-	if (num_of_wifi_link >= 2) {
-		halbtc8723b1ant_limited_tx(btcoexist, NORMAL_EXEC, 0, 0, 0, 0);
-		halbtc8723b1ant_limited_rx(btcoexist, NORMAL_EXEC, false,
-					   bt_ctrl_agg_buf_size, agg_buf_size);
-		halbtc8723b1ant_action_wifi_multiport(btcoexist);
-		return;
-	}
-
-	if (coex_sta->c2h_bt_inquiry_page) {
-		halbtc8723b1ant_action_bt_inquiry(btcoexist);
-		return;
-	} else if (bt_hs_on) {
-		halbtc8723b1ant_action_hs(btcoexist);
-		return;
-	}
-
-	if (BTC_SCAN_START == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], SCAN START notify\n");
-		if (!wifi_connected)	/* non-connected scan */
-			btc8723b1ant_action_wifi_not_conn_scan(btcoexist);
-		else	/* wifi is connected */
-			btc8723b1ant_action_wifi_conn_scan(btcoexist);
-	} else if (BTC_SCAN_FINISH == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], SCAN FINISH notify\n");
-		if (!wifi_connected)	/* non-connected scan */
-			btc8723b1ant_action_wifi_not_conn(btcoexist);
-		else
-			halbtc8723b1ant_action_wifi_connected(btcoexist);
-	}
-}
-
-void ex_halbtc8723b1ant_connect_notify(struct btc_coexist *btcoexist, u8 type)
-{
-	bool wifi_connected = false, bt_hs_on = false;
-	u32 wifi_link_status = 0;
-	u32 num_of_wifi_link = 0;
-	bool bt_ctrl_agg_buf_size = false;
-	u8 agg_buf_size = 5;
-
-	if (btcoexist->manual_control || btcoexist->stop_coex_dm ||
-	    btcoexist->bt_info.bt_disabled)
-		return;
-
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS,
-			   &wifi_link_status);
-	num_of_wifi_link = wifi_link_status>>16;
-	if (num_of_wifi_link >= 2) {
-		halbtc8723b1ant_limited_tx(btcoexist, NORMAL_EXEC, 0, 0, 0, 0);
-		halbtc8723b1ant_limited_rx(btcoexist, NORMAL_EXEC, false,
-					   bt_ctrl_agg_buf_size, agg_buf_size);
-		halbtc8723b1ant_action_wifi_multiport(btcoexist);
-		return;
-	}
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on);
-	if (coex_sta->c2h_bt_inquiry_page) {
-		halbtc8723b1ant_action_bt_inquiry(btcoexist);
-		return;
-	} else if (bt_hs_on) {
-		halbtc8723b1ant_action_hs(btcoexist);
-		return;
-	}
-
-	if (BTC_ASSOCIATE_START == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], CONNECT START notify\n");
-		btc8723b1ant_act_wifi_not_conn_asso_auth(btcoexist);
-	} else if (BTC_ASSOCIATE_FINISH == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], CONNECT FINISH notify\n");
-
-		btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED,
-				   &wifi_connected);
-		if (!wifi_connected) /* non-connected scan */
-			btc8723b1ant_action_wifi_not_conn(btcoexist);
-		else
-			halbtc8723b1ant_action_wifi_connected(btcoexist);
-	}
-}
-
 void ex_halbtc8723b1ant_media_status_notify(struct btc_coexist *btcoexist,
 					    u8 type)
 {
@@ -2871,300 +2420,3 @@ void ex_halbtc8723b1ant_media_status_notify(struct btc_coexist *btcoexist,
 
 	btcoexist->btc_fill_h2c(btcoexist, 0x66, 3, h2c_parameter);
 }
-
-void ex_halbtc8723b1ant_special_packet_notify(struct btc_coexist *btcoexist,
-					      u8 type)
-{
-	bool bt_hs_on = false;
-	u32 wifi_link_status = 0;
-	u32 num_of_wifi_link = 0;
-	bool bt_ctrl_agg_buf_size = false;
-	u8 agg_buf_size = 5;
-
-	if (btcoexist->manual_control || btcoexist->stop_coex_dm ||
-	    btcoexist->bt_info.bt_disabled)
-		return;
-
-	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_LINK_STATUS,
-		&wifi_link_status);
-	num_of_wifi_link = wifi_link_status >> 16;
-	if (num_of_wifi_link >= 2) {
-		halbtc8723b1ant_limited_tx(btcoexist, NORMAL_EXEC, 0, 0, 0, 0);
-		halbtc8723b1ant_limited_rx(btcoexist, NORMAL_EXEC, false,
-					   bt_ctrl_agg_buf_size, agg_buf_size);
-		halbtc8723b1ant_action_wifi_multiport(btcoexist);
-		return;
-	}
-
-	coex_sta->special_pkt_period_cnt = 0;
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on);
-	if (coex_sta->c2h_bt_inquiry_page) {
-		halbtc8723b1ant_action_bt_inquiry(btcoexist);
-		return;
-	} else if (bt_hs_on) {
-		halbtc8723b1ant_action_hs(btcoexist);
-		return;
-	}
-
-	if (BTC_PACKET_DHCP == type ||
-	    BTC_PACKET_EAPOL == type) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], special Packet(%d) notify\n", type);
-		halbtc8723b1ant_action_wifi_connected_special_packet(btcoexist);
-	}
-}
-
-void ex_halbtc8723b1ant_bt_info_notify(struct btc_coexist *btcoexist,
-				       u8 *tmp_buf, u8 length)
-{
-	u8 bt_info = 0;
-	u8 i, rsp_source = 0;
-	bool wifi_connected = false;
-	bool bt_busy = false;
-
-	coex_sta->c2h_bt_info_req_sent = false;
-
-	rsp_source = tmp_buf[0] & 0xf;
-	if (rsp_source >= BT_INFO_SRC_8723B_1ANT_MAX)
-		rsp_source = BT_INFO_SRC_8723B_1ANT_WIFI_FW;
-	coex_sta->bt_info_c2h_cnt[rsp_source]++;
-
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-		  "[BTCoex], Bt info[%d], length=%d, hex data = [",
-		  rsp_source, length);
-	for (i = 0; i < length; i++) {
-		coex_sta->bt_info_c2h[rsp_source][i] = tmp_buf[i];
-		if (i == 1)
-			bt_info = tmp_buf[i];
-		if (i == length - 1)
-			BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-				  "0x%02x]\n", tmp_buf[i]);
-		else
-			BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-				  "0x%02x, ", tmp_buf[i]);
-	}
-
-	if (BT_INFO_SRC_8723B_1ANT_WIFI_FW != rsp_source) {
-		coex_sta->bt_retry_cnt =	/* [3:0] */
-			coex_sta->bt_info_c2h[rsp_source][2] & 0xf;
-
-		coex_sta->bt_rssi =
-			coex_sta->bt_info_c2h[rsp_source][3] * 2 + 10;
-
-		coex_sta->bt_info_ext =
-			coex_sta->bt_info_c2h[rsp_source][4];
-
-		/* Here we need to resend some wifi info to BT
-		 * because bt is reset and loss of the info.
-		 */
-		if (coex_sta->bt_info_ext & BIT1) {
-			BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-				  "[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n");
-			btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED,
-					   &wifi_connected);
-			if (wifi_connected)
-				ex_halbtc8723b1ant_media_status_notify(btcoexist,
-							     BTC_MEDIA_CONNECT);
-			else
-				ex_halbtc8723b1ant_media_status_notify(btcoexist,
-							  BTC_MEDIA_DISCONNECT);
-		}
-
-		if (coex_sta->bt_info_ext & BIT3) {
-			if (!btcoexist->manual_control &&
-			    !btcoexist->stop_coex_dm) {
-				BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-					  "[BTCoex], BT ext info bit3 check, set BT NOT ignore Wlan active!!\n");
-				halbtc8723b1ant_ignore_wlan_act(btcoexist,
-								FORCE_EXEC,
-								false);
-			}
-		} else {
-			/* BT already NOT ignore Wlan active, do nothing here.*/
-		}
-#if (BT_AUTO_REPORT_ONLY_8723B_1ANT == 0)
-		if (coex_sta->bt_info_ext & BIT4) {
-			/* BT auto report already enabled, do nothing */
-		} else {
-			halbtc8723b1ant_bt_auto_report(btcoexist, FORCE_EXEC,
-						       true);
-		}
-#endif
-	}
-
-	/* check BIT2 first ==> check if bt is under inquiry or page scan */
-	if (bt_info & BT_INFO_8723B_1ANT_B_INQ_PAGE)
-		coex_sta->c2h_bt_inquiry_page = true;
-	else
-		coex_sta->c2h_bt_inquiry_page = false;
-
-	/* set link exist status */
-	if (!(bt_info & BT_INFO_8723B_1ANT_B_CONNECTION)) {
-		coex_sta->bt_link_exist = false;
-		coex_sta->pan_exist = false;
-		coex_sta->a2dp_exist = false;
-		coex_sta->hid_exist = false;
-		coex_sta->sco_exist = false;
-	} else { /* connection exists */
-		coex_sta->bt_link_exist = true;
-		if (bt_info & BT_INFO_8723B_1ANT_B_FTP)
-			coex_sta->pan_exist = true;
-		else
-			coex_sta->pan_exist = false;
-		if (bt_info & BT_INFO_8723B_1ANT_B_A2DP)
-			coex_sta->a2dp_exist = true;
-		else
-			coex_sta->a2dp_exist = false;
-		if (bt_info & BT_INFO_8723B_1ANT_B_HID)
-			coex_sta->hid_exist = true;
-		else
-			coex_sta->hid_exist = false;
-		if (bt_info & BT_INFO_8723B_1ANT_B_SCO_ESCO)
-			coex_sta->sco_exist = true;
-		else
-			coex_sta->sco_exist = false;
-	}
-
-	halbtc8723b1ant_update_bt_link_info(btcoexist);
-
-	if (!(bt_info&BT_INFO_8723B_1ANT_B_CONNECTION)) {
-		coex_dm->bt_status = BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE;
-		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-			  "[BTCoex], BtInfoNotify(), BT Non-Connected idle!\n");
-	/* connection exists but no busy */
-	} else if (bt_info == BT_INFO_8723B_1ANT_B_CONNECTION) {
-		coex_dm->bt_status = BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE;
-		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-			  "[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n");
-	} else if ((bt_info & BT_INFO_8723B_1ANT_B_SCO_ESCO) ||
-		(bt_info & BT_INFO_8723B_1ANT_B_SCO_BUSY)) {
-		coex_dm->bt_status = BT_8723B_1ANT_BT_STATUS_SCO_BUSY;
-		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-			  "[BTCoex], BtInfoNotify(), BT SCO busy!!!\n");
-	} else if (bt_info & BT_INFO_8723B_1ANT_B_ACL_BUSY) {
-		if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY != coex_dm->bt_status)
-			coex_dm->auto_tdma_adjust = false;
-
-		coex_dm->bt_status = BT_8723B_1ANT_BT_STATUS_ACL_BUSY;
-		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-			  "[BTCoex], BtInfoNotify(), BT ACL busy!!!\n");
-	} else {
-		coex_dm->bt_status =
-			BT_8723B_1ANT_BT_STATUS_MAX;
-		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-			  "[BTCoex], BtInfoNotify(), BT Non-Defined state!!\n");
-	}
-
-	if ((BT_8723B_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) ||
-	    (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) ||
-	    (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status))
-		bt_busy = true;
-	else
-		bt_busy = false;
-	btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bt_busy);
-
-	halbtc8723b1ant_run_coexist_mechanism(btcoexist);
-}
-
-void ex_halbtc8723b1ant_halt_notify(struct btc_coexist *btcoexist)
-{
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, "[BTCoex], Halt notify\n");
-
-	btcoexist->stop_coex_dm = true;
-
-	halbtc8723b1ant_SetAntPath(btcoexist, BTC_ANT_PATH_BT, false, true);
-
-	halbtc8723b1ant_wifi_off_hw_cfg(btcoexist);
-	halbtc8723b1ant_ignore_wlan_act(btcoexist, FORCE_EXEC, true);
-
-	halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
-					 0x0, 0x0);
-	halbtc8723b1ant_ps_tdma(btcoexist, FORCE_EXEC, false, 0);
-
-	ex_halbtc8723b1ant_media_status_notify(btcoexist, BTC_MEDIA_DISCONNECT);
-}
-
-void ex_halbtc8723b1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state)
-{
-	BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, "[BTCoex], Pnp notify\n");
-
-	if (BTC_WIFI_PNP_SLEEP == pnp_state) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], Pnp notify to SLEEP\n");
-		btcoexist->stop_coex_dm = true;
-		halbtc8723b1ant_SetAntPath(btcoexist, BTC_ANT_PATH_BT, false,
-					   true);
-		halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
-						 0x0, 0x0);
-		halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 0);
-		halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2);
-		halbtc8723b1ant_wifi_off_hw_cfg(btcoexist);
-	} else if (BTC_WIFI_PNP_WAKE_UP == pnp_state) {
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
-			  "[BTCoex], Pnp notify to WAKE UP\n");
-		btcoexist->stop_coex_dm = false;
-		halbtc8723b1ant_init_hw_config(btcoexist, false);
-		halbtc8723b1ant_init_coex_dm(btcoexist);
-		halbtc8723b1ant_query_bt_info(btcoexist);
-	}
-}
-
-void ex_halbtc8723b1ant_coex_dm_reset(struct btc_coexist *btcoexist)
-{
-	BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-		  "[BTCoex], *****************Coex DM Reset****************\n");
-
-	halbtc8723b1ant_init_hw_config(btcoexist, false);
-	btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xfffff, 0x0);
-	btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x2, 0xfffff, 0x0);
-	halbtc8723b1ant_init_coex_dm(btcoexist);
-}
-
-void ex_halbtc8723b1ant_periodical(struct btc_coexist *btcoexist)
-{
-	struct btc_board_info *board_info = &btcoexist->board_info;
-	struct btc_stack_info *stack_info = &btcoexist->stack_info;
-	static u8 dis_ver_info_cnt;
-	u32 fw_ver = 0, bt_patch_ver = 0;
-
-	BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
-		  "[BTCoex], ==========================Periodical===========================\n");
-
-	if (dis_ver_info_cnt <= 5) {
-		dis_ver_info_cnt += 1;
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], ****************************************************************\n");
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], Ant PG Num/ Ant Mech/ Ant Pos = %d/ %d/ %d\n",
-			  board_info->pg_ant_num, board_info->btdm_ant_num,
-			  board_info->btdm_ant_pos);
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], BT stack/ hci ext ver = %s / %d\n",
-			  ((stack_info->profile_notified) ? "Yes" : "No"),
-			  stack_info->hci_version);
-		btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER,
-				   &bt_patch_ver);
-		btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], CoexVer/ FwVer/ PatchVer = %d_%x/ 0x%x/ 0x%x(%d)\n",
-			  glcoex_ver_date_8723b_1ant,
-			  glcoex_ver_8723b_1ant, fw_ver,
-			  bt_patch_ver, bt_patch_ver);
-		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
-			  "[BTCoex], ****************************************************************\n");
-	}
-
-#if (BT_AUTO_REPORT_ONLY_8723B_1ANT == 0)
-	halbtc8723b1ant_query_bt_info(btcoexist);
-	halbtc8723b1ant_monitor_bt_ctr(btcoexist);
-	halbtc8723b1ant_monitor_bt_enable_disable(btcoexist);
-#else
-	if (btc8723b1ant_is_wifi_status_changed(btcoexist) ||
-	    coex_dm->auto_tdma_adjust) {
-		halbtc8723b1ant_run_coexist_mechanism(btcoexist);
-	}
-
-	coex_sta->special_pkt_period_cnt++;
-#endif
-}
diff --git a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b1ant.h b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b1ant.h
index 75f8094..460da26 100644
--- a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b1ant.h
+++ b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b1ant.h
@@ -165,20 +165,5 @@ struct coex_sta_8723b_1ant {
 /*************************************************************************
  * The following is interface which will notify coex module.
  *************************************************************************/
-void ex_halbtc8723b1ant_init_hwconfig(struct btc_coexist *btcoexist);
-void ex_halbtc8723b1ant_init_coex_dm(struct btc_coexist *btcoexist);
-void ex_halbtc8723b1ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
-void ex_halbtc8723b1ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
-void ex_halbtc8723b1ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
-void ex_halbtc8723b1ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
 void ex_halbtc8723b1ant_media_status_notify(struct btc_coexist *btcoexist,
 					    u8 type);
-void ex_halbtc8723b1ant_special_packet_notify(struct btc_coexist *btcoexist,
-					      u8 type);
-void ex_halbtc8723b1ant_bt_info_notify(struct btc_coexist *btcoexist,
-				       u8 *tmpbuf, u8 length);
-void ex_halbtc8723b1ant_halt_notify(struct btc_coexist *btcoexist);
-void ex_halbtc8723b1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnpstate);
-void ex_halbtc8723b1ant_coex_dm_reset(struct btc_coexist *btcoexist);
-void ex_halbtc8723b1ant_periodical(struct btc_coexist *btcoexist);
-void ex_halbtc8723b1ant_display_coex_info(struct btc_coexist *btcoexist);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH net-next] doc: fix the compile fix of txtimestamp.c
From: Willem de Bruijn @ 2015-01-10 17:08 UTC (permalink / raw)
  To: netdev; +Cc: davem, xiyou.wangcong, vlee, carlos, Willem de Bruijn

From: Willem de Bruijn <willemb@google.com>

A fix to ipv6 structure definitions removed the now superfluous
definition of in6_pktinfo in this file.

But, use of the glibc definition requires defining _GNU_SOURCE
(see also https://sourceware.org/bugzilla/show_bug.cgi?id=6775).

Before this change, the following would fail for me:

  make
  make headers_install
  make M=Documentation/networking/timestamping

with

  Documentation/networking/timestamping/txtimestamp.c: In function '__recv_errmsg_cmsg':
  Documentation/networking/timestamping/txtimestamp.c:205:33: error: dereferencing pointer to incomplete type
  Documentation/networking/timestamping/txtimestamp.c:206:23: error: dereferencing pointer to incomplete type

After this patch compilation succeeded.

Fixes: cd91cc5bdddf ("doc: fix the compile error of txtimestamp.c")
Signed-off-by: Willem de Bruijn <willemb@google.com>

----

Due to the many libc headers included in txtimestamp.c, I was unable
to make it compile cleanly by including the kernel header
(linux/ipv6.h) first, as opposed to using the libc definition.

Btw, should we add the libc-compat.h directly to that file, as opposed
to reading it indirectly through linux/in6.h?

--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -1,6 +1,7 @@
 #ifndef _UAPI_IPV6_H
 #define _UAPI_IPV6_H

+#include <linux/libc-compat.h>
 #include <linux/types.h>
---
 Documentation/networking/timestamping/txtimestamp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/networking/timestamping/txtimestamp.c b/Documentation/networking/timestamping/txtimestamp.c
index 8778e68..05694fe 100644
--- a/Documentation/networking/timestamping/txtimestamp.c
+++ b/Documentation/networking/timestamping/txtimestamp.c
@@ -30,6 +30,8 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#define _GNU_SOURCE
+
 #include <arpa/inet.h>
 #include <asm/types.h>
 #include <error.h>
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* Re: [PATCH 1/3] rtlwifi: btcoexist: Remove some unused functions
From: Larry Finger @ 2015-01-10 17:11 UTC (permalink / raw)
  To: Rickard Strandqvist
  Cc: Kalle Valo, Masanari Iida, Sachin Kamat, linux-wireless, netdev,
	linux-kernel
In-Reply-To: <1420907079-27102-1-git-send-email-rickard_strandqvist@spectrumdigital.se>

On 01/10/2015 10:24 AM, Rickard Strandqvist wrote:
> Removes some functions that are not used anywhere:
> ex_halbtc8821a1ant_periodical() ex_halbtc8821a1ant_pnp_notify()
> ex_halbtc8821a1ant_halt_notify() ex_halbtc8821a1ant_bt_info_notify()
> ex_halbtc8821a1ant_special_packet_notify() ex_halbtc8821a1ant_connect_notify()
> ex_halbtc8821a1ant_scan_notify() ex_halbtc8821a1ant_lps_notify()
> ex_halbtc8821a1ant_ips_notify() ex_halbtc8821a1ant_display_coex_info()
> ex_halbtc8821a1ant_init_coex_dm() ex_halbtc8821a1ant_init_hwconfig()
>
> This was partially found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>

NACK!!!!!!!!!

I told you to stay away from these routines until I finish my update. Not only 
might you remove some functions that I will be needing later, but you run the 
risk of merge complications.

Kalle: Please ignore EVERYTHING from this person. Obviously, he is incapable of 
understanding even the simplest instructions.

Larry

> ---
>   .../wireless/rtlwifi/btcoexist/halbtc8821a1ant.c   |  707 --------------------
>   .../wireless/rtlwifi/btcoexist/halbtc8821a1ant.h   |   14 -
>   2 files changed, 721 deletions(-)
>
> diff --git a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.c b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.c
> index b72e537..a86e6b6 100644
> --- a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.c
> +++ b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.c
> @@ -2213,435 +2213,6 @@ static void halbtc8821a1ant_init_hw_config(struct btc_coexist *btcoexist,
>   /*============================================================*/
>   /* extern function start with EXhalbtc8821a1ant_*/
>   /*============================================================*/
> -void ex_halbtc8821a1ant_init_hwconfig(struct btc_coexist *btcoexist)
> -{
> -	halbtc8821a1ant_init_hw_config(btcoexist, true);
> -}
> -
> -void ex_halbtc8821a1ant_init_coex_dm(struct btc_coexist *btcoexist)
> -{
> -	BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
> -		  "[BTCoex], Coex Mechanism Init!!\n");
> -
> -	btcoexist->stop_coex_dm = false;
> -
> -	halbtc8821a1ant_init_coex_dm(btcoexist);
> -
> -	halbtc8821a1ant_query_bt_info(btcoexist);
> -}
> -
> -void ex_halbtc8821a1ant_display_coex_info(struct btc_coexist *btcoexist)
> -{
> -	struct btc_board_info *board_info = &btcoexist->board_info;
> -	struct btc_stack_info *stack_info = &btcoexist->stack_info;
> -	struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
> -	struct rtl_priv *rtlpriv = btcoexist->adapter;
> -	u8 u1_tmp[4], i, bt_info_ext, ps_tdma_case = 0;
> -	u16 u2_tmp[4];
> -	u32 u4_tmp[4];
> -	bool roam = false, scan = false, link = false, wifi_under_5g = false;
> -	bool bt_hs_on = false, wifi_busy = false;
> -	long wifi_rssi = 0, bt_hs_rssi = 0;
> -	u32 wifi_bw, wifi_traffic_dir;
> -	u8 wifi_dot11_chnl, wifi_hs_chnl;
> -	u32 fw_ver = 0, bt_patch_ver = 0;
> -
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n ============[BT Coexist info]============");
> -
> -	if (btcoexist->manual_control) {
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -			   "\r\n ============[Under Manual Control]============");
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -			   "\r\n ==========================================");
> -	}
> -	if (btcoexist->stop_coex_dm) {
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -			   "\r\n ============[Coex is STOPPED]============");
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -			   "\r\n ==========================================");
> -	}
> -
> -	if (!board_info->bt_exist) {
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n BT not exists !!!");
> -		return;
> -	}
> -
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %d/ %d/ %d",
> -		   "Ant PG Num/ Ant Mech/ Ant Pos:",
> -		   board_info->pg_ant_num,
> -		   board_info->btdm_ant_num,
> -		   board_info->btdm_ant_pos);
> -
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %s / %d", "BT stack/ hci ext ver",
> -		   ((stack_info->profile_notified) ? "Yes" : "No"),
> -		stack_info->hci_version);
> -
> -	btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER,
> -			   &bt_patch_ver);
> -	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %d_%x/ 0x%x/ 0x%x(%d)",
> -		   "CoexVer/ FwVer/ PatchVer",
> -		   glcoex_ver_date_8821a_1ant,
> -		   glcoex_ver_8821a_1ant,
> -		   fw_ver, bt_patch_ver,
> -		   bt_patch_ver);
> -
> -	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION,
> -			   &bt_hs_on);
> -	btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_DOT11_CHNL,
> -			   &wifi_dot11_chnl);
> -	btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_HS_CHNL,
> -			   &wifi_hs_chnl);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %d / %d(%d)",
> -		   "Dot11 channel / HsChnl(HsMode)",
> -		   wifi_dot11_chnl, wifi_hs_chnl, bt_hs_on);
> -
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %02x %02x %02x ",
> -		   "H2C Wifi inform bt chnl Info",
> -		   coex_dm->wifi_chnl_info[0], coex_dm->wifi_chnl_info[1],
> -		   coex_dm->wifi_chnl_info[2]);
> -
> -	btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi);
> -	btcoexist->btc_get(btcoexist, BTC_GET_S4_HS_RSSI, &bt_hs_rssi);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %d/ %d", "Wifi rssi/ HS rssi",
> -		   (int)wifi_rssi, (int)bt_hs_rssi);
> -
> -	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan);
> -	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link);
> -	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %d/ %d/ %d ", "Wifi link/ roam/ scan",
> -		   link, roam, scan);
> -
> -	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G,
> -			   &wifi_under_5g);
> -	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW,
> -			   &wifi_bw);
> -	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY,
> -			   &wifi_busy);
> -	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION,
> -			   &wifi_traffic_dir);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %s / %s/ %s ", "Wifi status",
> -		   (wifi_under_5g ? "5G" : "2.4G"),
> -		   ((BTC_WIFI_BW_LEGACY == wifi_bw) ? "Legacy" :
> -		   (((BTC_WIFI_BW_HT40 == wifi_bw) ? "HT40" : "HT20"))),
> -		   ((!wifi_busy) ? "idle" :
> -		   ((BTC_WIFI_TRAFFIC_TX == wifi_traffic_dir) ?
> -		   "uplink" : "downlink")));
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]",
> -		   ((btcoexist->bt_info.bt_disabled) ? ("disabled") :
> -		   ((coex_sta->c2h_bt_inquiry_page) ? ("inquiry/page scan") :
> -		   ((BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE ==
> -		     coex_dm->bt_status) ?
> -		   "non-connected idle" :
> -		   ((BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE ==
> -		     coex_dm->bt_status) ?
> -		   "connected-idle" : "busy")))),
> -		   coex_sta->bt_rssi, coex_sta->bt_retry_cnt);
> -
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP",
> -		   bt_link_info->sco_exist,
> -		   bt_link_info->hid_exist,
> -		   bt_link_info->pan_exist,
> -		   bt_link_info->a2dp_exist);
> -	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_BT_LINK_INFO);
> -
> -	bt_info_ext = coex_sta->bt_info_ext;
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %s",
> -		   "BT Info A2DP rate",
> -		   (bt_info_ext&BIT0) ?
> -		   "Basic rate" : "EDR rate");
> -
> -	for (i = 0; i < BT_INFO_SRC_8821A_1ANT_MAX; i++) {
> -		if (coex_sta->bt_info_c2h_cnt[i]) {
> -			RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -				   "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)",
> -				   glbt_info_src_8821a_1ant[i],
> -				   coex_sta->bt_info_c2h[i][0],
> -				   coex_sta->bt_info_c2h[i][1],
> -				   coex_sta->bt_info_c2h[i][2],
> -				   coex_sta->bt_info_c2h[i][3],
> -				   coex_sta->bt_info_c2h[i][4],
> -				   coex_sta->bt_info_c2h[i][5],
> -				   coex_sta->bt_info_c2h[i][6],
> -				   coex_sta->bt_info_c2h_cnt[i]);
> -		}
> -	}
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %s/%s, (0x%x/0x%x)",
> -		   "PS state, IPS/LPS, (lps/rpwm)",
> -		   ((coex_sta->under_ips ? "IPS ON" : "IPS OFF")),
> -		   ((coex_sta->under_Lps ? "LPS ON" : "LPS OFF")),
> -		   btcoexist->bt_info.lps_val,
> -		   btcoexist->bt_info.rpwm_val);
> -	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD);
> -
> -	if (!btcoexist->manual_control) {
> -		/* Sw mechanism*/
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -			   "\r\n %-35s", "============[Sw mechanism]============");
> -
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -			   "\r\n %-35s = %d", "SM[LowPenaltyRA]",
> -			   coex_dm->cur_low_penalty_ra);
> -
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -			   "\r\n %-35s = %s/ %s/ %d ",
> -			   "DelBA/ BtCtrlAgg/ AggSize",
> -			   (btcoexist->bt_info.reject_agg_pkt ? "Yes" : "No"),
> -			   (btcoexist->bt_info.bt_ctrl_buf_size ? "Yes" : "No"),
> -			   btcoexist->bt_info.agg_buf_size);
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -			   "\r\n %-35s = 0x%x ", "Rate Mask",
> -			   btcoexist->bt_info.ra_mask);
> -
> -		/* Fw mechanism*/
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s",
> -			   "============[Fw mechanism]============");
> -
> -		ps_tdma_case = coex_dm->cur_ps_tdma;
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -			   "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)",
> -			   "PS TDMA",
> -			   coex_dm->ps_tdma_para[0],
> -			   coex_dm->ps_tdma_para[1],
> -			   coex_dm->ps_tdma_para[2],
> -			   coex_dm->ps_tdma_para[3],
> -			   coex_dm->ps_tdma_para[4],
> -			   ps_tdma_case,
> -			   coex_dm->auto_tdma_adjust);
> -
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -			   "\r\n %-35s = 0x%x ",
> -			   "Latest error condition(should be 0)",
> -			   coex_dm->error_condition);
> -
> -		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -			   "\r\n %-35s = %d ", "IgnWlanAct",
> -			   coex_dm->cur_ignore_wlan_act);
> -	}
> -
> -	/* Hw setting*/
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s", "============[Hw setting]============");
> -
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x",
> -		   "backup ARFR1/ARFR2/RL/AMaxTime",
> -		   coex_dm->backup_arfr_cnt1,
> -		   coex_dm->backup_arfr_cnt2,
> -		   coex_dm->backup_retry_limit,
> -		   coex_dm->backup_ampdu_max_time);
> -
> -	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x430);
> -	u4_tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x434);
> -	u2_tmp[0] = btcoexist->btc_read_2byte(btcoexist, 0x42a);
> -	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x456);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = 0x%x/0x%x/0x%x/0x%x",
> -		   "0x430/0x434/0x42a/0x456",
> -		   u4_tmp[0], u4_tmp[1], u2_tmp[0], u1_tmp[0]);
> -
> -	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x778);
> -	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc58);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = 0x%x/ 0x%x", "0x778/ 0xc58[29:25]",
> -		   u1_tmp[0], (u4_tmp[0]&0x3e000000) >> 25);
> -
> -	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x8db);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = 0x%x", "0x8db[6:5]",
> -		   ((u1_tmp[0]&0x60)>>5));
> -
> -	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x975);
> -	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xcb4);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = 0x%x/ 0x%x/ 0x%x",
> -		   "0xcb4[29:28]/0xcb4[7:0]/0x974[9:8]",
> -		   (u4_tmp[0] & 0x30000000)>>28,
> -		    u4_tmp[0] & 0xff,
> -		    u1_tmp[0] & 0x3);
> -
> -	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x40);
> -	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x4c);
> -	u1_tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0x64);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = 0x%x/ 0x%x/ 0x%x",
> -		   "0x40/0x4c[24:23]/0x64[0]",
> -		   u1_tmp[0], ((u4_tmp[0]&0x01800000)>>23), u1_tmp[1]&0x1);
> -
> -	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x550);
> -	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x522);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = 0x%x/ 0x%x", "0x550(bcn ctrl)/0x522",
> -		   u4_tmp[0], u1_tmp[0]);
> -
> -	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc50);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = 0x%x", "0xc50(dig)",
> -		   u4_tmp[0]&0xff);
> -
> -	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xf48);
> -	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0xa5d);
> -	u1_tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0xa5c);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = 0x%x/ 0x%x", "OFDM-FA/ CCK-FA",
> -		   u4_tmp[0], (u1_tmp[0]<<8) + u1_tmp[1]);
> -
> -	u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x6c0);
> -	u4_tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x6c4);
> -	u4_tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0x6c8);
> -	u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x6cc);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x",
> -		   "0x6c0/0x6c4/0x6c8/0x6cc(coexTable)",
> -		   u4_tmp[0], u4_tmp[1], u4_tmp[2], u1_tmp[0]);
> -
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %d/ %d", "0x770(high-pri rx/tx)",
> -		   coex_sta->high_priority_rx, coex_sta->high_priority_tx);
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
> -		   "\r\n %-35s = %d/ %d", "0x774(low-pri rx/tx)",
> -		   coex_sta->low_priority_rx, coex_sta->low_priority_tx);
> -#if (BT_AUTO_REPORT_ONLY_8821A_1ANT == 1)
> -	halbtc8821a1ant_monitor_bt_ctr(btcoexist);
> -#endif
> -	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_COEX_STATISTICS);
> -}
> -
> -void ex_halbtc8821a1ant_ips_notify(struct btc_coexist *btcoexist, u8 type)
> -{
> -	if (btcoexist->manual_control || btcoexist->stop_coex_dm)
> -		return;
> -
> -	if (BTC_IPS_ENTER == type) {
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -			  "[BTCoex], IPS ENTER notify\n");
> -		coex_sta->under_ips = true;
> -		halbtc8821a1ant_set_ant_path(btcoexist,
> -					     BTC_ANT_PATH_BT, false, true);
> -		/*set PTA control*/
> -		halbtc8821a1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 8);
> -		halbtc8821a1ant_coex_table_with_type(btcoexist,
> -						     NORMAL_EXEC, 0);
> -	} else if (BTC_IPS_LEAVE == type) {
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -			  "[BTCoex], IPS LEAVE notify\n");
> -		coex_sta->under_ips = false;
> -
> -		halbtc8821a1ant_run_coexist_mechanism(btcoexist);
> -	}
> -}
> -
> -void ex_halbtc8821a1ant_lps_notify(struct btc_coexist *btcoexist, u8 type)
> -{
> -	if (btcoexist->manual_control || btcoexist->stop_coex_dm)
> -		return;
> -
> -	if (BTC_LPS_ENABLE == type) {
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -			  "[BTCoex], LPS ENABLE notify\n");
> -		coex_sta->under_Lps = true;
> -	} else if (BTC_LPS_DISABLE == type) {
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -			  "[BTCoex], LPS DISABLE notify\n");
> -		coex_sta->under_Lps = false;
> -	}
> -}
> -
> -void ex_halbtc8821a1ant_scan_notify(struct btc_coexist *btcoexist, u8 type)
> -{
> -	bool wifi_connected = false, bt_hs_on = false;
> -
> -	if (btcoexist->manual_control ||
> -	    btcoexist->stop_coex_dm ||
> -	    btcoexist->bt_info.bt_disabled)
> -		return;
> -
> -	btcoexist->btc_get(btcoexist,
> -		 BTC_GET_BL_HS_OPERATION, &bt_hs_on);
> -	btcoexist->btc_get(btcoexist,
> -		 BTC_GET_BL_WIFI_CONNECTED, &wifi_connected);
> -
> -	halbtc8821a1ant_query_bt_info(btcoexist);
> -
> -	if (coex_sta->c2h_bt_inquiry_page) {
> -		halbtc8821a1ant_action_bt_inquiry(btcoexist);
> -		return;
> -	} else if (bt_hs_on) {
> -		halbtc8821a1ant_action_hs(btcoexist);
> -		return;
> -	}
> -
> -	if (BTC_SCAN_START == type) {
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -			  "[BTCoex], SCAN START notify\n");
> -		if (!wifi_connected) {
> -			/* non-connected scan*/
> -			btc8821a1ant_act_wifi_not_conn_scan(btcoexist);
> -		} else {
> -			/* wifi is connected*/
> -			halbtc8821a1ant_action_wifi_connected_scan(btcoexist);
> -		}
> -	} else if (BTC_SCAN_FINISH == type) {
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -			  "[BTCoex], SCAN FINISH notify\n");
> -		if (!wifi_connected) {
> -			/* non-connected scan*/
> -			halbtc8821a1ant_action_wifi_not_connected(btcoexist);
> -		} else {
> -			halbtc8821a1ant_action_wifi_connected(btcoexist);
> -		}
> -	}
> -}
> -
> -void ex_halbtc8821a1ant_connect_notify(struct btc_coexist *btcoexist, u8 type)
> -{
> -	bool	wifi_connected = false, bt_hs_on = false;
> -
> -	if (btcoexist->manual_control ||
> -	    btcoexist->stop_coex_dm ||
> -	    btcoexist->bt_info.bt_disabled)
> -		return;
> -
> -	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on);
> -	if (coex_sta->c2h_bt_inquiry_page) {
> -		halbtc8821a1ant_action_bt_inquiry(btcoexist);
> -		return;
> -	} else if (bt_hs_on) {
> -		halbtc8821a1ant_action_hs(btcoexist);
> -		return;
> -	}
> -
> -	if (BTC_ASSOCIATE_START == type) {
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -			  "[BTCoex], CONNECT START notify\n");
> -		btc8821a1ant_act_wifi_not_conn_scan(btcoexist);
> -	} else if (BTC_ASSOCIATE_FINISH == type) {
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -			  "[BTCoex], CONNECT FINISH notify\n");
> -
> -		btcoexist->btc_get(btcoexist,
> -			 BTC_GET_BL_WIFI_CONNECTED, &wifi_connected);
> -		if (!wifi_connected) {
> -			/* non-connected scan*/
> -			halbtc8821a1ant_action_wifi_not_connected(btcoexist);
> -		} else {
> -			halbtc8821a1ant_action_wifi_connected(btcoexist);
> -		}
> -	}
> -}
>
>   void ex_halbtc8821a1ant_media_status_notify(struct btc_coexist *btcoexist,
>   					    u8 type)
> @@ -2690,281 +2261,3 @@ void ex_halbtc8821a1ant_media_status_notify(struct btc_coexist *btcoexist,
>   	btcoexist->btc_fill_h2c(btcoexist, 0x66, 3, h2c_parameter);
>   }
>
> -void ex_halbtc8821a1ant_special_packet_notify(struct btc_coexist *btcoexist,
> -					      u8 type)
> -{
> -	bool bt_hs_on = false;
> -
> -	if (btcoexist->manual_control ||
> -	    btcoexist->stop_coex_dm ||
> -	    btcoexist->bt_info.bt_disabled)
> -		return;
> -
> -	coex_sta->special_pkt_period_cnt = 0;
> -
> -	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on);
> -	if (coex_sta->c2h_bt_inquiry_page) {
> -		halbtc8821a1ant_action_bt_inquiry(btcoexist);
> -		return;
> -	} else if (bt_hs_on) {
> -		halbtc8821a1ant_action_hs(btcoexist);
> -		return;
> -	}
> -
> -	if (BTC_PACKET_DHCP == type ||
> -	    BTC_PACKET_EAPOL == type) {
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -			  "[BTCoex], special Packet(%d) notify\n", type);
> -		btc8821a1ant_act_wifi_conn_sp_pkt(btcoexist);
> -	}
> -}
> -
> -void ex_halbtc8821a1ant_bt_info_notify(struct btc_coexist *btcoexist,
> -				       u8 *tmp_buf, u8 length)
> -{
> -	u8 bt_info = 0;
> -	u8 i, rsp_source = 0;
> -	bool wifi_connected = false;
> -	bool bt_busy = false;
> -	bool wifi_under_5g = false;
> -
> -	coex_sta->c2h_bt_info_req_sent = false;
> -
> -	btcoexist->btc_get(btcoexist,
> -		 BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g);
> -
> -	rsp_source = tmp_buf[0]&0xf;
> -	if (rsp_source >= BT_INFO_SRC_8821A_1ANT_MAX)
> -		rsp_source = BT_INFO_SRC_8821A_1ANT_WIFI_FW;
> -	coex_sta->bt_info_c2h_cnt[rsp_source]++;
> -
> -	BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -		  "[BTCoex], Bt info[%d], length = %d, hex data = [",
> -		  rsp_source, length);
> -	for (i = 0; i < length; i++) {
> -		coex_sta->bt_info_c2h[rsp_source][i] = tmp_buf[i];
> -		if (i == 1)
> -			bt_info = tmp_buf[i];
> -		if (i == length-1) {
> -			BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -				  "0x%02x]\n", tmp_buf[i]);
> -		} else {
> -			BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -				  "0x%02x, ", tmp_buf[i]);
> -		}
> -	}
> -
> -	if (BT_INFO_SRC_8821A_1ANT_WIFI_FW != rsp_source) {
> -		coex_sta->bt_retry_cnt =	/* [3:0]*/
> -			coex_sta->bt_info_c2h[rsp_source][2]&0xf;
> -
> -		coex_sta->bt_rssi =
> -			coex_sta->bt_info_c2h[rsp_source][3]*2+10;
> -
> -		coex_sta->bt_info_ext =
> -			coex_sta->bt_info_c2h[rsp_source][4];
> -
> -		/* Here we need to resend some wifi info to BT*/
> -		/* because bt is reset and loss of the info.*/
> -		if (coex_sta->bt_info_ext & BIT1) {
> -			BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
> -				  "[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n");
> -			btcoexist->btc_get(btcoexist,
> -					   BTC_GET_BL_WIFI_CONNECTED,
> -					   &wifi_connected);
> -			if (wifi_connected) {
> -				ex_halbtc8821a1ant_media_status_notify(btcoexist,
> -							       BTC_MEDIA_CONNECT);
> -			} else {
> -				ex_halbtc8821a1ant_media_status_notify(btcoexist,
> -							       BTC_MEDIA_DISCONNECT);
> -			}
> -		}
> -
> -		if ((coex_sta->bt_info_ext & BIT3) && !wifi_under_5g) {
> -			if (!btcoexist->manual_control &&
> -			    !btcoexist->stop_coex_dm) {
> -				BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
> -					  "[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n");
> -				halbtc8821a1ant_ignore_wlan_act(btcoexist,
> -								FORCE_EXEC,
> -								false);
> -			}
> -		}
> -#if (BT_AUTO_REPORT_ONLY_8821A_1ANT == 0)
> -		if (!(coex_sta->bt_info_ext & BIT4)) {
> -			BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
> -				  "[BTCoex], BT ext info bit4 check, set BT to enable Auto Report!!\n");
> -			halbtc8821a1ant_bt_auto_report(btcoexist,
> -						       FORCE_EXEC, true);
> -		}
> -#endif
> -	}
> -
> -	/* check BIT2 first ==> check if bt is under inquiry or page scan*/
> -	if (bt_info & BT_INFO_8821A_1ANT_B_INQ_PAGE)
> -		coex_sta->c2h_bt_inquiry_page = true;
> -	else
> -		coex_sta->c2h_bt_inquiry_page = false;
> -
> -	/* set link exist status*/
> -	if (!(bt_info&BT_INFO_8821A_1ANT_B_CONNECTION)) {
> -		coex_sta->bt_link_exist = false;
> -		coex_sta->pan_exist = false;
> -		coex_sta->a2dp_exist = false;
> -		coex_sta->hid_exist = false;
> -		coex_sta->sco_exist = false;
> -	} else {
> -		/* connection exists*/
> -		coex_sta->bt_link_exist = true;
> -		if (bt_info & BT_INFO_8821A_1ANT_B_FTP)
> -			coex_sta->pan_exist = true;
> -		else
> -			coex_sta->pan_exist = false;
> -		if (bt_info & BT_INFO_8821A_1ANT_B_A2DP)
> -			coex_sta->a2dp_exist = true;
> -		else
> -			coex_sta->a2dp_exist = false;
> -		if (bt_info & BT_INFO_8821A_1ANT_B_HID)
> -			coex_sta->hid_exist = true;
> -		else
> -			coex_sta->hid_exist = false;
> -		if (bt_info & BT_INFO_8821A_1ANT_B_SCO_ESCO)
> -			coex_sta->sco_exist = true;
> -		else
> -			coex_sta->sco_exist = false;
> -	}
> -
> -	halbtc8821a1ant_update_bt_link_info(btcoexist);
> -
> -	if (!(bt_info&BT_INFO_8821A_1ANT_B_CONNECTION)) {
> -		coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE;
> -		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
> -			  "[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n");
> -	} else if (bt_info == BT_INFO_8821A_1ANT_B_CONNECTION) {
> -		/* connection exists but no busy*/
> -		coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE;
> -		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
> -			  "[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n");
> -	} else if ((bt_info&BT_INFO_8821A_1ANT_B_SCO_ESCO) ||
> -		(bt_info&BT_INFO_8821A_1ANT_B_SCO_BUSY)) {
> -		coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_SCO_BUSY;
> -		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
> -			  "[BTCoex], BtInfoNotify(), BT SCO busy!!!\n");
> -	} else if (bt_info&BT_INFO_8821A_1ANT_B_ACL_BUSY) {
> -		if (BT_8821A_1ANT_BT_STATUS_ACL_BUSY != coex_dm->bt_status)
> -			coex_dm->auto_tdma_adjust = false;
> -		coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_ACL_BUSY;
> -		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
> -			  "[BTCoex], BtInfoNotify(), BT ACL busy!!!\n");
> -	} else {
> -		coex_dm->bt_status = BT_8821A_1ANT_BT_STATUS_MAX;
> -		BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
> -			  "[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n");
> -	}
> -
> -	if ((BT_8821A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) ||
> -	    (BT_8821A_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) ||
> -	    (BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status))
> -		bt_busy = true;
> -	else
> -		bt_busy = false;
> -	btcoexist->btc_set(btcoexist,
> -			   BTC_SET_BL_BT_TRAFFIC_BUSY, &bt_busy);
> -
> -	halbtc8821a1ant_run_coexist_mechanism(btcoexist);
> -}
> -
> -void ex_halbtc8821a1ant_halt_notify(struct btc_coexist *btcoexist)
> -{
> -	BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -		  "[BTCoex], Halt notify\n");
> -
> -	btcoexist->stop_coex_dm = true;
> -
> -	halbtc8821a1ant_set_ant_path(btcoexist,
> -				     BTC_ANT_PATH_BT, false, true);
> -	halbtc8821a1ant_ignore_wlan_act(btcoexist, FORCE_EXEC, true);
> -
> -	halbtc8821a1ant_power_save_state(btcoexist,
> -					 BTC_PS_WIFI_NATIVE, 0x0, 0x0);
> -	halbtc8821a1ant_ps_tdma(btcoexist, FORCE_EXEC, false, 0);
> -
> -	ex_halbtc8821a1ant_media_status_notify(btcoexist,
> -					       BTC_MEDIA_DISCONNECT);
> -}
> -
> -void ex_halbtc8821a1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state)
> -{
> -	BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -		  "[BTCoex], Pnp notify\n");
> -
> -	if (BTC_WIFI_PNP_SLEEP == pnp_state) {
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -			  "[BTCoex], Pnp notify to SLEEP\n");
> -		btcoexist->stop_coex_dm = true;
> -		halbtc8821a1ant_ignore_wlan_act(btcoexist, FORCE_EXEC, true);
> -		halbtc8821a1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
> -						 0x0, 0x0);
> -		halbtc8821a1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 9);
> -	} else if (BTC_WIFI_PNP_WAKE_UP == pnp_state) {
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY,
> -			  "[BTCoex], Pnp notify to WAKE UP\n");
> -		btcoexist->stop_coex_dm = false;
> -		halbtc8821a1ant_init_hw_config(btcoexist, false);
> -		halbtc8821a1ant_init_coex_dm(btcoexist);
> -		halbtc8821a1ant_query_bt_info(btcoexist);
> -	}
> -}
> -
> -void
> -ex_halbtc8821a1ant_periodical(
> -	struct btc_coexist *btcoexist) {
> -	static u8	dis_ver_info_cnt;
> -	u32		fw_ver = 0, bt_patch_ver = 0;
> -	struct btc_board_info *board_info = &btcoexist->board_info;
> -	struct btc_stack_info *stack_info = &btcoexist->stack_info;
> -
> -	BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE,
> -		  "[BTCoex], ==========================Periodical===========================\n");
> -
> -	if (dis_ver_info_cnt <= 5) {
> -		dis_ver_info_cnt += 1;
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
> -			  "[BTCoex], ****************************************************************\n");
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
> -			  "[BTCoex], Ant PG Num/ Ant Mech/ Ant Pos = %d/ %d/ %d\n",
> -			  board_info->pg_ant_num,
> -			  board_info->btdm_ant_num,
> -			  board_info->btdm_ant_pos);
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
> -			  "[BTCoex], BT stack/ hci ext ver = %s / %d\n",
> -			  ((stack_info->profile_notified) ? "Yes" : "No"),
> -			  stack_info->hci_version);
> -		btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER,
> -				   &bt_patch_ver);
> -		btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
> -			  "[BTCoex], CoexVer/ FwVer/ PatchVer = %d_%x/ 0x%x/ 0x%x(%d)\n",
> -			glcoex_ver_date_8821a_1ant,
> -			glcoex_ver_8821a_1ant,
> -			fw_ver, bt_patch_ver,
> -			bt_patch_ver);
> -		BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
> -			  "[BTCoex], ****************************************************************\n");
> -	}
> -
> -#if (BT_AUTO_REPORT_ONLY_8821A_1ANT == 0)
> -	halbtc8821a1ant_query_bt_info(btcoexist);
> -	halbtc8821a1ant_monitor_bt_ctr(btcoexist);
> -	btc8821a1ant_mon_bt_en_dis(btcoexist);
> -#else
> -	if (halbtc8821a1ant_Is_wifi_status_changed(btcoexist) ||
> -	    coex_dm->auto_tdma_adjust) {
> -		if (coex_sta->special_pkt_period_cnt > 2)
> -			halbtc8821a1ant_run_coexist_mechanism(btcoexist);
> -	}
> -
> -	coex_sta->special_pkt_period_cnt++;
> -#endif
> -}
> diff --git a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.h b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.h
> index 20e9048..c3eab15 100644
> --- a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.h
> +++ b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a1ant.h
> @@ -168,21 +168,7 @@ struct coex_sta_8821a_1ant {
>    * The following is interface which will notify coex module.
>    *===========================================
>    */
> -void ex_halbtc8821a1ant_init_hwconfig(struct btc_coexist *btcoexist);
> -void ex_halbtc8821a1ant_init_coex_dm(struct btc_coexist *btcoexist);
> -void ex_halbtc8821a1ant_ips_notify(struct btc_coexist *btcoexist, u8 type);
> -void ex_halbtc8821a1ant_lps_notify(struct btc_coexist *btcoexist, u8 type);
> -void ex_halbtc8821a1ant_scan_notify(struct btc_coexist *btcoexist, u8 type);
> -void ex_halbtc8821a1ant_connect_notify(struct btc_coexist *btcoexist, u8 type);
>   void ex_halbtc8821a1ant_media_status_notify(struct btc_coexist *btcoexist,
>   					    u8 type);
> -void ex_halbtc8821a1ant_special_packet_notify(struct btc_coexist *btcoexist,
> -					      u8 type);
> -void ex_halbtc8821a1ant_bt_info_notify(struct btc_coexist *btcoexist,
> -				       u8 *tmpbuf, u8 length);
> -void ex_halbtc8821a1ant_halt_notify(struct btc_coexist *btcoexist);
> -void ex_halbtc8821a1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnpstate);
> -void ex_halbtc8821a1ant_periodical(struct btc_coexist *btcoexist);
> -void ex_halbtc8821a1ant_display_coex_info(struct btc_coexist *btcoexist);
>   void ex_halbtc8821a1ant_dbg_control(struct btc_coexist *btcoexist, u8 op_code,
>   				    u8 op_len, u8 *data);
>

^ permalink raw reply

* Re: [PATCH net-next v2] tcp: avoid reducing cwnd when ACK+DSACK is received
From: Eric Dumazet @ 2015-01-10 17:37 UTC (permalink / raw)
  To: Sébastien Barré
  Cc: Yuchung Cheng, Neal Cardwell, David Miller, Netdev, Gregory Detal,
	Nandita Dukkipati
In-Reply-To: <54B11255.7000500@uclouvain.be>

On Sat, 2015-01-10 at 12:51 +0100, Sébastien Barré wrote:

> That looks much more readable compared to my v2.
> It is currently passing our tests (These are in fact MPTCP tests appart 
> from Neal's packetdrill that I will add, but actually the MPTCP stack 
> happens to reveal this situation quite easily, I think because in MPTCP, 
> we store the send queue in the "meta-flow", which currently cannot be 
> used for tail loss probes).
> 
> As probably everyone will be happy with this (Eric as well ?), I suggest 
> I prepare a v3 once all our tests are passed as well, with Yuchung's 
> structure and Neal's packetdrill test in the commit text. Will also add 
> proper credit as there is now stuff from several people in those few 
> lines now :-).
> 
> Looks good ?

Definitely !

Thanks !

^ permalink raw reply

* [PATCH 2/6] netfilter: nf_tables: fix port natting in little endian archs
From: Pablo Neira Ayuso @ 2015-01-10 18:50 UTC (permalink / raw)
  To: netfilter-devel; +Cc: davem, netdev
In-Reply-To: <1420915808-7160-1-git-send-email-pablo@netfilter.org>

From: leroy christophe <christophe.leroy@c-s.fr>

Make sure this fetches 16-bits port data from the register.
Remove casting to make sparse happy, not needed anymore.

Signed-off-by: leroy christophe <christophe.leroy@c-s.fr>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/ipv4/netfilter/nft_redir_ipv4.c |    8 ++++----
 net/ipv6/netfilter/nft_redir_ipv6.c |    8 ++++----
 net/netfilter/nft_nat.c             |    8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/net/ipv4/netfilter/nft_redir_ipv4.c b/net/ipv4/netfilter/nft_redir_ipv4.c
index ff2d23d..6ecfce6 100644
--- a/net/ipv4/netfilter/nft_redir_ipv4.c
+++ b/net/ipv4/netfilter/nft_redir_ipv4.c
@@ -27,10 +27,10 @@ static void nft_redir_ipv4_eval(const struct nft_expr *expr,
 
 	memset(&mr, 0, sizeof(mr));
 	if (priv->sreg_proto_min) {
-		mr.range[0].min.all = (__force __be16)
-					data[priv->sreg_proto_min].data[0];
-		mr.range[0].max.all = (__force __be16)
-					data[priv->sreg_proto_max].data[0];
+		mr.range[0].min.all =
+			*(__be16 *)&data[priv->sreg_proto_min].data[0];
+		mr.range[0].max.all =
+			*(__be16 *)&data[priv->sreg_proto_max].data[0];
 		mr.range[0].flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
 	}
 
diff --git a/net/ipv6/netfilter/nft_redir_ipv6.c b/net/ipv6/netfilter/nft_redir_ipv6.c
index 2433a6b..11820b6 100644
--- a/net/ipv6/netfilter/nft_redir_ipv6.c
+++ b/net/ipv6/netfilter/nft_redir_ipv6.c
@@ -27,10 +27,10 @@ static void nft_redir_ipv6_eval(const struct nft_expr *expr,
 
 	memset(&range, 0, sizeof(range));
 	if (priv->sreg_proto_min) {
-		range.min_proto.all = (__force __be16)
-					data[priv->sreg_proto_min].data[0];
-		range.max_proto.all = (__force __be16)
-					data[priv->sreg_proto_max].data[0];
+		range.min_proto.all =
+			*(__be16 *)&data[priv->sreg_proto_min].data[0];
+		range.max_proto.all =
+			*(__be16 *)&data[priv->sreg_proto_max].data[0];
 		range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
 	}
 
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c
index afe2b0b..aff54fb1 100644
--- a/net/netfilter/nft_nat.c
+++ b/net/netfilter/nft_nat.c
@@ -65,10 +65,10 @@ static void nft_nat_eval(const struct nft_expr *expr,
 	}
 
 	if (priv->sreg_proto_min) {
-		range.min_proto.all = (__force __be16)
-					data[priv->sreg_proto_min].data[0];
-		range.max_proto.all = (__force __be16)
-					data[priv->sreg_proto_max].data[0];
+		range.min_proto.all =
+			*(__be16 *)&data[priv->sreg_proto_min].data[0];
+		range.max_proto.all =
+			*(__be16 *)&data[priv->sreg_proto_max].data[0];
 		range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
 	}
 
-- 
1.7.10.4

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox