/* * netsniff-ng - the packet sniffing beast * Copyright 2009 - 2013 Daniel Borkmann. * Subject to the GPL, version 2. */ #include #include #include #include #include #include #include "pcap_io.h" #include "built_in.h" #include "die.h" #include "iosched.h" #include "ioops.h" static ssize_t pcap_rw_write(int fd, pcap_pkthdr_t *phdr, enum pcap_type type, const uint8_t *packet, size_t len) { ssize_t ret, hdrsize = pcap_get_hdr_length(phdr, type), hdrlen = 0; ret = write_or_die(fd, &phdr->raw, hdrsize); if (unlikely(ret != hdrsize)) panic("Failed to write pkt header!\n"); hdrlen = pcap_get_length(phdr, type); if (unlikely(hdrlen != (ssize_t) len)) return -EINVAL; ret = write_or_die(fd, packet, hdrlen); if (unlikely(ret != hdrlen)) panic("Failed to write pkt payload!\n"); return hdrsize + hdrlen; } static ssize_t pcap_rw_read(int fd, pcap_pkthdr_t *phdr, enum pcap_type type, uint8_t *packet, size_t len) { ssize_t ret, hdrsize = pcap_get_hdr_length(phdr, type), hdrlen = 0; ret = read_or_die(fd, &phdr->raw, hdrsize); if (unlikely(ret != hdrsize)) return -EIO; hdrlen = pcap_get_length(phdr, type); if (unlikely(hdrlen == 0 || hdrlen > (ssize_t) len)) return -EINVAL; ret = read(fd, packet, hdrlen); if (unlikely(ret != hdrlen)) return -EIO; return hdrsize + hdrlen; } static void pcap_rw_init_once(bool enforce_prio) { if (enforce_prio) set_ioprio_rt(); } static void pcap_rw_fsync(int fd) { fdatasync(fd); } const struct pcap_file_ops pcap_rw_ops = { .init_once_pcap = pcap_rw_init_once, .pull_fhdr_pcap = pcap_generic_pull_fhdr, .push_fhdr_pcap = pcap_generic_push_fhdr, .read_pcap = pcap_rw_read, .write_pcap = pcap_rw_write, .fsync_pcap = pcap_rw_fsync, }; ocumentation/devicetree?h=nds-private-remove'>logtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-10-06 21:08:13 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-06 21:08:13 -0400
commita0ec9319f429c261346038d4d54239aa80a5e289 (patch)
tree4f341218d5234cfed499dc45da0ea69ee37e6cc3 /Documentation/devicetree
parent0d818c288974e6f80923775dbf6225e3cb66659c (diff)
parent3a09f18ef6f685c714f1c5a22df9b4da58dde355 (diff)
Merge branch 'mediatek-hw-lro-chip-id-check'
Nelson Chang says: ==================== net: ethernet: mediatek: check the hw lro capability by the chip id instead of the dtsi The series modify to check if hw lro is supported by the chip id. changes since v3: - Refine mtk_is_hwlro_supported() function changes since v2: - Refine mtk_get_chip_id() function changes since v1: - Because hw lro started to be supported from MT7623, the proper way to check if the feature is capable is to judge by the chip id instead of by the dtsi. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation/devicetree')