Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Sep 2014 17:51:39 +0000 (UTC)
From:      Ryan Stone <rstone@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272285 - head/sys/dev/ixl
Message-ID:  <201409291751.s8THpdho047514@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rstone
Date: Mon Sep 29 17:51:39 2014
New Revision: 272285
URL: http://svnweb.freebsd.org/changeset/base/272285

Log:
  Ensure that ixl_flush() uses a defined register on VFs
  
  In some code that is shared between the ixl(4) and ixlv(4) drivers,
  a macro hard-coded a register offset that was not valid on ixlv devices.
  Fix this by having each driver define a variable that contains the correct
  offset.
  
  Reviewed by:	Eric Joyner <ricera10 AT gmail.com>
  MFC after:	3 days
  Sponsored by:	Sandvine Inc

Modified:
  head/sys/dev/ixl/i40e_osdep.h
  head/sys/dev/ixl/if_ixl.c
  head/sys/dev/ixl/if_ixlv.c

Modified: head/sys/dev/ixl/i40e_osdep.h
==============================================================================
--- head/sys/dev/ixl/i40e_osdep.h	Mon Sep 29 17:38:50 2014	(r272284)
+++ head/sys/dev/ixl/i40e_osdep.h	Mon Sep 29 17:51:39 2014	(r272285)
@@ -152,6 +152,7 @@ struct i40e_osdep
 	bus_space_tag_t		mem_bus_space_tag;
 	bus_space_handle_t	mem_bus_space_handle;
 	bus_size_t		mem_bus_space_size;
+	uint32_t		flush_reg;
 	struct device		*dev;
 };
 
@@ -208,6 +209,13 @@ wr32_osdep(struct i40e_osdep *osdep, uin
 	    osdep->mem_bus_space_handle, reg, value);
 }
 
+static __inline void
+ixl_flush_osdep(struct i40e_osdep *osdep)
+{
+
+	rd32_osdep(osdep, osdep->flush_reg);
+}
+
 #define rd32(a, reg)		rd32_osdep((a)->back, (reg))
 #define wr32(a, reg, value)	wr32_osdep((a)->back, (reg), (value))
 
@@ -221,9 +229,6 @@ wr32_osdep(struct i40e_osdep *osdep, uin
                      ((struct i40e_osdep *)(a)->back)->mem_bus_space_handle, \
                      reg, value))
 
-#define ixl_flush(a) (\
-   bus_space_read_4( ((struct i40e_osdep *)(a)->back)->mem_bus_space_tag, \
-                     ((struct i40e_osdep *)(a)->back)->mem_bus_space_handle, \
-                     I40E_GLGEN_STAT))
+#define ixl_flush(a)		ixl_flush_osdep((a)->back)
 
 #endif /* _I40E_OSDEP_H_ */

Modified: head/sys/dev/ixl/if_ixl.c
==============================================================================
--- head/sys/dev/ixl/if_ixl.c	Mon Sep 29 17:38:50 2014	(r272284)
+++ head/sys/dev/ixl/if_ixl.c	Mon Sep 29 17:51:39 2014	(r272285)
@@ -2177,6 +2177,7 @@ ixl_allocate_pci_resources(struct ixl_pf
 	pf->osdep.mem_bus_space_handle =
 		rman_get_bushandle(pf->pci_mem);
 	pf->osdep.mem_bus_space_size = rman_get_size(pf->pci_mem);
+	pf->osdep.flush_reg = I40E_GLGEN_STAT;
 	pf->hw.hw_addr = (u8 *) &pf->osdep.mem_bus_space_handle;
 
 	pf->hw.back = &pf->osdep;

Modified: head/sys/dev/ixl/if_ixlv.c
==============================================================================
--- head/sys/dev/ixl/if_ixlv.c	Mon Sep 29 17:38:50 2014	(r272284)
+++ head/sys/dev/ixl/if_ixlv.c	Mon Sep 29 17:51:39 2014	(r272285)
@@ -1137,6 +1137,7 @@ ixlv_allocate_pci_resources(struct ixlv_
 	sc->osdep.mem_bus_space_handle =
 		rman_get_bushandle(sc->pci_mem);
 	sc->osdep.mem_bus_space_size = rman_get_size(sc->pci_mem);
+	sc->osdep.flush_reg = I40E_VFGEN_RSTAT;
 	sc->hw.hw_addr = (u8 *) &sc->osdep.mem_bus_space_handle;
 
 	sc->hw.back = &sc->osdep;



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