/* * netsniff-ng - the packet sniffing beast * Copyright 2009 - 2013 Daniel Borkmann. * Subject to the GPL, version 2. */ #ifndef DISSECTOR_H #define DISSECTOR_H #include #include #include #include #include #include "ring.h" #include "tprintf.h" #include "pcap_io.h" #include "built_in.h" #define PRINT_NORM 0 #define PRINT_LESS 1 #define PRINT_HEX 2 #define PRINT_ASCII 3 #define PRINT_HEX_ASCII 4 #define PRINT_NONE 5 static const char * const packet_types[256]={ "<", /* Incoming */ "B", /* Broadcast */ "M", /* Multicast */ "P", /* Promisc */ ">", /* Outgoing */ "?", /* Unknown */ }; extern char *if_indextoname(unsigned ifindex, char *ifname); static inline const char *__show_ts_source(uint32_t status) { if (status & TP_STATUS_TS_RAW_HARDWARE) return "(raw hw ts)"; else if (status & TP_STATUS_TS_SYS_HARDWARE) return "(sys hw ts)"; else if (status & TP_STATUS_TS_SOFTWARE) return "(sw ts)"; else return ""; } static inline void __show_frame_hdr(struct sockaddr_ll *s_ll, void *raw, int mode, bool v3) { char tmp[IFNAMSIZ]; union tpacket_uhdr hdr; if (mode == PRINT_NONE) return; hdr.raw = raw; switch (mode) { case PRINT_LESS: tprintf("%s %s %u", packet_types[s_ll->sll_pkttype] ? : "?", if_indextoname(s_ll->sll_ifindex, tmp) ? : "?", v3 ? hdr.h3->tp_len : hdr.h2->tp_len); break; default: tprintf("%s %s %u %us.%uns %s\n", packet_types[s_ll->sll_pkttype] ? : "?", if_indextoname(s_ll->sll_ifindex, tmp) ? : "?", v3 ? hdr.h3->tp_len : hdr.h2->tp_len, v3 ? hdr.h3->tp_sec : hdr.h2->tp_sec, v3 ? hdr.h3->tp_nsec : hdr.h2->tp_nsec, v3 ? "" : __show_ts_source(hdr.h2->tp_status)); break; } } static inline void show_frame_hdr(struct frame_map *hdr, int mode) { __show_frame_hdr(&hdr->s_ll, &hdr->tp_h, mode, false); } extern void dissector_init_all(int fnttype); extern void dissector_entry_point(uint8_t *packet, size_t len, int linktype, int mode); extern void dissector_cleanup_all(void); extern int dissector_set_print_type(void *ptr, int type); #endif /* DISSECTOR_H */ value='f55d84b07c4e7340473a25dc82b462607578402c'/>
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2016-06-01 08:53:48 -0700
committerDavid S. Miller <davem@davemloft.net>2016-06-02 12:12:16 -0700
commitf55d84b07c4e7340473a25dc82b462607578402c (patch)
tree76d0c5938a675f534fc04e88b8beb308563927a5
parent14b84e8654c89ed59f433654e6bb64c886d095cd (diff)
stmmac: do not sleep in atomic context for mdio_reset
stmmac_mdio_reset() has been updated to use msleep rather udelay (as some PHY requires a one second delay there). It called from stmmac_resume() within the spin_lock_irqsave block atomic context triggering 'scheduling while atomic'. The stmmac_priv lock usage is not fully documented, but it seems to protect the access to the MAC registers / DMA structures rather than the MDIO bus or the PHY (which have separate locking), so we can push the spin_lock after the stmmac_mdio_reset call. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>