Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed change to libstatgrab/network_stats.c #22

Closed
tdb opened this issue Aug 12, 2013 · 1 comment
Closed

Proposed change to libstatgrab/network_stats.c #22

tdb opened this issue Aug 12, 2013 · 1 comment
Milestone

Comments

@tdb
Copy link
Member

tdb commented Aug 12, 2013

This is taken from an old 2008 RT ticket. @rehsack wanted it preserved for further investigation. Here's the original message:

Hello, I observed the information about link status for Solaris Ethernet interfaces does not appear in the same place in kstat structure.

For "hme" and "ce" device drivers it appears in the driver instance information:
module=ce, instance=0, name=ce0, class=net
module=hme, instance=0, name=hme0, class=net

For "bge" device driver it appears in
module=bge, instance=0, name=mii, class=net

For "e1000g" device driver it appears in
module=e1000g, instance=0, name=statistics, class=net

The "patch" updates the queries on kstat structure at least for these device drivers.

And here is the patch given:

--- old-network_stats.c 2008-05-22 08:27:33.000000000 +0100
+++ network_stats.c 2008-05-22 08:57:57.000000000 +0100
@@ -697,9 +697,26 @@
                return NULL;
            }
 
-           if ((ifr.ifr_flags & IFF_UP) != 0) {
-               if ((knp = kstat_data_lookup(ksp, "link_up")) != NULL) {
-                   /* take in to account if link
+                        if ((ifr.ifr_flags & IFF_UP) != 0) {
+                            /* module=ce,  instance=0, name=ce0,  class=net 
+                               module=hme, instance=0, name=hme0, class=net */
+                            if ((knp = kstat_data_lookup(ksp, "link_up")) == NULL) { 
+                                /* module=bge, instance=0, name=mii, class=net */
+                                kstat_t *mksp = kstat_lookup(kc,ksp->ks_module,ksp->ks_instance,"mii");
+                                if (mksp != NULL) { 
+                                    knp = kstat_data_lookup(mksp,"link_up"); 
+                                    if (knp == NULL) { 
+                                        /* module=e1000g, instance=0, name=statistics, class=net */
+                                        mksp = kstat_lookup(kc,ksp->ks_module,ksp->ks_instance,"statistics"); 
+                                        if (mksp != NULL) { 
+                                            knp = kstat_data_lookup(mksp,"link_up"); 
+                                        }
+                                    }
+                                } 
+                           }
+
+                           if (knp != NULL) {
+                               /* take in to account if link
                     * is up as well as interface */
                    if (knp->value.ui32 != 0u) {
                        network_iface_stat_ptr->up = 1;

That patch was against libstatgrab 0.16.

@tdb tdb assigned i-scream and unassigned i-scream Jun 5, 2014
@rehsack rehsack added this to the 0.90.2 milestone Jun 6, 2014
rehsack added a commit to rehsack/libstatgrab that referenced this issue Nov 14, 2018
From RT#...

Hello, I observed the information about link status for Solaris Ethernet
interfaces does not appear in the same place in kstat structure.

For "hme" and "ce" device drivers it appears in the driver instance information:
    module=ce, instance=0, name=ce0, class=net
    module=hme, instance=0, name=hme0, class=net

For "bge" device driver it appears in
    module=bge, instance=0, name=mii, class=net

For "e1000g" device driver it appears in
    module=e1000g, instance=0, name=statistics, class=net

The "patch" updates the queries on kstat structure at least for these device drivers.

Patch from libstatgrab#22

Signed-off-by: Jens Rehsack <sno@netbsd.org>
rehsack added a commit to rehsack/libstatgrab that referenced this issue Nov 15, 2018
From RT#...

Hello, I observed the information about link status for Solaris Ethernet
interfaces does not appear in the same place in kstat structure.

For "hme" and "ce" device drivers it appears in the driver instance information:
    module=ce, instance=0, name=ce0, class=net
    module=hme, instance=0, name=hme0, class=net

For "bge" device driver it appears in
    module=bge, instance=0, name=mii, class=net

For "e1000g" device driver it appears in
    module=e1000g, instance=0, name=statistics, class=net

The "patch" updates the queries on kstat structure at least for these device drivers.

Patch from libstatgrab#22

Signed-off-by: Jens Rehsack <sno@netbsd.org>
tdb pushed a commit to tdb/libstatgrab that referenced this issue Mar 14, 2019
From RT#...

Hello, I observed the information about link status for Solaris Ethernet
interfaces does not appear in the same place in kstat structure.

For "hme" and "ce" device drivers it appears in the driver instance information:
    module=ce, instance=0, name=ce0, class=net
    module=hme, instance=0, name=hme0, class=net

For "bge" device driver it appears in
    module=bge, instance=0, name=mii, class=net

For "e1000g" device driver it appears in
    module=e1000g, instance=0, name=statistics, class=net

The "patch" updates the queries on kstat structure at least for these device drivers.

Patch from libstatgrab#22

Signed-off-by: Jens Rehsack <sno@netbsd.org>
tdb pushed a commit that referenced this issue Mar 15, 2019
From RT#...

Hello, I observed the information about link status for Solaris Ethernet
interfaces does not appear in the same place in kstat structure.

For "hme" and "ce" device drivers it appears in the driver instance information:
    module=ce, instance=0, name=ce0, class=net
    module=hme, instance=0, name=hme0, class=net

For "bge" device driver it appears in
    module=bge, instance=0, name=mii, class=net

For "e1000g" device driver it appears in
    module=e1000g, instance=0, name=statistics, class=net

The "patch" updates the queries on kstat structure at least for these device drivers.

Patch from #22

Signed-off-by: Jens Rehsack <sno@netbsd.org>
tdb pushed a commit that referenced this issue Mar 15, 2019
From RT#...

Hello, I observed the information about link status for Solaris Ethernet
interfaces does not appear in the same place in kstat structure.

For "hme" and "ce" device drivers it appears in the driver instance information:
    module=ce, instance=0, name=ce0, class=net
    module=hme, instance=0, name=hme0, class=net

For "bge" device driver it appears in
    module=bge, instance=0, name=mii, class=net

For "e1000g" device driver it appears in
    module=e1000g, instance=0, name=statistics, class=net

The "patch" updates the queries on kstat structure at least for these device drivers.

Patch from #22

Signed-off-by: Jens Rehsack <sno@netbsd.org>
@tdb
Copy link
Member Author

tdb commented Mar 15, 2019

#99 merged.

@tdb tdb closed this as completed Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants