Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Mar 2020 12:37:04 +0000 (UTC)
From:      Leandro Lupori <luporl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358698 - head/sys/dev/ixl
Message-ID:  <202003061237.026Cb4rj043977@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: luporl
Date: Fri Mar  6 12:37:04 2020
New Revision: 358698
URL: https://svnweb.freebsd.org/changeset/base/358698

Log:
  ixl: Add missing conversions from/to LE16
  
  This fixes some errors on PPC64, during attach and when trying to assign an IP
  to an interface.  With this change, basic operation of X710 NICs is now
  possible.
  
  This also fixes builds with IXL_DEBUG enabled
  
  Reviewed by:	erj
  Sponsored by:	Eldorado Research Institute (eldorado.org.br)
  Differential Revision:	https://reviews.freebsd.org/D23975

Modified:
  head/sys/dev/ixl/if_ixl.c
  head/sys/dev/ixl/ixl_pf_main.c

Modified: head/sys/dev/ixl/if_ixl.c
==============================================================================
--- head/sys/dev/ixl/if_ixl.c	Fri Mar  6 12:02:42 2020	(r358697)
+++ head/sys/dev/ixl/if_ixl.c	Fri Mar  6 12:37:04 2020	(r358698)
@@ -398,11 +398,11 @@ ixl_if_attach_pre(if_ctx_t ctx)
 	enum i40e_status_code status;
 	int error = 0;
 
-	INIT_DBG_DEV(dev, "begin");
-
 	dev = iflib_get_dev(ctx);
 	pf = iflib_get_softc(ctx);
 
+	INIT_DBG_DEV(dev, "begin");
+
 	vsi = &pf->vsi;
 	vsi->back = pf;
 	pf->dev = dev;
@@ -588,10 +588,11 @@ ixl_if_attach_post(if_ctx_t ctx)
 	int error = 0;
 	enum i40e_status_code status;
 
-	INIT_DBG_DEV(dev, "begin");
-
 	dev = iflib_get_dev(ctx);
 	pf = iflib_get_softc(ctx);
+
+	INIT_DBG_DEV(dev, "begin");
+
 	vsi = &pf->vsi;
 	vsi->ifp = iflib_get_ifp(ctx);
 	hw = &pf->hw;

Modified: head/sys/dev/ixl/ixl_pf_main.c
==============================================================================
--- head/sys/dev/ixl/ixl_pf_main.c	Fri Mar  6 12:02:42 2020	(r358697)
+++ head/sys/dev/ixl/ixl_pf_main.c	Fri Mar  6 12:37:04 2020	(r358698)
@@ -1123,20 +1123,22 @@ ixl_switch_config(struct ixl_pf *pf)
 	if (pf->dbg_mask & IXL_DBG_SWITCH_INFO) {
 		device_printf(dev,
 		    "Switch config: header reported: %d in structure, %d total\n",
-		    sw_config->header.num_reported, sw_config->header.num_total);
-		for (int i = 0; i < sw_config->header.num_reported; i++) {
+		    LE16_TO_CPU(sw_config->header.num_reported),
+		    LE16_TO_CPU(sw_config->header.num_total));
+		for (int i = 0;
+		    i < LE16_TO_CPU(sw_config->header.num_reported); i++) {
 			device_printf(dev,
 			    "-> %d: type=%d seid=%d uplink=%d downlink=%d\n", i,
 			    sw_config->element[i].element_type,
-			    sw_config->element[i].seid,
-			    sw_config->element[i].uplink_seid,
-			    sw_config->element[i].downlink_seid);
+			    LE16_TO_CPU(sw_config->element[i].seid),
+			    LE16_TO_CPU(sw_config->element[i].uplink_seid),
+			    LE16_TO_CPU(sw_config->element[i].downlink_seid));
 		}
 	}
 	/* Simplified due to a single VSI */
-	vsi->uplink_seid = sw_config->element[0].uplink_seid;
-	vsi->downlink_seid = sw_config->element[0].downlink_seid;
-	vsi->seid = sw_config->element[0].seid;
+	vsi->uplink_seid = LE16_TO_CPU(sw_config->element[0].uplink_seid);
+	vsi->downlink_seid = LE16_TO_CPU(sw_config->element[0].downlink_seid);
+	vsi->seid = LE16_TO_CPU(sw_config->element[0].seid);
 	return (ret);
 }
 
@@ -2058,12 +2060,14 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, int flags, int
 			bcopy(f->macaddr, b->mac_addr, ETHER_ADDR_LEN);
 			if (f->vlan == IXL_VLAN_ANY) {
 				b->vlan_tag = 0;
-				b->flags = I40E_AQC_MACVLAN_ADD_IGNORE_VLAN;
+				b->flags = CPU_TO_LE16(
+				    I40E_AQC_MACVLAN_ADD_IGNORE_VLAN);
 			} else {
-				b->vlan_tag = f->vlan;
+				b->vlan_tag = CPU_TO_LE16(f->vlan);
 				b->flags = 0;
 			}
-			b->flags |= I40E_AQC_MACVLAN_ADD_PERFECT_MATCH;
+			b->flags |= CPU_TO_LE16(
+			    I40E_AQC_MACVLAN_ADD_PERFECT_MATCH);
 			f->flags &= ~IXL_FILTER_ADD;
 			j++;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003061237.026Cb4rj043977>