* returns the input and output packet and byte counts on the vif provided */
| 584 | * returns the input and output packet and byte counts on the vif provided |
| 585 | */ |
| 586 | static int |
| 587 | get_vif_cnt(struct sioc_vif_req *req) |
| 588 | { |
| 589 | vifi_t vifi = req->vifi; |
| 590 | |
| 591 | VIF_LOCK(); |
| 592 | if (vifi >= V_numvifs) { |
| 593 | VIF_UNLOCK(); |
| 594 | return EINVAL; |
| 595 | } |
| 596 | |
| 597 | req->icount = V_viftable[vifi].v_pkt_in; |
| 598 | req->ocount = V_viftable[vifi].v_pkt_out; |
| 599 | req->ibytes = V_viftable[vifi].v_bytes_in; |
| 600 | req->obytes = V_viftable[vifi].v_bytes_out; |
| 601 | VIF_UNLOCK(); |
| 602 | |
| 603 | return 0; |
| 604 | } |
| 605 | |
| 606 | static void |
| 607 | if_detached_event(void *arg __unused, struct ifnet *ifp) |