/* * Stream Parser * * Copyright (c) 2016 Tom Herbert * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. */ #ifndef __NET_STRPARSER_H_ #define __NET_STRPARSER_H_ #include #include #define STRP_STATS_ADD(stat, count) ((stat) += (count)) #define STRP_STATS_INCR(stat) ((stat)++) struct strp_stats { unsigned long long rx_msgs; unsigned long long rx_bytes; unsigned int rx_mem_fail; unsigned int rx_need_more_hdr; unsigned int rx_msg_too_big; unsigned int rx_msg_timeouts; unsigned int rx_bad_hdr_len; }; struct strp_aggr_stats { unsigned long long rx_msgs; unsigned long long rx_bytes; unsigned int rx_mem_fail; unsigned int rx_need_more_hdr; unsigned int rx_msg_too_big; unsigned int rx_msg_timeouts; unsigned int rx_bad_hdr_len; unsigned int rx_aborts; unsigned int rx_interrupted; unsigned int rx_unrecov_intr; }; struct strparser; /* Callbacks are called with lock held for the attached socket */ struct strp_callbacks { int (*parse_msg)(struct strparser *strp, struct sk_buff *skb); void (*rcv_msg)(struct strparser *strp, struct sk_buff *skb); int (*read_sock_done)(struct strparser *strp, int err); void (*abort_parser)(struct strparser *strp, int err); }; struct strp_rx_msg { int full_len; int offset; }; static inline struct strp_rx_msg *strp_rx_msg(struct sk_buff *skb) { return (struct strp_rx_msg *)((void *)skb->cb + offsetof(struct qdisc_skb_cb, data)); } /* Structure for an attached lower socket */ struct strparser { struct sock *sk; u32 rx_stopped : 1; u32 rx_paused : 1; u32 rx_aborted : 1; u32 rx_interrupted : 1; u32 rx_unrecov_intr : 1; struct sk_buff **rx_skb_nextp; struct timer_list rx_msg_timer; struct sk_buff *rx_skb_head; unsigned int rx_need_bytes; struct delayed_work rx_delayed_work; struct work_struct rx_work; struct strp_stats stats; struct strp_callbacks cb; }; /* Must be called with lock held for attached socket */ static inline void strp_pause(struct strparser *strp) { strp->rx_paused = 1; } /* May be called without holding lock for attached socket */ void strp_unpause(struct strparser *strp); static inline void save_strp_stats(struct strparser *strp, struct strp_aggr_stats *agg_stats) { /* Save psock statistics in the mux when psock is being unattached. */ #define SAVE_PSOCK_STATS(_stat) (agg_stats->_stat += \ strp->stats._stat) SAVE_PSOCK_STATS(rx_msgs); SAVE_PSOCK_STATS(rx_bytes); SAVE_PSOCK_STATS(rx_mem_fail); SAVE_PSOCK_STATS(rx_need_more_hdr); SAVE_PSOCK_STATS(rx_msg_too_big); SAVE_PSOCK_STATS(rx_msg_timeouts); SAVE_PSOCK_STATS(rx_bad_hdr_len); #undef SAVE_PSOCK_STATS if (strp->rx_aborted) agg_stats->rx_aborts++; if (strp->rx_interrupted) agg_stats->rx_interrupted++; if (strp->rx_unrecov_intr) agg_stats->rx_unrecov_intr++; } static inline void aggregate_strp_stats(struct strp_aggr_stats *stats, struct strp_aggr_stats *agg_stats) { #define SAVE_PSOCK_STATS(_stat) (agg_stats->_stat += stats->_stat) SAVE_PSOCK_STATS(rx_msgs); SAVE_PSOCK_STATS(rx_bytes); SAVE_PSOCK_STATS(rx_mem_fail); SAVE_PSOCK_STATS(rx_need_more_hdr); SAVE_PSOCK_STATS(rx_msg_too_big); SAVE_PSOCK_STATS(rx_msg_timeouts); SAVE_PSOCK_STATS(rx_bad_hdr_len); SAVE_PSOCK_STATS(rx_aborts); SAVE_PSOCK_STATS(rx_interrupted); SAVE_PSOCK_STATS(rx_unrecov_intr); #undef SAVE_PSOCK_STATS } void strp_done(struct strparser *strp); void strp_stop(struct strparser *strp); void strp_check_rcv(struct strparser *strp); int strp_init(struct strparser *strp, struct sock *csk, struct strp_callbacks *cb); void strp_data_ready(struct strparser *strp); #endif /* __NET_STRPARSER_H_ */ value='25'>25space:mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2017-01-12 17:15:56 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2017-01-30 10:17:32 +0100
commite6e7b48b295afa5a5ab440de0a94d9ad8b3ce2d0 (patch)
tree77cadb6d8aad1b52c34e4afa8c9deef603bbe2ed /net/ax25/ax25_std_subr.c
parent4e5b54f127426c82dc2816340c26d951a5bb3429 (diff)
drm: Don't race connector registration
I was under the misconception that the sysfs dev stuff can be fully set up, and then registered all in one step with device_add. That's true for properties and property groups, but not for parents and child devices. Those must be fully registered before you can register a child. Add a bit of tracking to make sure that asynchronous mst connector hotplugging gets this right. For consistency we rely upon the implicit barriers of the connector->mutex, which is taken anyway, to ensure that at least either the connector or device registration call will work out. Mildly tested since I can't reliably reproduce this on my mst box here. Reported-by: Dave Hansen <dave.hansen@intel.com> Cc: Dave Hansen <dave.hansen@intel.com> Acked-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1484237756-2720-1-git-send-email-daniel.vetter@ffwll.ch
Diffstat (limited to 'net/ax25/ax25_std_subr.c')