Netdev List
 help / color / mirror / Atom feed
* [net-next v2 00/17][pull request] Intel Wired LAN Driver Updates 2015-01-16
From: Jeff Kirsher @ 2015-01-16 13:28 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, nhorman, sassmann, jogreene

This series contains updates to i40e and i40evf.

This series is a little bit larger than normal because two of the patches are
version bumps.

Shannon provides tweaks to i40e and i40evf to keep the firmware, software
and silicon validation in line together by removing unused and
deprecated code, adding define for iSCSI and fix queue mask size.  Fix
i40e so we do not give up in the reset/rebuild process if DCB setup
fails, just handle it the same as in the probe setup.  Cleans up PTP
log messages by removing the use of __func__ as we are not using that
any longer and removes the netdev name, since that can change and can
be misleading.  Adds struct size checks to indirect and command
structs that were left out previously.  Added admin queue API updates
(LLDP control, OEM OCSD and OCBB commands).

Kevin increases ASQ timeout for scenarios with multi-function devices.

Carolyn fixes a problem where the interrupts descriptions from the MSIx
configuration were truncating the needed bus info, which makes it hard
to distinguish configurations from port to port.  Increased the string
buffer size in order to allow the full data to be displayed.

Sravanthi cleans up the dump stats string from debugfs.

Jacob updates i40e to only enable the PTP interrupt in PFs which have PTP
enabled, instead of blindly enabling the PTP interrupt flags for all PFs.
Also updated i40e so that we do not do Tx or Rx timestamps if we do not
have PTP enabled.  Added the same check against pf->ptp_rx as we have
in Rx timestamp code path because it is possible that the user can
configure only Tx hardware timestamping so we do not want to check for
Rx timestamp hang since the software won't be handling them.

Neerav updates the driver to disable firmware LLDP agent for NICs with
a firmware version lower than v4.3 and added a message when this happens.
Adds parsing and reporting of iSCSI capability for a given device or
function, as well as adding support for iSCSI partition type with DCB
in NPAR mode.

