Module Name: src
Committed By: msaitoh
Date: Wed Aug 21 10:01:53 UTC 2019
Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c
Log Message:
Simplify ix{gbe,v}_[un]register_vlan() API suggestesd by knakahara.
The API was the same as FreeBSD's pre-iflib's. They use iflib now and it's
not required for us to keep the old API.
To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/pci/ixgbe/ixv.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.201 src/sys/dev/pci/ixgbe/ixgbe.c:1.202
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.201 Wed Aug 21 06:00:07 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 21 10:01:53 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.201 2019/08/21 06:00:07 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.202 2019/08/21 10:01:53 msaitoh Exp $ */
/******************************************************************************
@@ -222,8 +222,8 @@ static void ixgbe_eitr_write(struct adap
static void ixgbe_setup_vlan_hw_tagging(struct adapter *);
static void ixgbe_setup_vlan_hw_support(struct adapter *);
static int ixgbe_vlan_cb(struct ethercom *, uint16_t, bool);
-static int ixgbe_register_vlan(void *, struct ifnet *, u16);
-static int ixgbe_unregister_vlan(void *, struct ifnet *, u16);
+static int ixgbe_register_vlan(struct adapter *, u16);
+static int ixgbe_unregister_vlan(struct adapter *, u16);
static void ixgbe_add_device_sysctls(struct adapter *);
static void ixgbe_add_hw_stats(struct adapter *);
@@ -2310,9 +2310,9 @@ ixgbe_vlan_cb(struct ethercom *ec, uint1
int rv;
if (set)
- rv = ixgbe_register_vlan(ifp->if_softc, ifp, vid);
+ rv = ixgbe_register_vlan(adapter, vid);
else
- rv = ixgbe_unregister_vlan(ifp->if_softc, ifp, vid);
+ rv = ixgbe_unregister_vlan(adapter, vid);
if (rv != 0)
return rv;
@@ -2336,15 +2336,11 @@ ixgbe_vlan_cb(struct ethercom *ec, uint1
* VFTA, init will repopulate the real table.
************************************************************************/
static int
-ixgbe_register_vlan(void *arg, struct ifnet *ifp, u16 vtag)
+ixgbe_register_vlan(struct adapter *adapter, u16 vtag)
{
- struct adapter *adapter = ifp->if_softc;
u16 index, bit;
int error;
- if (ifp->if_softc != arg) /* Not our event */
- return EINVAL;
-
if ((vtag == 0) || (vtag > 4095)) /* Invalid */
return EINVAL;
@@ -2367,15 +2363,11 @@ ixgbe_register_vlan(void *arg, struct if
* Run via vlan unconfig EVENT, remove our entry in the soft vfta.
************************************************************************/
static int
-ixgbe_unregister_vlan(void *arg, struct ifnet *ifp, u16 vtag)
+ixgbe_unregister_vlan(struct adapter *adapter, u16 vtag)
{
- struct adapter *adapter = ifp->if_softc;
u16 index, bit;
int error;
- if (ifp->if_softc != arg)
- return EINVAL;
-
if ((vtag == 0) || (vtag > 4095)) /* Invalid */
return EINVAL;
Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.127 src/sys/dev/pci/ixgbe/ixv.c:1.128
--- src/sys/dev/pci/ixgbe/ixv.c:1.127 Wed Aug 21 06:00:07 2019
+++ src/sys/dev/pci/ixgbe/ixv.c Wed Aug 21 10:01:53 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.127 2019/08/21 06:00:07 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.128 2019/08/21 10:01:53 msaitoh Exp $*/
/******************************************************************************
@@ -123,8 +123,8 @@ static void ixv_eitr_write(struct adapte
static void ixv_setup_vlan_tagging(struct adapter *);
static int ixv_setup_vlan_support(struct adapter *);
static int ixv_vlan_cb(struct ethercom *, uint16_t, bool);
-static int ixv_register_vlan(void *, struct ifnet *, u16);
-static int ixv_unregister_vlan(void *, struct ifnet *, u16);
+static int ixv_register_vlan(struct adapter *, u16);
+static int ixv_unregister_vlan(struct adapter *, u16);
static void ixv_add_device_sysctls(struct adapter *);
static void ixv_save_stats(struct adapter *);
@@ -2058,9 +2058,9 @@ ixv_vlan_cb(struct ethercom *ec, uint16_
int rv;
if (set)
- rv = ixv_register_vlan(ifp->if_softc, ifp, vid);
+ rv = ixv_register_vlan(adapter, vid);
else
- rv = ixv_unregister_vlan(ifp->if_softc, ifp, vid);
+ rv = ixv_unregister_vlan(adapter, vid);
if (rv != 0)
return rv;
@@ -2084,16 +2084,12 @@ ixv_vlan_cb(struct ethercom *ec, uint16_
* will repopulate the real table.
************************************************************************/
static int
-ixv_register_vlan(void *arg, struct ifnet *ifp, u16 vtag)
+ixv_register_vlan(struct adapter *adapter, u16 vtag)
{
- struct adapter *adapter = ifp->if_softc;
struct ixgbe_hw *hw = &adapter->hw;
u16 index, bit;
int error;
- if (ifp->if_softc != arg) /* Not our event */
- return EINVAL;
-
if ((vtag == 0) || (vtag > 4095)) /* Invalid */
return EINVAL;
IXGBE_CORE_LOCK(adapter);
@@ -2118,16 +2114,12 @@ ixv_register_vlan(void *arg, struct ifne
* in the soft vfta.
************************************************************************/
static int
-ixv_unregister_vlan(void *arg, struct ifnet *ifp, u16 vtag)
+ixv_unregister_vlan(struct adapter *adapter, u16 vtag)
{
- struct adapter *adapter = ifp->if_softc;
struct ixgbe_hw *hw = &adapter->hw;
u16 index, bit;
int error;
- if (ifp->if_softc != arg)
- return EINVAL;
-
if ((vtag == 0) || (vtag > 4095)) /* Invalid */
return EINVAL;