if_nf10bmac.c (270856) | if_nf10bmac.c (271849) |
---|---|
1/*- 2 * Copyright (c) 2012-2014 Bjoern A. Zeeb 3 * All rights reserved. 4 * 5 * This software was developed by SRI International and the University of 6 * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-11-C-0249 7 * ("MRC2"), as part of the DARPA MRC research programme. 8 * --- 23 unchanged lines hidden (view full) --- 32 * 33 * TODO: 34 * - figure out on the HW side why some data is LE and some is BE. 35 * - general set of improvements possible (e.g., reduce times of copying, 36 * do on-the-copy checksum calculations) 37 */ 38 39#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2012-2014 Bjoern A. Zeeb 3 * All rights reserved. 4 * 5 * This software was developed by SRI International and the University of 6 * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-11-C-0249 7 * ("MRC2"), as part of the DARPA MRC research programme. 8 * --- 23 unchanged lines hidden (view full) --- 32 * 33 * TODO: 34 * - figure out on the HW side why some data is LE and some is BE. 35 * - general set of improvements possible (e.g., reduce times of copying, 36 * do on-the-copy checksum calculations) 37 */ 38 39#include <sys/cdefs.h> |
40__FBSDID("$FreeBSD: head/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c 270856 2014-08-30 19:55:54Z glebius $"); | 40__FBSDID("$FreeBSD: head/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c 271849 2014-09-19 03:51:26Z glebius $"); |
41 42#include "opt_device_polling.h" 43#include "opt_netfpga.h" 44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/kernel.h> 48#include <sys/bus.h> --- 360 unchanged lines hidden (view full) --- 409 (len - l) < sizeof(val)) { 410 /* 411 * Our length and LAST disagree. We have a valid STRB. 412 * We could continue until we fill the mbuf and just 413 * log the invlid length "hint". For now drop the 414 * packet on the floor and count the error. 415 */ 416 nf10bmac_eat_packet_munch_munch(sc); | 41 42#include "opt_device_polling.h" 43#include "opt_netfpga.h" 44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/kernel.h> 48#include <sys/bus.h> --- 360 unchanged lines hidden (view full) --- 409 (len - l) < sizeof(val)) { 410 /* 411 * Our length and LAST disagree. We have a valid STRB. 412 * We could continue until we fill the mbuf and just 413 * log the invlid length "hint". For now drop the 414 * packet on the floor and count the error. 415 */ 416 nf10bmac_eat_packet_munch_munch(sc); |
417 ifp->if_ierrors++; | 417 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); |
418 m_freem(m); 419 return (0); 420 } else if ((len - l) <= sizeof(val)) { 421 cl = len - l; 422 } else { 423 cl = sizeof(val); 424 } 425 --- 14 unchanged lines hidden (view full) --- 440 DELAY(10); 441 md = NF10BMAC_READ(sc, NF10BMAC_RX_META); 442 } 443 } 444 /* We should get out of this loop with tlast and tsrb. */ 445 if ((md & NF10BMAC_DATA_LAST) == 0 || (md & NF10BMAC_DATA_STRB) == 0) { 446 device_printf(sc->nf10bmac_dev, "Unexpected rx loop end state: " 447 "md=0x%08jx len=%d l=%d\n", (uintmax_t)md, len, l); | 418 m_freem(m); 419 return (0); 420 } else if ((len - l) <= sizeof(val)) { 421 cl = len - l; 422 } else { 423 cl = sizeof(val); 424 } 425 --- 14 unchanged lines hidden (view full) --- 440 DELAY(10); 441 md = NF10BMAC_READ(sc, NF10BMAC_RX_META); 442 } 443 } 444 /* We should get out of this loop with tlast and tsrb. */ 445 if ((md & NF10BMAC_DATA_LAST) == 0 || (md & NF10BMAC_DATA_STRB) == 0) { 446 device_printf(sc->nf10bmac_dev, "Unexpected rx loop end state: " 447 "md=0x%08jx len=%d l=%d\n", (uintmax_t)md, len, l); |
448 ifp->if_ierrors++; | 448 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); |
449 m_freem(m); 450 return (0); 451 } 452 453 m->m_pkthdr.len = m->m_len = len; 454 m->m_pkthdr.rcvif = ifp; | 449 m_freem(m); 450 return (0); 451 } 452 453 m->m_pkthdr.len = m->m_len = len; 454 m->m_pkthdr.rcvif = ifp; |
455 ifp->if_ipackets++; | 455 if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); |
456 457 NF10BMAC_UNLOCK(sc); 458 (*ifp->if_input)(ifp, m); 459 NF10BMAC_LOCK(sc); 460 461 return (1); 462} 463 --- 115 unchanged lines hidden (view full) --- 579{ 580 581 NF10BMAC_LOCK_ASSERT(sc); 582 583 if (sc->nf10bmac_watchdog_timer == 0 || --sc->nf10bmac_watchdog_timer > 0) 584 return; 585 586 device_printf(sc->nf10bmac_dev, "watchdog timeout\n"); | 456 457 NF10BMAC_UNLOCK(sc); 458 (*ifp->if_input)(ifp, m); 459 NF10BMAC_LOCK(sc); 460 461 return (1); 462} 463 --- 115 unchanged lines hidden (view full) --- 579{ 580 581 NF10BMAC_LOCK_ASSERT(sc); 582 583 if (sc->nf10bmac_watchdog_timer == 0 || --sc->nf10bmac_watchdog_timer > 0) 584 return; 585 586 device_printf(sc->nf10bmac_dev, "watchdog timeout\n"); |
587 sc->nf10bmac_ifp->if_oerrors++; | 587 sc->nf10if_inc_counter(bmac_ifp, IFCOUNTER_OERRORS, 1); |
588 589 sc->nf10bmac_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; 590 nf10bmac_init_locked(sc); 591 592 if (!IFQ_DRV_IS_EMPTY(&sc->nf10bmac_ifp->if_snd)) 593 nf10bmac_start_locked(sc->nf10bmac_ifp); 594} 595 --- 375 unchanged lines hidden --- | 588 589 sc->nf10bmac_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; 590 nf10bmac_init_locked(sc); 591 592 if (!IFQ_DRV_IS_EMPTY(&sc->nf10bmac_ifp->if_snd)) 593 nf10bmac_start_locked(sc->nf10bmac_ifp); 594} 595 --- 375 unchanged lines hidden --- |