Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133205164
D3418.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D3418.id.diff
View Options
Index: sys/net/if.h
===================================================================
--- sys/net/if.h
+++ sys/net/if.h
@@ -588,6 +588,7 @@
IF_VLAN,
IF_TOEDEV,
IF_MEDIA,
+ IF_RING,
/*
* Space above 99999 is split among different vendors.
*
@@ -727,6 +728,10 @@
* later. Otherwise it inherits static iftsomax from ifdriver.
*/
struct iftsomax *ifat_tsomax;
+ /*
+ * Number of the tx/rx rings.
+ */
+ int ifat_nrings;
};
/*
Index: sys/net/if.c
===================================================================
--- sys/net/if.c
+++ sys/net/if.c
@@ -515,8 +515,9 @@
struct iftype *ift;
struct ifnet *ifp;
struct ifaddr *ifa;
+ struct ifring **ifrs;
struct sockaddr_dl *sdl;
- int socksize, ifasize, namelen, masklen;
+ int socksize, ifasize, namelen, masklen, nrings;
KASSERT(ifat->ifat_version == IF_ATTACH_VERSION,
("%s: version %d, expected %d",
@@ -612,6 +613,18 @@
refcount_init(&ifp->if_refcount, 1);
/*
+ * Allocate ifring to store the per-ring statistics for this
+ * interface.
+ */
+ nrings = ifat->ifat_nrings;
+ ifrs = malloc(sizeof(struct ifring *) * nrings, M_IFNET, M_WAITOK);
+ for (int i = 0; i < nrings; i++)
+ ifrs[i] = malloc(sizeof(struct ifring), M_IFNET,
+ M_WAITOK | M_ZERO);
+ ifp->if_nrings = nrings;
+ ifp->if_rings = ifrs;
+
+ /*
* Allocate ifaddr to store link level address and name for this
* interface. Always save enough space for any possiable name so
* we can do a rename in place later.
@@ -684,6 +697,10 @@
ifmedia_free(ifp);
+ for (int i = 0; i < ifp->if_nrings; i++)
+ free(ifp->if_rings[i], M_IFNET);
+ free(ifp->if_rings, M_IFNET);
+
rw_destroy(&ifp->if_lock);
free(ifp, M_IFNET);
}
@@ -1573,6 +1590,8 @@
return (ifp->if_xname);
case IF_VLAN:
return (ifp->if_vlantrunk);
+ case IF_RING:
+ return (ifp->if_rings);
default:
/* fall through */
;
Index: sys/net/if_var.h
===================================================================
--- sys/net/if_var.h
+++ sys/net/if_var.h
@@ -152,6 +152,8 @@
size_t if_linkmiblen; /* length of above data */
u_int if_refcount; /* reference count */
u_int if_fib; /* interface FIB */
+ struct ifring **if_rings; /* pairs of tx and rx rings */
+ int if_nrings; /* elements in if_rings */
uint8_t if_link_state; /* current link state */
uint32_t if_mtu; /* maximum transmission unit */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 24, 11:09 PM (8 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24148869
Default Alt Text
D3418.id.diff (2 KB)
Attached To
Mode
D3418: Add the supports for allocating per-ring counters to ifnet KPI
Attached
Detach File
Event Timeline
Log In to Comment