v2:
 - Dropped patch 10 "i40e: clean up PTP log messages" based on feedback
   from David Laight and David Miller
 - Split up the original patch 13 "i40e: AQ API updates for new commands"
   into 2 patches (now #12 & #13) based on feedback from Or Gerlitz

The following are changes since commit 919d9db9521862d01712d9be25cd6ebfcc353eed:
  netlink: Fix netlink_insert EADDRINUSE error
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master

Carolyn Wyborny (2):
  i40e: fix proc/int descriptions
  i40e: Add define for interrupt name string len

Catherine Sullivan (1):
  i40e/i40evf: Bump i40e/i40evf versions

Jacob Keller (4):
  i40e: only enable PTP interrupt cause if PTP is enabled
  i40e: check I40E_FLAG_PTP before handling Tx or Rx timestamps
  i40e: use same check for Rx hang as for Rx timestamps
  i40e: when Rx timestamps disabled set specific mode

Jeff Kirsher (1):
  i40e: AQ API updates

Kevin Scott (1):
  i40e/i40evf: Increase ASQ timeout

Neerav Parikh (2):
  i40e: Issue "Stop LLDP" command for firmware older than v4.3
  i40e: Support for NPAR iSCSI partition with DCB

Shannon Nelson (4):
  i40e/i40evf: AdminQ updates ww36
  i40e: don't give up on DCB error after reset
  i40e: add more struct size checks
  i40e: AQ API updates for new commands

Sravanthi Tangeda (2):
  i40e: Dump Stats string removed from debugfs help command
  i40e/i40evf: Bump i40e and i40evf versions

 drivers/net/ethernet/intel/i40e/i40e.h             |   5 +-
 drivers/net/ethernet/intel/i40e/i40e_adminq.h      |   2 +-
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h  | 152 +++++++++++++++++++--
 drivers/net/ethernet/intel/i40e/i40e_common.c      |   5 +
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c     |   1 -
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 120 +++++++++++-----
 drivers/net/ethernet/intel/i40e/i40e_ptp.c         |  44 ++++--
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        |   3 +
 drivers/net/ethernet/intel/i40e/i40e_type.h        |   1 +
 drivers/net/ethernet/intel/i40evf/i40e_adminq.h    |   2 +-
 .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h    | 108 +++++++++++++--
 drivers/net/ethernet/intel/i40evf/i40e_type.h      |   1 +
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    |   2 +-
 13 files changed, 365 insertions(+), 81 deletions(-)

-- 
1.9.3

^ permalink raw reply

* [PATCH] net: wireless: atmel: Remove open-coded and wrong strcasecmp
From: Rasmus Villemoes @ 2015-01-16 13:28 UTC (permalink / raw)
  To: Simon Kelley, Kalle Valo
  Cc: Rasmus Villemoes, linux-wireless, netdev, linux-kernel

The kernel's string library does in fact have strcasecmp, at least
since ded220bd8f08. Moreover, this open-coded version is in fact
wrong: If the strings only differ in their last character, a and b
have already been incremented to point to the terminating nul bytes,
so they would be treated as equal.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/net/wireless/atmel.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 9183f1cf89a7..55db9f03eb2a 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -45,7 +45,6 @@
 #include <linux/ptrace.h>
 #include <linux/slab.h>
 #include <linux/string.h>
-#include <linux/ctype.h>
 #include <linux/timer.h>
 #include <asm/byteorder.h>
 #include <asm/io.h>
@@ -2699,16 +2698,7 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 		domain[REGDOMAINSZ] = 0;
 		rc = -EINVAL;
 		for (i = 0; i < ARRAY_SIZE(channel_table); i++) {
-			/* strcasecmp doesn't exist in the library */
-			char *a = channel_table[i].name;
-			char *b = domain;
-			while (*a) {
-				char c1 = *a++;
-				char c2 = *b++;
-				if (tolower(c1) != tolower(c2))
-					break;
-			}
-			if (!*a && !*b) {
+			if (!strcasecmp(channel_table[i].name, domain)) {
 				priv->config_reg_domain = channel_table[i].reg_domain;
 				rc = 0;
 			}
-- 
2.1.3

^ permalink raw reply related

* [PATCH net-next 5/5] qeth: Remove unneeded structure member
From: Ursula Braun @ 2015-01-16 13:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, ursula.braun, ubraun, Thomas Richter
In-Reply-To: <1421413549-56937-1-git-send-email-ubraun@linux.vnet.ibm.com>

From: Thomas Richter <tmricht@linux.vnet.ibm.com>

The member irq_tasklet in the qeth_channel structure
is not referenced anymore and is removed from the
structure.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
 drivers/s390/net/qeth_core.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index 7a8bb9f..3abac02 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -596,7 +596,6 @@ struct qeth_channel {
 	struct ccw1 ccw;
 	spinlock_t iob_lock;
 	wait_queue_head_t wait_q;
-	struct tasklet_struct irq_tasklet;
 	struct ccw_device *ccwdev;
 /*command buffer for control data*/
 	struct qeth_cmd_buffer iob[QETH_CMD_BUFFER_NO];
-- 
2.1.4

^ permalink raw reply related

* [PATCH net-next 4/5] qeth: sysfs: replace strcmp() with sysfs_streq()
From: Ursula Braun @ 2015-01-16 13:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, ursula.braun, ubraun, Eugene Crosser
In-Reply-To: <1421413549-56937-1-git-send-email-ubraun@linux.vnet.ibm.com>

From: Eugene Crosser <Eugene.Crosser@ru.ibm.com>

Replace combination of strsep() and a temporary char *
followed by a series of "if (!strcmp(...))" with a series
of "if (sysfs_streq(...))".

Signed-off-by: Eugene Crosser <Eugene.Crosser@ru.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Reviewed-by: Thomas-Mich Richter <tmricht@de.ibm.com>
---
 drivers/s390/net/qeth_core_sys.c | 38 ++++++++++++++----------------------
 drivers/s390/net/qeth_l3_sys.c   | 42 ++++++++++++++++------------------------
 2 files changed, 32 insertions(+), 48 deletions(-)

diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
index 8c76574..423bec5 100644
--- a/drivers/s390/net/qeth_core_sys.c
+++ b/drivers/s390/net/qeth_core_sys.c
@@ -231,7 +231,6 @@ static ssize_t qeth_dev_prioqing_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct qeth_card *card = dev_get_drvdata(dev);
-	char *tmp;
 	int rc = 0;
 
 	if (!card)
@@ -253,36 +252,35 @@ static ssize_t qeth_dev_prioqing_store(struct device *dev,
 		goto out;
 	}
 
-	tmp = strsep((char **) &buf, "\n");
-	if (!strcmp(tmp, "prio_queueing_prec")) {
+	if (sysfs_streq(buf, "prio_queueing_prec")) {
 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_PREC;
 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
-	} else if (!strcmp(tmp, "prio_queueing_skb")) {
+	} else if (sysfs_streq(buf, "prio_queueing_skb")) {
 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_SKB;
 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
-	} else if (!strcmp(tmp, "prio_queueing_tos")) {
+	} else if (sysfs_streq(buf, "prio_queueing_tos")) {
 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_TOS;
 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
-	} else if (!strcmp(tmp, "prio_queueing_vlan")) {
+	} else if (sysfs_streq(buf, "prio_queueing_vlan")) {
 		if (!card->options.layer2) {
 			rc = -ENOTSUPP;
 			goto out;
 		}
 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_VLAN;
 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
-	} else if (!strcmp(tmp, "no_prio_queueing:0")) {
+	} else if (sysfs_streq(buf, "no_prio_queueing:0")) {
 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
 		card->qdio.default_out_queue = 0;
-	} else if (!strcmp(tmp, "no_prio_queueing:1")) {
+	} else if (sysfs_streq(buf, "no_prio_queueing:1")) {
 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
 		card->qdio.default_out_queue = 1;
-	} else if (!strcmp(tmp, "no_prio_queueing:2")) {
+	} else if (sysfs_streq(buf, "no_prio_queueing:2")) {
 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
 		card->qdio.default_out_queue = 2;
-	} else if (!strcmp(tmp, "no_prio_queueing:3")) {
+	} else if (sysfs_streq(buf, "no_prio_queueing:3")) {
 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
 		card->qdio.default_out_queue = 3;
-	} else if (!strcmp(tmp, "no_prio_queueing")) {
+	} else if (sysfs_streq(buf, "no_prio_queueing")) {
 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
 	} else
@@ -497,8 +495,6 @@ static ssize_t qeth_dev_isolation_store(struct device *dev,
 	struct qeth_card *card = dev_get_drvdata(dev);
 	enum qeth_ipa_isolation_modes isolation;
 	int rc = 0;
-	char *tmp, *curtoken;
-	curtoken = (char *) buf;
 
 	if (!card)
 		return -EINVAL;
@@ -515,12 +511,11 @@ static ssize_t qeth_dev_isolation_store(struct device *dev,
 	}
 
 	/* parse input into isolation mode */
-	tmp = strsep(&curtoken, "\n");
-	if (!strcmp(tmp, ATTR_QETH_ISOLATION_NONE)) {
+	if (sysfs_streq(buf, ATTR_QETH_ISOLATION_NONE)) {
 		isolation = ISOLATION_MODE_NONE;
-	} else if (!strcmp(tmp, ATTR_QETH_ISOLATION_FWD)) {
+	} else if (sysfs_streq(buf, ATTR_QETH_ISOLATION_FWD)) {
 		isolation = ISOLATION_MODE_FWD;
-	} else if (!strcmp(tmp, ATTR_QETH_ISOLATION_DROP)) {
+	} else if (sysfs_streq(buf, ATTR_QETH_ISOLATION_DROP)) {
 		isolation = ISOLATION_MODE_DROP;
 	} else {
 		rc = -EINVAL;
@@ -597,9 +592,7 @@ static ssize_t qeth_hw_trap_store(struct device *dev,
 {
 	struct qeth_card *card = dev_get_drvdata(dev);
 	int rc = 0;
-	char *tmp, *curtoken;
 	int state = 0;
-	curtoken = (char *)buf;
 
 	if (!card)
 		return -EINVAL;
@@ -607,9 +600,8 @@ static ssize_t qeth_hw_trap_store(struct device *dev,
 	mutex_lock(&card->conf_mutex);
 	if (qeth_card_hw_is_reachable(card))
 		state = 1;
-	tmp = strsep(&curtoken, "\n");
 
-	if (!strcmp(tmp, "arm") && !card->info.hwtrap) {
+	if (sysfs_streq(buf, "arm") && !card->info.hwtrap) {
 		if (state) {
 			if (qeth_is_diagass_supported(card,
 			    QETH_DIAGS_CMD_TRAP)) {
@@ -620,14 +612,14 @@ static ssize_t qeth_hw_trap_store(struct device *dev,
 				rc = -EINVAL;
 		} else
 			card->info.hwtrap = 1;
-	} else if (!strcmp(tmp, "disarm") && card->info.hwtrap) {
+	} else if (sysfs_streq(buf, "disarm") && card->info.hwtrap) {
 		if (state) {
 			rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM);
 			if (!rc)
 				card->info.hwtrap = 0;
 		} else
 			card->info.hwtrap = 0;
-	} else if (!strcmp(tmp, "trap") && state && card->info.hwtrap)
+	} else if (sysfs_streq(buf, "trap") && state && card->info.hwtrap)
 		rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_CAPTURE);
 	else
 		rc = -EINVAL;
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
index c4dcd66..386eb7b 100644
--- a/drivers/s390/net/qeth_l3_sys.c
+++ b/drivers/s390/net/qeth_l3_sys.c
@@ -57,22 +57,20 @@ static ssize_t qeth_l3_dev_route_store(struct qeth_card *card,
 		const char *buf, size_t count)
 {
 	enum qeth_routing_types old_route_type = route->type;
-	char *tmp;
 	int rc = 0;
 
-	tmp = strsep((char **) &buf, "\n");
 	mutex_lock(&card->conf_mutex);
-	if (!strcmp(tmp, "no_router")) {
+	if (sysfs_streq(buf, "no_router")) {
 		route->type = NO_ROUTER;
-	} else if (!strcmp(tmp, "primary_connector")) {
+	} else if (sysfs_streq(buf, "primary_connector")) {
 		route->type = PRIMARY_CONNECTOR;
-	} else if (!strcmp(tmp, "secondary_connector")) {
+	} else if (sysfs_streq(buf, "secondary_connector")) {
 		route->type = SECONDARY_CONNECTOR;
-	} else if (!strcmp(tmp, "primary_router")) {
+	} else if (sysfs_streq(buf, "primary_router")) {
 		route->type = PRIMARY_ROUTER;
-	} else if (!strcmp(tmp, "secondary_router")) {
+	} else if (sysfs_streq(buf, "secondary_router")) {
 		route->type = SECONDARY_ROUTER;
-	} else if (!strcmp(tmp, "multicast_router")) {
+	} else if (sysfs_streq(buf, "multicast_router")) {
 		route->type = MULTICAST_ROUTER;
 	} else {
 		rc = -EINVAL;
@@ -370,7 +368,6 @@ static ssize_t qeth_l3_dev_ipato_enable_store(struct device *dev,
 {
 	struct qeth_card *card = dev_get_drvdata(dev);
 	struct qeth_ipaddr *tmpipa, *t;
-	char *tmp;
 	int rc = 0;
 
 	if (!card)
@@ -383,10 +380,9 @@ static ssize_t qeth_l3_dev_ipato_enable_store(struct device *dev,
 		goto out;
 	}
 
-	tmp = strsep((char **) &buf, "\n");
-	if (!strcmp(tmp, "toggle")) {
+	if (sysfs_streq(buf, "toggle")) {
 		card->ipato.enabled = (card->ipato.enabled)? 0 : 1;
-	} else if (!strcmp(tmp, "1")) {
+	} else if (sysfs_streq(buf, "1")) {
 		card->ipato.enabled = 1;
 		list_for_each_entry_safe(tmpipa, t, card->ip_tbd_list, entry) {
 			if ((tmpipa->type == QETH_IP_TYPE_NORMAL) &&
@@ -395,7 +391,7 @@ static ssize_t qeth_l3_dev_ipato_enable_store(struct device *dev,
 					QETH_IPA_SETIP_TAKEOVER_FLAG;
 		}
 
-	} else if (!strcmp(tmp, "0")) {
+	} else if (sysfs_streq(buf, "0")) {
 		card->ipato.enabled = 0;
 		list_for_each_entry_safe(tmpipa, t, card->ip_tbd_list, entry) {
 			if (tmpipa->set_flags &
@@ -430,21 +426,19 @@ static ssize_t qeth_l3_dev_ipato_invert4_store(struct device *dev,
 				const char *buf, size_t count)
 {
 	struct qeth_card *card = dev_get_drvdata(dev);
-	char *tmp;
 	int rc = 0;
 
 	if (!card)
 		return -EINVAL;
 
 	mutex_lock(&card->conf_mutex);
-	tmp = strsep((char **) &buf, "\n");
-	if (!strcmp(tmp, "toggle")) {
+	if (sysfs_streq(buf, "toggle"))
 		card->ipato.invert4 = (card->ipato.invert4)? 0 : 1;
-	} else if (!strcmp(tmp, "1")) {
+	else if (sysfs_streq(buf, "1"))
 		card->ipato.invert4 = 1;
-	} else if (!strcmp(tmp, "0")) {
+	else if (sysfs_streq(buf, "0"))
 		card->ipato.invert4 = 0;
-	} else
+	else
 		rc = -EINVAL;
 	mutex_unlock(&card->conf_mutex);
 	return rc ? rc : count;
@@ -612,21 +606,19 @@ static ssize_t qeth_l3_dev_ipato_invert6_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct qeth_card *card = dev_get_drvdata(dev);
-	char *tmp;
 	int rc = 0;
 
 	if (!card)
 		return -EINVAL;
 
 	mutex_lock(&card->conf_mutex);
-	tmp = strsep((char **) &buf, "\n");
-	if (!strcmp(tmp, "toggle")) {
+	if (sysfs_streq(buf, "toggle"))
 		card->ipato.invert6 = (card->ipato.invert6)? 0 : 1;
-	} else if (!strcmp(tmp, "1")) {
+	else if (sysfs_streq(buf, "1"))
 		card->ipato.invert6 = 1;
-	} else if (!strcmp(tmp, "0")) {
+	else if (sysfs_streq(buf, "0"))
 		card->ipato.invert6 = 0;
-	} else
+	else
 		rc = -EINVAL;
 	mutex_unlock(&card->conf_mutex);
 	return rc ? rc : count;
-- 
2.1.4

^ permalink raw reply related

* [PATCH net-next 3/5] qeth: use qeth_card_hw_is_reachable() everywhere
From: Ursula Braun @ 2015-01-16 13:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, ursula.braun, ubraun, Eugene Crosser
In-Reply-To: <1421413549-56937-1-git-send-email-ubraun@linux.vnet.ibm.com>

From: Eugene Crosser <Eugene.Crosser@ru.ibm.com>

qeth_card_hw_is_reachable() was introduced as part of a new
functionality, but it is a useful abstraction that can replace
verbose checks througout the rest of the `qeth` driver.

Signed-off-by: Eugene Crosser <Eugene.Crosser@ru.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Reviewed-by: Thomas-Mich Richter <tmricht@de.ibm.com>
---
 drivers/s390/net/qeth_core_sys.c | 7 +++----
 drivers/s390/net/qeth_l2_main.c  | 6 ++----
 drivers/s390/net/qeth_l3_main.c  | 7 ++-----
 drivers/s390/net/qeth_l3_sys.c   | 3 +--
 4 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
index 15523f0..8c76574 100644
--- a/drivers/s390/net/qeth_core_sys.c
+++ b/drivers/s390/net/qeth_core_sys.c
@@ -531,8 +531,7 @@ static ssize_t qeth_dev_isolation_store(struct device *dev,
 	/* defer IP assist if device is offline (until discipline->set_online)*/
 	card->options.prev_isolation = card->options.isolation;
 	card->options.isolation = isolation;
-	if (card->state == CARD_STATE_SOFTSETUP ||
-	    card->state == CARD_STATE_UP) {
+	if (qeth_card_hw_is_reachable(card)) {
 		int ipa_rc = qeth_set_access_ctrl_online(card, 1);
 		if (ipa_rc != 0)
 			rc = ipa_rc;
@@ -555,7 +554,7 @@ static ssize_t qeth_dev_switch_attrs_show(struct device *dev,
 	if (!card)
 		return -EINVAL;
 
-	if (card->state != CARD_STATE_SOFTSETUP && card->state != CARD_STATE_UP)
+	if (!qeth_card_hw_is_reachable(card))
 		return sprintf(buf, "n/a\n");
 
 	rc = qeth_query_switch_attributes(card, &sw_info);
@@ -606,7 +605,7 @@ static ssize_t qeth_hw_trap_store(struct device *dev,
 		return -EINVAL;
 
 	mutex_lock(&card->conf_mutex);
-	if (card->state == CARD_STATE_SOFTSETUP || card->state == CARD_STATE_UP)
+	if (qeth_card_hw_is_reachable(card))
 		state = 1;
 	tmp = strsep(&curtoken, "\n");
 
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index d02cd1a..f5f409d 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -48,8 +48,7 @@ static int qeth_l2_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	if (!card)
 		return -ENODEV;
 
-	if ((card->state != CARD_STATE_UP) &&
-		(card->state != CARD_STATE_SOFTSETUP))
+	if (!qeth_card_hw_is_reachable(card))
 		return -ENODEV;
 
 	if (card->info.type == QETH_CARD_TYPE_OSN)
@@ -1344,8 +1343,7 @@ int qeth_osn_assist(struct net_device *dev, void *data, int data_len)
 	if (!card)
 		return -ENODEV;
 	QETH_CARD_TEXT(card, 2, "osnsdmc");
-	if ((card->state != CARD_STATE_UP) &&
-	    (card->state != CARD_STATE_SOFTSETUP))
+	if (!qeth_card_hw_is_reachable(card))
 		return -ENODEV;
 	iob = qeth_wait_for_buffer(&card->write);
 	memcpy(iob->data+IPA_PDU_HEADER_SIZE, data, data_len);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index dd4ab8d..1432b10 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -432,10 +432,8 @@ void qeth_l3_set_ip_addr_list(struct qeth_card *card)
 	QETH_CARD_TEXT(card, 2, "sdiplist");
 	QETH_CARD_HEX(card, 2, &card, sizeof(void *));
 
-	if ((card->state != CARD_STATE_UP &&
-	     card->state != CARD_STATE_SOFTSETUP) || card->options.sniffer) {
+	if (!qeth_card_hw_is_reachable(card) || card->options.sniffer)
 		return;
-	}
 
 	spin_lock_irqsave(&card->ip_lock, flags);
 	tbd_list = card->ip_tbd_list;
@@ -2626,8 +2624,7 @@ static int qeth_l3_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	if (!card)
 		return -ENODEV;
 
-	if ((card->state != CARD_STATE_UP) &&
-		(card->state != CARD_STATE_SOFTSETUP))
+	if (!qeth_card_hw_is_reachable(card))
 		return -ENODEV;
 
 	switch (cmd) {
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
index adef5f5..c4dcd66 100644
--- a/drivers/s390/net/qeth_l3_sys.c
+++ b/drivers/s390/net/qeth_l3_sys.c
@@ -78,8 +78,7 @@ static ssize_t qeth_l3_dev_route_store(struct qeth_card *card,
 		rc = -EINVAL;
 		goto out;
 	}
-	if (((card->state == CARD_STATE_SOFTSETUP) ||
-	     (card->state == CARD_STATE_UP)) &&
+	if (qeth_card_hw_is_reachable(card) &&
 	    (old_route_type != route->type)) {
 		if (prot == QETH_PROT_IPV4)
 			rc = qeth_l3_setrouting_v4(card);
-- 
2.1.4

^ permalink raw reply related

* [PATCH net-next 2/5] s390/net: Delete useless checks before function calls
From: Ursula Braun @ 2015-01-16 13:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, ursula.braun, ubraun, Markus Elfring
In-Reply-To: <1421413549-56937-1-git-send-email-ubraun@linux.vnet.ibm.com>

From: Markus Elfring <elfring@users.sourceforge.net>

The function debug_unregister() tests whether its argument is
NULL and then returns immediately. Thus the test around the call
is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>

---
 drivers/s390/net/claw.c    | 6 ++----
 drivers/s390/net/lcs.c     | 6 ++----
 drivers/s390/net/netiucv.c | 9 +++------
 3 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index 213e54e..d609ca0 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -109,10 +109,8 @@ static debug_info_t *claw_dbf_trace;
 static void
 claw_unregister_debug_facility(void)
 {
-	if (claw_dbf_setup)
-		debug_unregister(claw_dbf_setup);
-	if (claw_dbf_trace)
-		debug_unregister(claw_dbf_trace);
+	debug_unregister(claw_dbf_setup);
+	debug_unregister(claw_dbf_trace);
 }
 
 static int
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 92190aa..00b7d9c 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -88,10 +88,8 @@ static debug_info_t *lcs_dbf_trace;
 static void
 lcs_unregister_debug_facility(void)
 {
-	if (lcs_dbf_setup)
-		debug_unregister(lcs_dbf_setup);
-	if (lcs_dbf_trace)
-		debug_unregister(lcs_dbf_trace);
+	debug_unregister(lcs_dbf_setup);
+	debug_unregister(lcs_dbf_trace);
 }
 
 static int
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 7e91f54..33f7040 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -487,12 +487,9 @@ DEFINE_PER_CPU(char[256], iucv_dbf_txt_buf);
 
 static void iucv_unregister_dbf_views(void)
 {
-	if (iucv_dbf_setup)
-		debug_unregister(iucv_dbf_setup);
-	if (iucv_dbf_data)
-		debug_unregister(iucv_dbf_data);
-	if (iucv_dbf_trace)
-		debug_unregister(iucv_dbf_trace);
+	debug_unregister(iucv_dbf_setup);
+	debug_unregister(iucv_dbf_data);
+	debug_unregister(iucv_dbf_trace);
 }
 static int iucv_register_dbf_views(void)
 {
-- 
2.1.4

^ permalink raw reply related

* [PATCH net-next 1/5] s390/ctcm,netiucv: migrate variables to handle y2038 problem
From: Ursula Braun @ 2015-01-16 13:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, ursula.braun, ubraun, Aya Mahfouz
In-Reply-To: <1421413549-56937-1-git-send-email-ubraun@linux.vnet.ibm.com>

From: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>

This patch is concerned with migrating the time variables for the s390
network drivers. The changes handle the y2038 problem where timespec will
overflow in the year 2038. timespec was replaced by unsigned long and
all time variables get their values from the jiffies global variable.
This was done for the sake of speed and efficiency.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
 drivers/s390/net/ctcm_fsms.c  | 18 +++++++-----------
 drivers/s390/net/ctcm_main.c  |  4 ++--
 drivers/s390/net/ctcm_main.h  |  2 +-
 drivers/s390/net/ctcm_sysfs.c |  4 ++--
 drivers/s390/net/netiucv.c    |  6 +++---
 5 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/drivers/s390/net/ctcm_fsms.c b/drivers/s390/net/ctcm_fsms.c
index fb92524..fd5944b 100644
--- a/drivers/s390/net/ctcm_fsms.c
+++ b/drivers/s390/net/ctcm_fsms.c
@@ -251,13 +251,11 @@ static void chx_txdone(fsm_instance *fi, int event, void *arg)
 	int first = 1;
 	int i;
 	unsigned long duration;
-	struct timespec done_stamp = current_kernel_time(); /* xtime */
+	unsigned long done_stamp = jiffies;
 
 	CTCM_PR_DEBUG("%s(%s): %s\n", __func__, ch->id, dev->name);
 
-	duration =
-	    (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 +
-	    (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000;
+	duration = done_stamp - ch->prof.send_stamp;
 	if (duration > ch->prof.tx_time)
 		ch->prof.tx_time = duration;
 
@@ -307,7 +305,7 @@ static void chx_txdone(fsm_instance *fi, int event, void *arg)
 		spin_unlock(&ch->collect_lock);
 		ch->ccw[1].count = ch->trans_skb->len;
 		fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch);
-		ch->prof.send_stamp = current_kernel_time(); /* xtime */
+		ch->prof.send_stamp = jiffies;
 		rc = ccw_device_start(ch->cdev, &ch->ccw[0],
 						(unsigned long)ch, 0xff, 0);
 		ch->prof.doios_multi++;
@@ -1229,14 +1227,12 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg)
 	int		rc;
 	struct th_header *header;
 	struct pdu	*p_header;
-	struct timespec done_stamp = current_kernel_time(); /* xtime */
+	unsigned long done_stamp = jiffies;
 
 	CTCM_PR_DEBUG("Enter %s: %s cp:%i\n",
 			__func__, dev->name, smp_processor_id());
 
-	duration =
-		(done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 +
-		(done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000;
+	duration = done_stamp - ch->prof.send_stamp;
 	if (duration > ch->prof.tx_time)
 		ch->prof.tx_time = duration;
 
@@ -1361,7 +1357,7 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg)
 
 	ch->ccw[1].count = ch->trans_skb->len;
 	fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch);
-	ch->prof.send_stamp = current_kernel_time(); /* xtime */
+	ch->prof.send_stamp = jiffies;
 	if (do_debug_ccw)
 		ctcmpc_dumpit((char *)&ch->ccw[0], sizeof(struct ccw1) * 3);
 	rc = ccw_device_start(ch->cdev, &ch->ccw[0],
@@ -1827,7 +1823,7 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg)
 	fsm_newstate(wch->fsm, CTC_STATE_TX);
 
 	spin_lock_irqsave(get_ccwdev_lock(wch->cdev), saveflags);
-	wch->prof.send_stamp = current_kernel_time(); /* xtime */
+	wch->prof.send_stamp = jiffies;
 	rc = ccw_device_start(wch->cdev, &wch->ccw[3],
 					(unsigned long) wch, 0xff, 0);
 	spin_unlock_irqrestore(get_ccwdev_lock(wch->cdev), saveflags);
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index e056dd4..05c37d6 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -567,7 +567,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb)
 	fsm_newstate(ch->fsm, CTC_STATE_TX);
 	fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch);
 	spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
-	ch->prof.send_stamp = current_kernel_time(); /* xtime */
+	ch->prof.send_stamp = jiffies;
 	rc = ccw_device_start(ch->cdev, &ch->ccw[ccw_idx],
 					(unsigned long)ch, 0xff, 0);
 	spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
@@ -831,7 +831,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb)
 					sizeof(struct ccw1) * 3);
 
 	spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
-	ch->prof.send_stamp = current_kernel_time(); /* xtime */
+	ch->prof.send_stamp = jiffies;
 	rc = ccw_device_start(ch->cdev, &ch->ccw[ccw_idx],
 					(unsigned long)ch, 0xff, 0);
 	spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
diff --git a/drivers/s390/net/ctcm_main.h b/drivers/s390/net/ctcm_main.h
index 477c933..6f4417c 100644
--- a/drivers/s390/net/ctcm_main.h
+++ b/drivers/s390/net/ctcm_main.h
@@ -121,7 +121,7 @@ struct ctcm_profile {
 	unsigned long doios_multi;
 	unsigned long txlen;
 	unsigned long tx_time;
-	struct timespec send_stamp;
+	unsigned long send_stamp;
 };
 
 /*
diff --git a/drivers/s390/net/ctcm_sysfs.c b/drivers/s390/net/ctcm_sysfs.c
index 47773c4..ddb0aa3 100644
--- a/drivers/s390/net/ctcm_sysfs.c
+++ b/drivers/s390/net/ctcm_sysfs.c
@@ -100,8 +100,8 @@ static void ctcm_print_statistics(struct ctcm_priv *priv)
 		     priv->channel[WRITE]->prof.doios_multi);
 	p += sprintf(p, "  Netto bytes written: %ld\n",
 		     priv->channel[WRITE]->prof.txlen);
-	p += sprintf(p, "  Max. TX IO-time: %ld\n",
-		     priv->channel[WRITE]->prof.tx_time);
+	p += sprintf(p, "  Max. TX IO-time: %u\n",
+		     jiffies_to_usecs(priv->channel[WRITE]->prof.tx_time));
 
 	printk(KERN_INFO "Statistics for %s:\n%s",
 				priv->channel[CTCM_WRITE]->netdev->name, sbuf);
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 0a87809..7e91f54 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -178,7 +178,7 @@ struct connection_profile {
 	unsigned long doios_multi;
 	unsigned long txlen;
 	unsigned long tx_time;
-	struct timespec send_stamp;
+	unsigned long send_stamp;
 	unsigned long tx_pending;
 	unsigned long tx_max_pending;
 };
@@ -786,7 +786,7 @@ static void conn_action_txdone(fsm_instance *fi, int event, void *arg)
 
 	header.next = 0;
 	memcpy(skb_put(conn->tx_buff, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN);
-	conn->prof.send_stamp = current_kernel_time();
+	conn->prof.send_stamp = jiffies;
 	txmsg.class = 0;
 	txmsg.tag = 0;
 	rc = iucv_message_send(conn->path, &txmsg, 0, 0,
@@ -1220,7 +1220,7 @@ static int netiucv_transmit_skb(struct iucv_connection *conn,
 		memcpy(skb_put(nskb, NETIUCV_HDRLEN), &header,  NETIUCV_HDRLEN);
 
 		fsm_newstate(conn->fsm, CONN_STATE_TX);
-		conn->prof.send_stamp = current_kernel_time();
+		conn->prof.send_stamp = jiffies;
 
 		msg.tag = 1;
 		msg.class = 0;
-- 
2.1.4

^ permalink raw reply related

* [PATCH net-next 0/5] s390: network patches for net-next
From: Ursula Braun @ 2015-01-16 13:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, ursula.braun, ubraun

From: Ursula Braun <ursula.braun@de.ibm.com>

Hi Dave,

here are some s390 related patches for net-next

shortlog:

Aya Mahfouz (1)
ctcm,netiucv: migrate variables to handle y2038 problem

Markus Elfring (1)
s390/net: Delete useless checks before function calls

Eugene Crosser (2)
qeth: use qeth_card_hw_is_reachable() everywhere
qeth: sysfs: replace strcmp() with sysfs_streq()

Thomas-Mich Richter (1)
qeth: Remove unneeded structure member

Thanks,
        Ursula

^ permalink raw reply

* Re: fq_codel with 802.15.4 6LoWPAN fragmentation issue
From: Eric Dumazet @ 2015-01-16 13:04 UTC (permalink / raw)
  To: Alexander Aring; +Cc: netdev, linux-wpan, stephen, jukka.rissanen
In-Reply-To: <1421413211.11734.121.camel@edumazet-glaptop2.roam.corp.google.com>

On Fri, 2015-01-16 at 05:00 -0800, Eric Dumazet wrote:
> On Fri, 2015-01-16 at 04:57 -0800, Eric Dumazet wrote:
> >  example :
> > 
> 
> Sorry, one keyword was missing :
> 
> tc qdisc replace dev lowpan0 root fq_codel interval XXX
> 

But the parameter that you probably want to change is not the interval.
It is probably the target :

tc qdisc replace dev lowpan0 root fq_codel interval 200ms target 25ms

Now, if the fragmentation was done after qdisc dequeue, as in GSO layer,
you would not have this issue : all segments of one ipv6 message would
be transmitted, no matter what.

^ permalink raw reply

* Re: fq_codel with 802.15.4 6LoWPAN fragmentation issue
From: Eric Dumazet @ 2015-01-16 13:00 UTC (permalink / raw)
  To: Alexander Aring; +Cc: netdev, linux-wpan, stephen, jukka.rissanen
In-Reply-To: <1421413071.11734.120.camel@edumazet-glaptop2.roam.corp.google.com>

On Fri, 2015-01-16 at 04:57 -0800, Eric Dumazet wrote:
>  example :
> 

Sorry, one keyword was missing :

tc qdisc replace dev lowpan0 root fq_codel interval XXX

^ permalink raw reply

* Re: fq_codel with 802.15.4 6LoWPAN fragmentation issue
From: Eric Dumazet @ 2015-01-16 12:57 UTC (permalink / raw)
  To: Alexander Aring; +Cc: netdev, linux-wpan, stephen, jukka.rissanen
In-Reply-To: <20150116120232.GD10068@omega>

On Fri, 2015-01-16 at 13:02 +0100, Alexander Aring wrote:
> Hi,
> 
> when using "fq_codel" as network scheduler, I noticed an issue with IEEE
> 802.15.4 6LoWPAN fragmentation. The issue is that high payloads IPv6
> packets are dropped.
> 
> I detected the issue on the sending side which segments the 6LoWPAN
> packet into several fragments.
> 
> In the IEEE 802.15.4 6LoWPAN fragmentation we have a 6LoWPAN interface
> (MTU 1280) on top of an IEEE 802.15.4 interface (MTU 127). The 6LoWPAN
> fragmentation algorithm creates in the "ndo_start_xmit" netdev_ops
> callback function of the 6LoWPAN interface new sk_buffs for the
> underlaying IEEE 802.15.4 interface (as skb->dev) and sends them via a
> dev_queue_xmit.
> 
> IEEE 802.15.4 is a very slow connection and after each transmit there is
> an "interframe spacing time" which depends on frequency setting. In my
> testcase, that's about ~500 us for a payload above 18 bytes. This is
> done by calling netif_stop_queue for the interface and start a timer
> after each transmitted frame according to the interframe spacing time.
> When the timer fires, it wakes the queue again by calling
> netif_wake_queue.
> 
> Now: What I am noticed with fq_codel is that the code at [0] will drop
> high payloaded IPv6 packets. Of course, if we have an IPv6 packet of
> more than 1280 bytes payload we have a fragmentation (IPv6
> fragmentation) over a fragmentation (802.15.4 6LoWPAN fragmentation).
> 
> When I increase the "params->interval" parameter I can send a "longer"
> IPv6 packet depending how much I increase the "params->interval"
> parameter.
> 
> I assume that the "params->interval" which defaults to MS2TIME(100) is
> too small. I further assume that at the beginning of fragmentation the
> interval measurement starts "vars->first_above_time = now +
> params->interval;" (line 247 at [0]) and while sending several fragments
> with the above mentioned interframe spacing time, the sending takes too
> long and the skb will be dropped.
> 
> My questions are:
> 
> - What's the best way to deal with something like that?
> 
> - Is there a way to set the "params->interval" _per interface_? So I can
>   change the default parameter to a suitable value in the "ndo_init"
>   callback of the 6LoWPAN interface.
> 
> Thanks in advance.

Sure, fq_codel is a qdisc, each network device gets its own qdisc
hierarchy.

You can therefore set different parameter on your interface,

Very simple example :

tc qdisc dev lowpan0 root fq_codel interval XXX

^ permalink raw reply

* Re: Compile-time warnings on mlx4/net-next
From: Eric Dumazet @ 2015-01-16 12:54 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: Marcelo Ricardo Leitner, Or Gerlitz, netdev
In-Reply-To: <54B8F9D6.4050202@redhat.com>

On Fri, 2015-01-16 at 12:45 +0100, Daniel Borkmann wrote:
> On 01/15/2015 02:38 PM, Marcelo Ricardo Leitner wrote:
> > On 15-01-2015 11:20, Or Gerlitz wrote:
> ...
> >>> Do you see them too?
> >>
> >> using $ make W=1 -j 20 SUBDIRS=./drivers/net/ethernet/mellanox/mlx4 with gcc
> >> 4.8.2 I don't see that, but I'll look there,
> >> thanks for the report.
> 
> I believe they are there for quite some time already. I'm using gcc 4.8.3
> and just default build. I'm surprised Fengguang didn't complain yet (or
> he did, but it got ignored somehow ;)). The following should be sufficient
> to just shut gcc up:
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
> index 982861d..b01154d 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/fw.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
> @@ -2122,6 +2122,7 @@ int mlx4_config_dev_retrieval(struct mlx4_dev *dev,
>   	if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_CONFIG_DEV))
>   		return -ENOTSUPP;
> 
> +	memset(&config_dev, 0, sizeof(config_dev));
>   	err = mlx4_CONFIG_DEV_get(dev, &config_dev);
>   	if (err)
>   		return err;

Yeah, I reported the same issue some time back.

^ permalink raw reply

* Re: [PATCH] net: ipv4: Fix incorrect free in ICMP receive
From: Eric Dumazet @ 2015-01-16 12:52 UTC (permalink / raw)
  To: subashab; +Cc: netdev
In-Reply-To: <05e337f44c7a71ac317194cfa3dcdf62.squirrel@www.codeaurora.org>

On Fri, 2015-01-16 at 07:48 +0000, subashab@codeaurora.org wrote:
> An exception is seen in ICMP ping receive path where the skb
> destructor sock_rfree() tries to access a freed socket. This happens
> because ping_rcv() releases socket reference with sock_put() and this
> internally frees up the socket. Later icmp_rcv() will try to free the
> skb and as part of this, skb destructor is called and panics as the
> socket is freed already in ping_rcv().
> 
> WARN stack trace @       WARN_ON(atomic_read(&sk->sk_rmem_alloc));
> dump_backtrace+0x0/0x248
> show_stack+0x10/0x1c
> dump_stack+0x1c/0x28
> warn_slowpath_common+0x74/0x9c
> warn_slowpath_null+0x14/0x20
> inet_sock_destruct+0x130/0x1a0
> __sk_free+0x1c/0x168
> sk_free+0x24/0x30
> ping_rcv+0xf4/0x124
> icmp_rcv+0x224/0x2c4
> ip_local_deliver_finish+0x108/0x214
> ip_local_deliver+0x88/0xa0
> ip_rcv_finish+0x234/0x284
> ip_rcv+0x258/0x2e8
> __netif_receive_skb_core+0x640/0x6b4
> <snip>
> 
> -->|exception
> -007|sk_mem_uncharge
> -007|sock_rfree
> -008|skb_release_head_state
> -009|skb_release_all
> -009|__kfree_skb
> -010|kfree_skb
> -011|icmp_rcv
> -012|ip_local_deliver_finish
> 
> Fix this by orphaning the skb's before freeing the socket
> 
> Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
> ---
>  net/ipv4/af_inet.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
> index b507a47..0c58f0e5 100644
> --- a/net/ipv4/af_inet.c
> +++ b/net/ipv4/af_inet.c
> @@ -147,6 +147,12 @@ EXPORT_SYMBOL(ipv4_config);
>  void inet_sock_destruct(struct sock *sk)
>  {
>  	struct inet_sock *inet = inet_sk(sk);
> +	struct sk_buff *skb;
> +
> +	skb_queue_walk(&sk->sk_receive_queue, skb)
> +		skb_orphan(skb);
> +	skb_queue_walk(&sk->sk_error_queue, skb)
> +		skb_orphan(skb);
> 
>  	__skb_queue_purge(&sk->sk_receive_queue);
>  	__skb_queue_purge(&sk->sk_error_queue);

Sorry this makes absolutely no sense to me.

skb_queue_purge() is also calling skb_orphan() on all skb.

And no, sock_put() does not free the socket.
We release a refcount that was acquired when we did the socket lookup.

^ permalink raw reply

* Re: [PATCH RFC ethtool]  QSFP Diagnostics Information Support
From: Bert Kenward @ 2015-01-16 12:38 UTC (permalink / raw)
  To: vidya, netdev, bwh; +Cc: shm, roopa, dave.lee
In-Reply-To: <1420846916-39510-1-git-send-email-vidya@cumulusnetworks.com>

On 09/01/15 23:41, vidya@cumulusnetworks.com wrote:
> 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>

I've tested this with a few QSFP+ modules, alongside a driver patch to 
provide the eeprom data. Diagnostics appear with reasonable values.

Acked-by: Bert Kenward <bkenward@solarflare.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__ */
>

-- 
Bert Kenward <bkenward@solarflare.com>
Software Engineer, Solarflare

^ permalink raw reply

* Re: NETDEV WATCHDOG:  internal(r8152): transmit queue 0 timed out
From: poma @ 2015-01-16 12:09 UTC (permalink / raw)
  To: Hayes Wang, nic_swsd, sean darcy
  Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	Community support for Fedora users
In-Reply-To: <0835B3720019904CB8F7AA43166CEEB2EE6935@RTITMBSV03.realtek.com.tw>

On 16.01.2015 10:37, Hayes Wang wrote:
>  poma [mailto:pomidorabelisima@gmail.com] 
>> Sent: Friday, January 16, 2015 4:25 PM
> [...]
>>> This looks like a USB problem. Is there a way to get usb (or 
>>> NetworkManager) to reinitialize the driver when this happens?
>>
>> I would ask these people for advice, therefore.
> 
> Our hw engineers need to analyse the behavior of the device.
> However, I don't think you have such instrument to provide
> the required information. If we don't know the reason, we
> couldn't give you the proper solution. Besides, your solution
> would work if and only if reloading the driver is helpful.
> 
> The issue have to debug from the hardware, and I have no idea
> about what the software could do before analysing the hw. Maybe
> you could try the following driver first to check if it is useful.
> 
> http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=2&PNid=13&PFid=56&Level=5&Conn=4&DownTypeID=3&GetDown=false
>  
> Best Regards,
> Hayes
> 

Thanks for your response, Mr. Hayes.

Mr. Sean, please download and check if "timeout" is still present with built RTL8153 module from REALTEK site, as Mr. Hayes proposed.
http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=2&PNid=13&PFid=56&Level=5&Conn=4&DownTypeID=3&GetDown=false#2
r8152.53-2.03.0.tar.bz2

Procedure - should be equal for both, Fedora 21 & 20:

$ uname -r
3.17.8-300.fc21.x86_64

$ su -c 'yum install kernel-devel'

$ tar xf r8152.53-2.03.0.tar.bz2
$ cd r8152-2.03.0/
$ make
$ su

# cp 50-usb-realtek-net.rules /etc/udev/rules.d/
# udevadm trigger --action=add

# modprobe -rv r8152
# cp r8152.ko /lib/modules/$(uname -r)/updates/
# depmod
# modprobe -v r8152


poma

-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

^ permalink raw reply

* fq_codel with 802.15.4 6LoWPAN fragmentation issue
From: Alexander Aring @ 2015-01-16 12:02 UTC (permalink / raw)
  To: netdev; +Cc: linux-wpan, stephen, jukka.rissanen

Hi,

when using "fq_codel" as network scheduler, I noticed an issue with IEEE
802.15.4 6LoWPAN fragmentation. The issue is that high payloads IPv6
packets are dropped.

I detected the issue on the sending side which segments the 6LoWPAN
packet into several fragments.

In the IEEE 802.15.4 6LoWPAN fragmentation we have a 6LoWPAN interface
(MTU 1280) on top of an IEEE 802.15.4 interface (MTU 127). The 6LoWPAN
fragmentation algorithm creates in the "ndo_start_xmit" netdev_ops
callback function of the 6LoWPAN interface new sk_buffs for the
underlaying IEEE 802.15.4 interface (as skb->dev) and sends them via a
dev_queue_xmit.

IEEE 802.15.4 is a very slow connection and after each transmit there is
an "interframe spacing time" which depends on frequency setting. In my
testcase, that's about ~500 us for a payload above 18 bytes. This is
done by calling netif_stop_queue for the interface and start a timer
after each transmitted frame according to the interframe spacing time.
When the timer fires, it wakes the queue again by calling
netif_wake_queue.

Now: What I am noticed with fq_codel is that the code at [0] will drop
high payloaded IPv6 packets. Of course, if we have an IPv6 packet of
more than 1280 bytes payload we have a fragmentation (IPv6
fragmentation) over a fragmentation (802.15.4 6LoWPAN fragmentation).

When I increase the "params->interval" parameter I can send a "longer"
IPv6 packet depending how much I increase the "params->interval"
parameter.

I assume that the "params->interval" which defaults to MS2TIME(100) is
too small. I further assume that at the beginning of fragmentation the
interval measurement starts "vars->first_above_time = now +
params->interval;" (line 247 at [0]) and while sending several fragments
with the above mentioned interframe spacing time, the sending takes too
long and the skb will be dropped.

My questions are:

- What's the best way to deal with something like that?

- Is there a way to set the "params->interval" _per interface_? So I can
  change the default parameter to a suitable value in the "ndo_init"
  callback of the 6LoWPAN interface.

Thanks in advance.

- Alex

[0] http://lxr.free-electrons.com/source/include/net/codel.h#L248

^ permalink raw reply

* Re: fec: warning found by dma debug
From: Russell King - ARM Linux @ 2015-01-16 11:51 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Christian Gmeiner, LKML, netdev@vger.kernel.org,
	fugang.duan@freescale.com
In-Reply-To: <CAOMZO5Cj-b294AkybmU_n6Xfs5+QaVQ1=QkObM-oyUU8Zky19A@mail.gmail.com>

On Fri, Jan 16, 2015 at 09:32:20AM -0200, Fabio Estevam wrote:
> Thanks for the report, Christian
> 
> Adding Andy and Russell on Cc.

Yes, this is highly possible.  My patch set which addressed all sorts
of issues like this is now a year old, and I gave up with trying to
get it merged - it became far too difficult to constantly update the
patch set.

I think Marek was going to look at taking over the patch set, but I've
heard nothing from him.  The patch set can be found at:

  git://ftp.arm.linux.org.uk/~rmk/linux-arm.git fec-testing

but beware: not all of it is meant to be merged.  That branch represents
all patches I tried to solve various problems and improve performance
and correctness (from the ARM architecture point of view).  I did a lot
of work to evaluate the effect of each individual patch, and tried to
only include patches which did not cause a regression.  From what I
remember, every patch (apart from the branch head) from 7e291d514886
(net:fec: unsorted hacks) onwards was not well proven - but that was
all done before the driver ended up with TSO support.

Post TSO support, patches with "net: fec:" (note the space) /were/ good
to go, but then the multiple-queue support got merged which completely
screwed the patch set again.

So, I just totally gave up.  Sorry.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply

* [PATCH net-next] tipc: fix socket list regression in new nl api
From: richard.alpe @ 2015-01-16 11:30 UTC (permalink / raw)
  To: netdev; +Cc: tipc-discussion, Richard Alpe

From: Richard Alpe <richard.alpe@ericsson.com>

Commit 07f6c4bc (tipc: convert tipc reference table to use generic
rhashtable) introduced a problem with port listing in the new netlink
API. It broke the resume functionality resulting in a never ending
loop. This was caused by starting with the first hash table every time
subsequently never returning an empty skb (terminating).

This patch fixes the resume mechanism by keeping a logical reference
to the last hash table along with a logical reference to the socket
(port) that didn't fit in the previous message.

Signed-off-by: Richard Alpe <richard.alpe@ericsson.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
---
 net/tipc/socket.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 720fda6..679a220 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2749,29 +2749,35 @@ int tipc_nl_sk_dump(struct sk_buff *skb, struct netlink_callback *cb)
 	struct tipc_sock *tsk;
 	const struct bucket_table *tbl;
 	struct rhash_head *pos;
-	u32 prev_portid = cb->args[0];
-	u32 portid = prev_portid;
 	struct net *net = sock_net(skb->sk);
 	struct tipc_net *tn = net_generic(net, tipc_net_id);
-	int i;
+	u32 tbl_id = cb->args[0];
+	u32 prev_portid = cb->args[1];
 
 	rcu_read_lock();
 	tbl = rht_dereference_rcu((&tn->sk_rht)->tbl, &tn->sk_rht);
-	for (i = 0; i < tbl->size; i++) {
-		rht_for_each_entry_rcu(tsk, pos, tbl, i, node) {
+	for (; tbl_id < tbl->size; tbl_id++) {
+		rht_for_each_entry_rcu(tsk, pos, tbl, tbl_id, node) {
 			spin_lock_bh(&tsk->sk.sk_lock.slock);
-			portid = tsk->portid;
+			if (prev_portid && prev_portid != tsk->portid) {
+				spin_unlock_bh(&tsk->sk.sk_lock.slock);
+				continue;
+			}
+
 			err = __tipc_nl_add_sk(skb, cb, tsk);
+			if (err) {
+				prev_portid = tsk->portid;
+				spin_unlock_bh(&tsk->sk.sk_lock.slock);
+				goto out;
+			}
+			prev_portid = 0;
 			spin_unlock_bh(&tsk->sk.sk_lock.slock);
-			if (err)
-				break;
-
-			prev_portid = portid;
 		}
 	}
+out:
 	rcu_read_unlock();
-
-	cb->args[0] = prev_portid;
+	cb->args[0] = tbl_id;
+	cb->args[1] = prev_portid;
 
 	return skb->len;
 }
-- 
2.1.3

^ permalink raw reply related

* Re: Compile-time warnings on mlx4/net-next
From: Daniel Borkmann @ 2015-01-16 11:45 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner; +Cc: Or Gerlitz, netdev
In-Reply-To: <54B7C2EB.8010007@redhat.com>

On 01/15/2015 02:38 PM, Marcelo Ricardo Leitner wrote:
> On 15-01-2015 11:20, Or Gerlitz wrote:
...
>>> Do you see them too?
>>
>> using $ make W=1 -j 20 SUBDIRS=./drivers/net/ethernet/mellanox/mlx4 with gcc
>> 4.8.2 I don't see that, but I'll look there,
>> thanks for the report.

I believe they are there for quite some time already. I'm using gcc 4.8.3
and just default build. I'm surprised Fengguang didn't complain yet (or
he did, but it got ignored somehow ;)). The following should be sufficient
to just shut gcc up:

diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index 982861d..b01154d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -2122,6 +2122,7 @@ int mlx4_config_dev_retrieval(struct mlx4_dev *dev,
  	if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_CONFIG_DEV))
  		return -ENOTSUPP;

+	memset(&config_dev, 0, sizeof(config_dev));
  	err = mlx4_CONFIG_DEV_get(dev, &config_dev);
  	if (err)
  		return err;

^ permalink raw reply related

* pull request: bluetooth-next 2015-01-16
From: Johan Hedberg @ 2015-01-16 11:33 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 7612 bytes --]

Hi Dave,

Here are some more bluetooth & ieee802154 patches intended for 3.20:

 - Refactoring & cleanups of ieee802154 & 6lowpan code
 - Various fixes to the btmrvl driver
 - Fixes for Bluetooth Low Energy Privacy feature handling
 - Added build-time sanity checks for sockaddr sizes
 - Fixes for Security Manager registration on LE-only controllers
 - Refactoring of broken inquiry mode handling to a generic quirk

Please let me know if there are any issues pulling. Thanks.

Johan

---
The following changes since commit e8768f971558019ed83eee8210375cd2143deef2:

  net: skbuff: don't zero tc members when freeing skb (2015-01-02 16:04:29 -0500)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git for-upstream

for you to fetch changes up to 0026b6551b51a9520b912f41b8d447b89a825f5a:

  Bluetooth: Remove unused function (2015-01-16 13:06:38 +0200)

----------------------------------------------------------------
Alexander Aring (13):
      ieee802154: handle socket functionality as module
      ieee802154: socket: change module name
      ieee802154: socket: put handling into one file
      ieee802154: socket: fix checkpatch issue
      ieee802154: rename af_ieee802154.c to socket.c
      ieee802154: handle config as menuconfig
      mac802154: fix kbuild test robot warning
      ieee802154: create 6lowpan sub-directory
      ieee802154: 6lowpan: rename internal header
      ieee802154: 6lowpan: move receive functionality
      ieee802154: 6lowpan: move transmit functionality
      ieee802154: 6lowpan: rename to core
      ieee802154: 6lowpan: fix Makefile entry

Amitkumar Karwar (6):
      Bluetooth: btmrvl: fix race issue while stopping main thread
      Bluetooth: btmrvl: error path handling in setup handler
      Bluetooth: btmrvl: add surprise_removed flag
      bluetooth: btmrvl: increase the priority of firmware download message
      Bluetooth: btmrvl: use msecs_to_jiffies within macro definition
      Bluetooth: btmrvl: fix card reset and suspend race issue

Gowtham Anandha Babu (1):
      Bluetooth: Remove dead code

Johan Hedberg (3):
      Bluetooth: Fix valid Identity Address check
      Bluetooth: Add helpers for src/dst bdaddr type conversion
      Bluetooth: Fix lookup of fixed channels by local bdaddr

Jukka Rissanen (1):
      Bluetooth: 6lowpan: Remove PSM setting code

Marcel Holtmann (32):
      Bluetooth: Introduce force_bredr_smp debugfs option for testing
      Bluetooth: Remove broken force_lesc_support debugfs option
      Bluetooth: Remove no longer needed force_sc_support debugfs option
      Bluetooth: Fix scope of sc_only_mode debugfs entry
      Bluetooth: Fix for a leftover debug of pairing credentials
      Bluetooth: Fix SMP channel registration for unconfigured controllers
      Bluetooth: Fix issue with Roper Class 1 Bluetooth Dongle
      Bluetooth: Remove dead code for manufacturer inquiry mode quirks
      Bluetooth: Introduce HCI_QUIRK_FIXUP_INQUIRY_MODE option
      Bluetooth: Use HCI_QUIRK_FIXUP_INQUIRY_MODE for Silicon Wave devices
      Bluetooth: Add opcode parameter to hci_req_complete_t callback
      Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_hci
      Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_l2
      Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_rc
      Bluetooth: Add BUILD_BUG_ON for size of struct sockaddr_sco
      Bluetooth: Simplify packet copy in hci_send_to_monitor function
      Bluetooth: Create generic queue_monitor_skb helper function
      Bluetooth: Replace send_monitor_event with queue_monitor_skb
      Bluetooth: Add defintions for HCI Read Stored Link Key command
      Bluetooth: Handle command complete event for HCI Read Stored Link Keys
      Bluetooth: Read stored link key information when powering on controller
      Bluetooth: Add missing response structure for HCI Delete Stored Link Key
      Bluetooth: Process result of HCI Delete Stored Link Key command
      Bluetooth: btusb: Add internal recv_event callback for event processing
      Bluetooth: Move Delete Stored Link Key to 4th phase of initialization
      Bluetooth: Use %llu for printing duration details of selftests
      Bluetooth: Show device address type for L2CAP debugfs entries
      Bluetooth: Fix issue with switching BR/EDR back on when disabled
      Bluetooth: Fix LE SMP channel source address and source address type
      Bluetooth: Don't register any SMP channel if LE is not supported
      Bluetooth: Bind the SMP channel registration to management power state
      Bluetooth: Add paranoid check for existing LE and BR/EDR SMP channels

Rickard Strandqvist (1):
      Bluetooth: Remove unused function

 drivers/bluetooth/btmrvl_drv.h            |    5 +-
 drivers/bluetooth/btmrvl_main.c           |   32 +-
 drivers/bluetooth/btmrvl_sdio.c           |    6 +-
 drivers/bluetooth/btusb.c                 |   15 +-
 include/net/bluetooth/bluetooth.h         |    2 +-
 include/net/bluetooth/hci.h               |   30 +-
 include/net/bluetooth/hci_core.h          |    6 +-
 net/bluetooth/6lowpan.c                   |   66 +-
 net/bluetooth/cmtp/capi.c                 |    6 -
 net/bluetooth/hci_conn.c                  |   17 +-
 net/bluetooth/hci_core.c                  |  128 ++--
 net/bluetooth/hci_debugfs.c               |  143 +---
 net/bluetooth/hci_event.c                 |   42 ++
 net/bluetooth/hci_request.c               |    3 +-
 net/bluetooth/hci_sock.c                  |  107 ++-
 net/bluetooth/l2cap_core.c                |   55 +-
 net/bluetooth/l2cap_sock.c                |    2 +
 net/bluetooth/mgmt.c                      |   79 +-
 net/bluetooth/rfcomm/sock.c               |    2 +
 net/bluetooth/sco.c                       |    2 +
 net/bluetooth/selftest.c                  |    2 +-
 net/bluetooth/smp.c                       |  133 +++-
 net/ieee802154/6lowpan/6lowpan_i.h        |   72 ++
 net/ieee802154/6lowpan/Kconfig            |    5 +
 net/ieee802154/6lowpan/Makefile           |    3 +
 net/ieee802154/6lowpan/core.c             |  304 ++++++++
 net/ieee802154/{ => 6lowpan}/reassembly.c |    2 +-
 net/ieee802154/6lowpan/rx.c               |  171 +++++
 net/ieee802154/6lowpan/tx.c               |  271 +++++++
 net/ieee802154/6lowpan_rtnl.c             |  729 ------------------
 net/ieee802154/Kconfig                    |   18 +-
 net/ieee802154/Makefile                   |    8 +-
 net/ieee802154/af802154.h                 |   33 -
 net/ieee802154/af_ieee802154.c            |  369 ---------
 net/ieee802154/dgram.c                    |  549 --------------
 net/ieee802154/raw.c                      |  270 -------
 net/ieee802154/reassembly.h               |   41 -
 net/ieee802154/socket.c                   | 1125 ++++++++++++++++++++++++++++
 net/mac802154/cfg.c                       |    5 +-
 39 files changed, 2461 insertions(+), 2397 deletions(-)
 create mode 100644 net/ieee802154/6lowpan/6lowpan_i.h
 create mode 100644 net/ieee802154/6lowpan/Kconfig
 create mode 100644 net/ieee802154/6lowpan/Makefile
 create mode 100644 net/ieee802154/6lowpan/core.c
 rename net/ieee802154/{ => 6lowpan}/reassembly.c (99%)
 create mode 100644 net/ieee802154/6lowpan/rx.c
 create mode 100644 net/ieee802154/6lowpan/tx.c
 delete mode 100644 net/ieee802154/6lowpan_rtnl.c
 delete mode 100644 net/ieee802154/af802154.h
 delete mode 100644 net/ieee802154/af_ieee802154.c
 delete mode 100644 net/ieee802154/dgram.c
 delete mode 100644 net/ieee802154/raw.c
 delete mode 100644 net/ieee802154/reassembly.h
 create mode 100644 net/ieee802154/socket.c


[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: fec: warning found by dma debug
From: Fabio Estevam @ 2015-01-16 11:32 UTC (permalink / raw)
  To: Christian Gmeiner
  Cc: LKML, netdev@vger.kernel.org, fugang.duan@freescale.com,
	Russell King
In-Reply-To: <CAH9NwWdR4mPz6c1Ce8tntWFMZXgO20Sgys8pvZwoGhjn6b7fnw@mail.gmail.com>

Thanks for the report, Christian

Adding Andy and Russell on Cc.

On Fri, Jan 16, 2015 at 9:05 AM, Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
> [   17.946189] ------------[ cut here ]------------
> [   17.950848] WARNING: CPU: 0 PID: 3 at lib/dma-debug.c:1093
> check_unmap+0x858/0xa10()
> [   17.958674] fec 2188000.ethernet: DMA-API: device driver tries to
> free DMA memory it has not allocated [device
> address=0x0000000000000000] [size=34 bytes]
> [   17.972564] Modules linked in: etnaviv(C) imx_ipuv3_crtc imx_hdmi
> imxdrm drm_kms_helper drm
> [   17.981086] CPU: 0 PID: 3 Comm: ksoftirqd/0 Tainted: G        WC
>  3.19.0-rc4+ #31
> [   17.988893] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
> [   17.995488] Backtrace:
> [   17.997982] [<c00135f0>] (dump_backtrace) from [<c0013948>]
> (show_stack+0x20/0x24)
> [   18.005609]  r6:c0883d40 r5:ffffffff r4:00000000 r3:dc8cb100
> [   18.011369] [<c0013928>] (show_stack) from [<c06a2ac0>]
> (dump_stack+0x78/0xc4)
> [   18.018683] [<c06a2a48>] (dump_stack) from [<c002c0a4>]
> (warn_slowpath_common+0x88/0xc4)
> [   18.026845]  r5:00000445 r4:e5205c80
> [   18.030479] [<c002c01c>] (warn_slowpath_common) from [<c002c19c>]
> (warn_slowpath_fmt+0x40/0x48)
> [   18.039231]  r8:00000000 r7:00000000 r6:00000022 r5:c0af9e18 r4:00000000
> [   18.046066] [<c002c160>] (warn_slowpath_fmt) from [<c038dc30>]
> (check_unmap+0x858/0xa10)
> [   18.054216]  r3:c089bb90 r2:c0884270
> [   18.057846] [<c038d3d8>] (check_unmap) from [<c038e0c4>]
> (debug_dma_unmap_page+0x80/0x88)
> [   18.066087]  r10:e38890c0 r9:00000000 r8:00000001 r7:00000001
> r6:e53f8850 r5:00000000
> [   18.074069]  r4:00000022
> [   18.076647] [<c038e044>] (debug_dma_unmap_page) from [<c045e368>]
> (fec_enet_rx_napi+0x7c0/0xb94)
> [   18.085494]  r8:00001400 r7:e795c780 r6:e389a0c0 r5:00000000 r4:00000000
> [   18.092349] [<c045dba8>] (fec_enet_rx_napi) from [<c053f14c>]
> (net_rx_action+0x130/0x568)
> [   18.100537]  r10:c0aefa80 r9:ffff91be r8:e5205e48 r7:00000040
> r6:0000012c r5:00000001
> [   18.108537]  r4:e38897b0
> [   18.111113] [<c053f01c>] (net_rx_action) from [<c0030768>]
> (__do_softirq+0x11c/0x794)
> [   18.118999]  r10:00000100 r9:c0053c58 r8:00000004 r7:c0b5ddac
> r6:00000008 r5:c0af208c
> [   18.127008]  r4:00000003
> [   18.129573] [<c003064c>] (__do_softirq) from [<c0030e20>]
> (run_ksoftirqd+0x40/0x6c)
> [   18.137291]  r10:00000000 r9:c0053c58 r8:c0b017cc r7:00000000
> r6:0000103c r5:e5157a00
> [   18.145298]  r4:00000001
> [   18.147878] [<c0030de0>] (run_ksoftirqd) from [<c0053de4>]
> (smpboot_thread_fn+0x1b0/0x354)
> [   18.156208] [<c0053c34>] (smpboot_thread_fn) from [<c004f114>]
> (kthread+0x104/0x128)
> [   18.164011]  r10:00000000 r9:00000000 r8:00000000 r7:c0053c34
> r6:e5157a00 r5:00000000
> [   18.172006]  r4:e5157800 r3:00000005
> [   18.175651] [<c004f010>] (kthread) from [<c000fc08>]
> (ret_from_fork+0x14/0x2c)
> [   18.182937]  r7:00000000 r6:00000000 r5:c004f010 r4:e5157800
> [   18.188680] ---[ end trace dcf0152c9771f20a ]---
>
> --
> Christian Gmeiner, MSc
>
> https://soundcloud.com/christian-gmeiner
> --
> 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] bluetooth: Remove unused function
From: Johan Hedberg @ 2015-01-16 11:08 UTC (permalink / raw)
  To: Rickard Strandqvist
  Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1420386914-12885-1-git-send-email-rickard_strandqvist-IW2WV5XWFqGZkjO+N0TKoMugMpMbD5Xr@public.gmane.org>

Hi Rickard,

On Sun, Jan 04, 2015, Rickard Strandqvist wrote:
> Remove the function hci_conn_change_link_key() that is not used anywhere.
> 
> 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>
> ---
>  include/net/bluetooth/hci_core.h |    1 -
>  net/bluetooth/hci_conn.c         |   15 ---------------
>  2 files changed, 16 deletions(-)

Applied to the bluetooth-next tree. Thanks.

Johan

^ permalink raw reply

* fec: warning found by dma debug
From: Christian Gmeiner @ 2015-01-16 11:05 UTC (permalink / raw)
  To: LKML, netdev@vger.kernel.org

[   17.946189] ------------[ cut here ]------------
[   17.950848] WARNING: CPU: 0 PID: 3 at lib/dma-debug.c:1093
check_unmap+0x858/0xa10()
[   17.958674] fec 2188000.ethernet: DMA-API: device driver tries to
free DMA memory it has not allocated [device
address=0x0000000000000000] [size=34 bytes]
[   17.972564] Modules linked in: etnaviv(C) imx_ipuv3_crtc imx_hdmi
imxdrm drm_kms_helper drm
[   17.981086] CPU: 0 PID: 3 Comm: ksoftirqd/0 Tainted: G        WC
 3.19.0-rc4+ #31
[   17.988893] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[   17.995488] Backtrace:
[   17.997982] [<c00135f0>] (dump_backtrace) from [<c0013948>]
(show_stack+0x20/0x24)
[   18.005609]  r6:c0883d40 r5:ffffffff r4:00000000 r3:dc8cb100
[   18.011369] [<c0013928>] (show_stack) from [<c06a2ac0>]
(dump_stack+0x78/0xc4)
[   18.018683] [<c06a2a48>] (dump_stack) from [<c002c0a4>]
(warn_slowpath_common+0x88/0xc4)
[   18.026845]  r5:00000445 r4:e5205c80
[   18.030479] [<c002c01c>] (warn_slowpath_common) from [<c002c19c>]
(warn_slowpath_fmt+0x40/0x48)
[   18.039231]  r8:00000000 r7:00000000 r6:00000022 r5:c0af9e18 r4:00000000
[   18.046066] [<c002c160>] (warn_slowpath_fmt) from [<c038dc30>]
(check_unmap+0x858/0xa10)
[   18.054216]  r3:c089bb90 r2:c0884270
[   18.057846] [<c038d3d8>] (check_unmap) from [<c038e0c4>]
(debug_dma_unmap_page+0x80/0x88)
[   18.066087]  r10:e38890c0 r9:00000000 r8:00000001 r7:00000001
r6:e53f8850 r5:00000000
[   18.074069]  r4:00000022
[   18.076647] [<c038e044>] (debug_dma_unmap_page) from [<c045e368>]
(fec_enet_rx_napi+0x7c0/0xb94)
[   18.085494]  r8:00001400 r7:e795c780 r6:e389a0c0 r5:00000000 r4:00000000
[   18.092349] [<c045dba8>] (fec_enet_rx_napi) from [<c053f14c>]
(net_rx_action+0x130/0x568)
[   18.100537]  r10:c0aefa80 r9:ffff91be r8:e5205e48 r7:00000040
r6:0000012c r5:00000001
[   18.108537]  r4:e38897b0
[   18.111113] [<c053f01c>] (net_rx_action) from [<c0030768>]
(__do_softirq+0x11c/0x794)
[   18.118999]  r10:00000100 r9:c0053c58 r8:00000004 r7:c0b5ddac
r6:00000008 r5:c0af208c
[   18.127008]  r4:00000003
[   18.129573] [<c003064c>] (__do_softirq) from [<c0030e20>]
(run_ksoftirqd+0x40/0x6c)
[   18.137291]  r10:00000000 r9:c0053c58 r8:c0b017cc r7:00000000
r6:0000103c r5:e5157a00
[   18.145298]  r4:00000001
[   18.147878] [<c0030de0>] (run_ksoftirqd) from [<c0053de4>]
(smpboot_thread_fn+0x1b0/0x354)
[   18.156208] [<c0053c34>] (smpboot_thread_fn) from [<c004f114>]
(kthread+0x104/0x128)
[   18.164011]  r10:00000000 r9:00000000 r8:00000000 r7:c0053c34
r6:e5157a00 r5:00000000
[   18.172006]  r4:e5157800 r3:00000005
[   18.175651] [<c004f010>] (kthread) from [<c000fc08>]
(ret_from_fork+0x14/0x2c)
[   18.182937]  r7:00000000 r6:00000000 r5:c004f010 r4:e5157800
[   18.188680] ---[ end trace dcf0152c9771f20a ]---

--
Christian Gmeiner, MSc

https://soundcloud.com/christian-gmeiner

^ permalink raw reply

* Re: tcp: Do not apply TSO segment limit to non-TSO packets
From: Thomas Jarosch @ 2015-01-16 11:03 UTC (permalink / raw)
  To: Herbert Xu
  Cc: netdev, edumazet, Steffen Klassert, Ben Hutchings,
	David S. Miller
In-Reply-To: <20150116105012.GA10655@gondor.apana.org.au>

On Friday, 16. January 2015 21:50:13 Herbert Xu wrote:
> On Fri, Jan 16, 2015 at 11:45:44AM +0100, Thomas Jarosch wrote:
> > For backporting to -stable: Kernel 3.14 lacks tcp_tso_autosize().
> > So I've borrowed that from 3.19-rc4+ and also added the max_segs
> > variable.
> > The final and tested code looks like this:
> You don't need tcp_tso_autosize.  Instead of testing max_segs just
> test sk->sk_gso_max_segs.

splendid, even better. tcpdump looks good, too. Thanks!

Thomas

^ permalink raw reply

* Re: tcp: Do not apply TSO segment limit to non-TSO packets
From: Herbert Xu @ 2015-01-16 10:50 UTC (permalink / raw)
  To: Thomas Jarosch
  Cc: netdev, edumazet, Steffen Klassert, Ben Hutchings,
	David S. Miller
In-Reply-To: <74814478.Xs0dcijNdd@storm>

On Fri, Jan 16, 2015 at 11:45:44AM +0100, Thomas Jarosch wrote:
> 
> For backporting to -stable: Kernel 3.14 lacks tcp_tso_autosize().
> So I've borrowed that from 3.19-rc4+ and also added the max_segs variable.
> The final and tested code looks like this:

You don't need tcp_tso_autosize.  Instead of testing max_segs just
test sk->sk_gso_max_segs.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply


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