From owner-p4-projects@FreeBSD.ORG Sat May 6 12:46:38 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5979416A431; Sat, 6 May 2006 12:46:38 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 100FE16A428 for ; Sat, 6 May 2006 12:46:38 +0000 (UTC) (envelope-from tkuik@freefall.freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B329843D48 for ; Sat, 6 May 2006 12:46:37 +0000 (GMT) (envelope-from tkuik@freefall.freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k46Ckbmi060340 for ; Sat, 6 May 2006 12:46:37 GMT (envelope-from tkuik@freefall.freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k46Ckb4P060337 for perforce@freebsd.org; Sat, 6 May 2006 12:46:37 GMT (envelope-from tkuik@freefall.freebsd.org) Date: Sat, 6 May 2006 12:46:37 GMT Message-Id: <200605061246.k46Ckb4P060337@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to tkuik@freefall using -f From: tkuik To: Perforce Change Reviews Cc: Subject: PERFORCE change 96738 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2006 12:46:38 -0000 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);