netback.c (4e27d36d38f4c3b12bcc1855c5d41527d08d1ce0) | netback.c (c8dfaf382fa6df9dc6fd1e1c3356e0c8bf607e6a) |
---|---|
1/*- 2 * Copyright (c) 2009-2011 Spectra Logic Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 1815 unchanged lines hidden (view full) --- 1824 int nr_ents; 1825 1826 *mbufc = NULL; 1827 num_consumed = xnb_ring2pkt(&pkt, txb, txb->req_cons); 1828 if (num_consumed == 0) 1829 return 0; /* Nothing to receive */ 1830 1831 /* update statistics independent of errors */ | 1/*- 2 * Copyright (c) 2009-2011 Spectra Logic Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 1815 unchanged lines hidden (view full) --- 1824 int nr_ents; 1825 1826 *mbufc = NULL; 1827 num_consumed = xnb_ring2pkt(&pkt, txb, txb->req_cons); 1828 if (num_consumed == 0) 1829 return 0; /* Nothing to receive */ 1830 1831 /* update statistics independent of errors */ |
1832 ifnet->if_ipackets++; | 1832 if_inc_counter(ifnet, IFCOUNTER_IPACKETS, 1); |
1833 1834 /* 1835 * if we got here, then 1 or more requests was consumed, but the packet 1836 * is not necessarily valid. 1837 */ 1838 if (xnb_pkt_is_valid(&pkt) == 0) { 1839 /* got a garbage packet, respond and drop it */ 1840 xnb_txpkt2rsp(&pkt, txb, 1); 1841 txb->req_cons += num_consumed; 1842 DPRINTF("xnb_intr: garbage packet, num_consumed=%d\n", 1843 num_consumed); | 1833 1834 /* 1835 * if we got here, then 1 or more requests was consumed, but the packet 1836 * is not necessarily valid. 1837 */ 1838 if (xnb_pkt_is_valid(&pkt) == 0) { 1839 /* got a garbage packet, respond and drop it */ 1840 xnb_txpkt2rsp(&pkt, txb, 1); 1841 txb->req_cons += num_consumed; 1842 DPRINTF("xnb_intr: garbage packet, num_consumed=%d\n", 1843 num_consumed); |
1844 ifnet->if_ierrors++; | 1844 if_inc_counter(ifnet, IFCOUNTER_IERRORS, 1); |
1845 return EINVAL; 1846 } 1847 1848 *mbufc = xnb_pkt2mbufc(&pkt, ifnet); 1849 1850 if (*mbufc == NULL) { 1851 /* 1852 * Couldn't allocate mbufs. Respond and drop the packet. Do 1853 * not consume the requests 1854 */ 1855 xnb_txpkt2rsp(&pkt, txb, 1); 1856 DPRINTF("xnb_intr: Couldn't allocate mbufs, num_consumed=%d\n", 1857 num_consumed); | 1845 return EINVAL; 1846 } 1847 1848 *mbufc = xnb_pkt2mbufc(&pkt, ifnet); 1849 1850 if (*mbufc == NULL) { 1851 /* 1852 * Couldn't allocate mbufs. Respond and drop the packet. Do 1853 * not consume the requests 1854 */ 1855 xnb_txpkt2rsp(&pkt, txb, 1); 1856 DPRINTF("xnb_intr: Couldn't allocate mbufs, num_consumed=%d\n", 1857 num_consumed); |
1858 ifnet->if_iqdrops++; | 1858 if_inc_counter(ifnet, IFCOUNTER_IQDROPS, 1); |
1859 return ENOMEM; 1860 } 1861 1862 nr_ents = xnb_txpkt2gnttab(&pkt, *mbufc, gnttab, txb, otherend); 1863 1864 if (nr_ents > 0) { 1865 int __unused hv_ret = HYPERVISOR_grant_table_op(GNTTABOP_copy, 1866 gnttab, nr_ents); --- 492 unchanged lines hidden (view full) --- 2359 * and went to sleep. Notify it to wake 2360 * it up. 2361 */ 2362 out_of_space = 1; 2363 break; 2364 2365 case EINVAL: 2366 /* OS gave a corrupt packet. Drop it.*/ | 1859 return ENOMEM; 1860 } 1861 1862 nr_ents = xnb_txpkt2gnttab(&pkt, *mbufc, gnttab, txb, otherend); 1863 1864 if (nr_ents > 0) { 1865 int __unused hv_ret = HYPERVISOR_grant_table_op(GNTTABOP_copy, 1866 gnttab, nr_ents); --- 492 unchanged lines hidden (view full) --- 2359 * and went to sleep. Notify it to wake 2360 * it up. 2361 */ 2362 out_of_space = 1; 2363 break; 2364 2365 case EINVAL: 2366 /* OS gave a corrupt packet. Drop it.*/ |
2367 ifp->if_oerrors++; | 2367 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); |
2368 /* FALLTHROUGH */ 2369 default: 2370 /* Send succeeded, or packet had error. 2371 * Free the packet */ | 2368 /* FALLTHROUGH */ 2369 default: 2370 /* Send succeeded, or packet had error. 2371 * Free the packet */ |
2372 ifp->if_opackets++; | 2372 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); |
2373 if (mbufc) 2374 m_freem(mbufc); 2375 break; 2376 } 2377 if (out_of_space != 0) 2378 break; 2379 } 2380 --- 140 unchanged lines hidden --- | 2373 if (mbufc) 2374 m_freem(mbufc); 2375 break; 2376 } 2377 if (out_of_space != 0) 2378 break; 2379 } 2380 --- 140 unchanged lines hidden --- |