Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci/ixgbe Simplify ix{gbe,v}_[un]register_vlan() API...
details: https://anonhg.NetBSD.org/src/rev/97b4ab43a8c3
branches: trunk
changeset: 1002926:97b4ab43a8c3
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Wed Aug 21 10:01:53 2019 +0000
description:
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.
diffstat:
sys/dev/pci/ixgbe/ixgbe.c | 22 +++++++---------------
sys/dev/pci/ixgbe/ixv.c | 22 +++++++---------------
2 files changed, 14 insertions(+), 30 deletions(-)
diffs (134 lines):
diff -r 0298f67db2f0 -r 97b4ab43a8c3 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 21 08:03:22 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 21 10:01:53 2019 +0000
@@ -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_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 @@
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 @@
* 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 @@
* 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;
diff -r 0298f67db2f0 -r 97b4ab43a8c3 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c Wed Aug 21 08:03:22 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c Wed Aug 21 10:01:53 2019 +0000
@@ -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_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 @@
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 @@
* 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 @@
* 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;
Home |
Main Index |
Thread Index |
Old Index