Date: Sat, 6 May 2006 12:46:37 GMT From: tkuik <tkuik@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96738 for review Message-ID: <200605061246.k46Ckb4P060337@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96738 Change 96738 by tkuik@tkuik_freebsd on 2006/05/06 12:46:31 Added check for rings before display in sysctl output. Affected files ... .. //depot/projects/xen3/src/sys/dev/xen/netback/netback.c#2 edit Differences ... ==== //depot/projects/xen3/src/sys/dev/xen/netback/netback.c#2 (text+ko) ==== @@ -904,7 +904,7 @@ #if XEN_NETBACK_FIXUP_CSUM /* Check if we need to compute a checksum. This happens */ - /* when briding from one domain to another. */ + /* when bridging from one domain to another. */ if ((m->m_pkthdr.csum_flags & CSUM_DELAY_DATA)) fixup_checksum(m); #endif @@ -1414,31 +1414,29 @@ }; static char * -vif_sysctl_txring_info(netif_tx_back_ring_t *tx) +vif_sysctl_ring_info(netif_t *netif, int cmd) { char *buf = malloc(256, M_DEVBUF, M_WAITOK); if (buf) { - sprintf(buf, "nr_ents=%x req_cons=%x" - " req_prod=%x req_event=%x" - " rsp_prod=%x rsp_event=%x", - tx->nr_ents, tx->req_cons, - tx->sring->req_prod, tx->sring->req_event, - tx->sring->rsp_prod, tx->sring->rsp_event); - } - return buf; -} - -static char * -vif_sysctl_rxring_info(netif_rx_back_ring_t *rx) -{ - char *buf = malloc(256, M_DEVBUF, M_WAITOK); - if (buf) { - sprintf(buf, "nr_ents=%x req_cons=%x" - " req_prod=%x req_event=%x" - " rsp_prod=%x rsp_event=%x", - rx->nr_ents, rx->req_cons, - rx->sring->req_prod, rx->sring->req_event, - rx->sring->rsp_prod, rx->sring->rsp_event); + if (!netif->rings_connected) + sprintf(buf, "rings not connected\n"); + else if (cmd == VIF_SYSCTL_TXRING) { + netif_tx_back_ring_t *tx = &netif->tx; + sprintf(buf, "nr_ents=%x req_cons=%x" + " req_prod=%x req_event=%x" + " rsp_prod=%x rsp_event=%x", + tx->nr_ents, tx->req_cons, + tx->sring->req_prod, tx->sring->req_event, + tx->sring->rsp_prod, tx->sring->rsp_event); + } else { + netif_rx_back_ring_t *rx = &netif->rx; + sprintf(buf, "nr_ents=%x req_cons=%x" + " req_prod=%x req_event=%x" + " rsp_prod=%x rsp_event=%x", + rx->nr_ents, rx->req_cons, + rx->sring->req_prod, rx->sring->req_event, + rx->sring->rsp_prod, rx->sring->rsp_event); + } } return buf; } @@ -1458,10 +1456,8 @@ case VIF_SYSCTL_HANDLE: return sysctl_handle_int(oidp, NULL, netif->handle, req); case VIF_SYSCTL_TXRING: - value = buf = vif_sysctl_txring_info(&netif->tx); - break; case VIF_SYSCTL_RXRING: - value = buf = vif_sysctl_rxring_info(&netif->rx); + value = buf = vif_sysctl_ring_info(netif, arg2); break; default: return (EINVAL);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605061246.k46Ckb4P060337>