/* * netsniff-ng - the packet sniffing beast * Copyright 2012 Markus Amend , Deutsche Flugsicherung GmbH * Subject to the GPL, version 2. * * http://tools.ietf.org/html/rfc3032 */ #include #include #include /* for ntohs() */ #include #include "proto.h" #include "protos.h" #include "dissector_eth.h" #include "built_in.h" #include "pkt_buff.h" struct mpls_uchdr { uint32_t mpls_uc_hdr; } __packed; static int mpls_uc_next_proto(struct pkt_buff *pkt) { uint8_t proto; uint16_t key = 0; if (pkt_len(pkt)) proto = *(pkt->data); else return -EIO; /* FIXME: Right now only test for IP Version field */ switch (proto >> 4) { case 4: key = 0x0800; /* IPv4*/ break; case 6: key = 0x86DD; /* IPv6*/ break; default: /* Nothing detected ... */ return -ENOENT; } return key; } static void mpls_uc_full(struct pkt_buff *pkt) { int next; uint32_t mpls_uc_data; struct mpls_uchdr *mpls_uc; uint8_t s = 0; do { mpls_uc = (struct mpls_uchdr *) pkt_pull(pkt, sizeof(*mpls_uc)); if (mpls_uc == NULL) return; mpls_uc_data = ntohl(mpls_uc->mpls_uc_hdr); s = (mpls_uc_data >> 8) & 0x1; tprintf(" [ MPLS "); tprintf("Label (%u), ", mpls_uc_data >> 12); tprintf("Exp (%u), ", (mpls_uc_data >> 9) & 0x7); tprintf("S (%u), ", s); tprintf("TTL (%u)", (mpls_uc_data & 0xFF)); tprintf(" ]\n"); } while (!s); next = mpls_uc_next_proto(pkt); if (next < 0) return; pkt_set_proto(pkt, ð_lay2, (uint16_t) next); } static void mpls_uc_less(struct pkt_buff *pkt) { int next; uint32_t mpls_uc_data; struct mpls_uchdr *mpls_uc; uint8_t s = 0; do { mpls_uc = (struct mpls_uchdr *) pkt_pull(pkt, sizeof(*mpls_uc)); if (mpls_uc == NULL) return; mpls_uc_data = ntohl(mpls_uc->mpls_uc_hdr); s = (mpls_uc_data >> 8) & 0x1; tprintf(" MPLS/%u", mpls_uc_data >> 12); } while (!s); next = mpls_uc_next_proto(pkt); if (next < 0) return; pkt_set_proto(pkt, ð_lay2, (uint16_t) next); } struct protocol mpls_uc_ops = { .key = 0x8847, .print_full = mpls_uc_full, .print_less = mpls_uc_less, }; 29456050baaf05f777ccb83a3'>diff
diff options
context:
space:
mode:
authorMario Kleiner <mario.kleiner.de@gmail.com>2016-11-23 07:58:54 +0100
committerBen Skeggs <bskeggs@redhat.com>2016-11-28 15:39:35 +1000
commitbd9f6605a8fd24e29456050baaf05f777ccb83a3 (patch)
tree28ab78bf665f98a4025e69e3ca49242af54447d2
parent02099bac651fc040ec9b443ea8cdb1856ae768a8 (diff)
drm/nouveau/kms/nv50: Fix atomic pageflip events.
The new atomic modesetting/pageflip code for nv50+ for Linux 4.10+ no longer uses pageflip irq's to signal flip completion. Instead it polls for flip completion from within a kthread/work queue. This creates a race between the vblank irq handler updating the vblank count and timestamp for the vblank of flip completion, and the kthread's polling code detecting flip completion and sending out the flip completion event. Depending on who executes a few microseconds earlier, the flip completion event will either contain correct count/timestamp or a stale count/timestamp from the previous vblank. This error was observed for about 50% of all executed flips, e.g., observable under DRI2 by the Xorg.log filling with flip handler warning messages. Call drm_accurate_vblank_count() before sending out flip completion events to enforce a vblank count/ts update for the vblank of flip completion and avoid stale counts/timestamps. This fix leads to one redundant call to drm_update_vblank_count for each completed flip, but no other side effects. On a ~6 year old Core i7 M620@ 2.67GHz the redundant call costs about 10 usecs per flip Successfully tested on GeForce 9500/9600/330M so far. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Cc: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>