/* * netsniff-ng - the packet sniffing beast * Copyright 2009, 2010 Daniel Borkmann. * Subject to the GPL, version 2. */ #include #include #include #include #include "proto.h" #include "protos.h" #include "dissector_eth.h" #include "pkt_buff.h" #include "oui.h" static void ethernet(struct pkt_buff *pkt) { char *type; uint8_t *src_mac, *dst_mac; struct ethhdr *eth = (struct ethhdr *) pkt_pull(pkt, sizeof(*eth)); if (eth == NULL) return; src_mac = eth->h_source; dst_mac = eth->h_dest; tprintf(" [ Eth "); tprintf("MAC (%.2x:%.2x:%.2x:%.2x:%.2x:%.2x => ", src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5]); tprintf("%.2x:%.2x:%.2x:%.2x:%.2x:%.2x), ", dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5]); tprintf("Proto (0x%.4x", ntohs(eth->h_proto)); type = lookup_ether_type(ntohs(eth->h_proto)); if (type) tprintf(", %s%s%s", colorize_start(bold), type, colorize_end()); tprintf(") ]\n"); tprintf(" [ Vendor "); tprintf("(%s => %s)", lookup_vendor_str((src_mac[0] << 16) | (src_mac[1] << 8) | src_mac[2]), lookup_vendor_str((dst_mac[0] << 16) | (dst_mac[1] << 8) | dst_mac[2])); tprintf(" ]\n"); pkt_set_proto(pkt, ð_lay2, ntohs(eth->h_proto)); } static void ethernet_less(struct pkt_buff *pkt) { uint8_t *src_mac, *dst_mac; struct ethhdr *eth = (struct ethhdr *) pkt_pull(pkt, sizeof(*eth)); if (eth == NULL) return; src_mac = eth->h_source; dst_mac = eth->h_dest; tprintf(" %s => %s ", lookup_vendor_str((src_mac[0] << 16) | (src_mac[1] << 8) | src_mac[2]), lookup_vendor_str((dst_mac[0] << 16) | (dst_mac[1] << 8) | dst_mac[2])); tprintf("%s%s%s", colorize_start(bold), lookup_ether_type(ntohs(eth->h_proto)), colorize_end()); pkt_set_proto(pkt, ð_lay2, ntohs(eth->h_proto)); } struct protocol ethernet_ops = { .key = 0, .print_full = ethernet, .print_less = ethernet_less, }; /a>
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-06-16 15:42:26 +0200
committerGregory CLEMENT <gregory.clement@free-electrons.com>2016-06-16 17:00:40 +0200
commit6a02734d420fca778554878d03017017537d92e1 (patch)
treee59962caeafb8f45eac7ae3fae94a7e4423f74e0
parentc5379ba8fccd99d5f99632c789f0393d84a57805 (diff)
ARM: mvebu: map PCI I/O regions strongly ordered
In order for HW I/O coherency to work on Cortex-A9 based Marvell SoCs, all MMIO registers must be mapped strongly ordered. In commit 1c8c3cf0b5239 ("ARM: 8060/1: mm: allow sub-architectures to override PCI I/O memory type") we implemented a new function, pci_ioremap_set_mem_type(), that allow sub-architecture code to override the memory type used to map PCI I/O regions. In the discussion around this patch series [1], Arnd Bergmann made the comment that maybe all PCI I/O regions should be mapped strongly-ordered, which would have made our proposal to add pci_ioremap_set_mem_type() irrelevant. So, we submitted a patch [2] that did what Arnd suggested. However, Russell in the end merged our initial proposal to add pci_ioremap_set_mem_type(), but it was never used anywhere. Further discussion with Arnd and other folks on IRC lead to the conclusion that in fact using strongly-ordered for all platforms was maybe not desirable, and therefore, using pci_ioremap_set_mem_type() was the most appropriate solution. As a consequence, this commit finally adds the pci_ioremap_set_mem_type() call in the mach-mvebu platform code, which was originally part of our initial patch series [3] and is necessary for the whole mechanism to work. [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/256565.html [2] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/256755.html [3] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/256563.html Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>