From owner-p4-projects@FreeBSD.ORG Tue Oct 30 21:12:38 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A076E16A420; Tue, 30 Oct 2007 21:12:38 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5951A16A41B for ; Tue, 30 Oct 2007 21:12:38 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4988513C491 for ; Tue, 30 Oct 2007 21:12:38 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l9ULCcei047268 for ; Tue, 30 Oct 2007 21:12:38 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l9ULCcBm047265 for perforce@freebsd.org; Tue, 30 Oct 2007 21:12:38 GMT (envelope-from kmacy@freebsd.org) Date: Tue, 30 Oct 2007 21:12:38 GMT Message-Id: <200710302112.l9ULCcBm047265@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 128367 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2007 21:12:39 -0000 http://perforce.freebsd.org/chv.cgi?CH=128367 Change 128367 by kmacy@kmacy:storage:toestack on 2007/10/30 21:12:12 remove jprobe support code Affected files ... .. //depot/projects/toestack/sys/dev/cxgb/cxgb_offload.c#11 edit Differences ... ==== //depot/projects/toestack/sys/dev/cxgb/cxgb_offload.c#11 (text+ko) ==== @@ -891,229 +891,8 @@ default: break; } - return 0; -} - - - -#if defined(FOO) -#include -#include -#include -#include - -static int (*orig_arp_constructor)(struct ifnet *); - -static void -neigh_suspect(struct ifnet *neigh) -{ - struct hh_cache *hh; - - neigh->output = neigh->ops->output; - - for (hh = neigh->hh; hh; hh = hh->hh_next) - hh->hh_output = neigh->ops->output; -} - -static void -neigh_connect(struct ifnet *neigh) -{ - struct hh_cache *hh; - - neigh->output = neigh->ops->connected_output; - - for (hh = neigh->hh; hh; hh = hh->hh_next) - hh->hh_output = neigh->ops->hh_output; -} - -static inline int -neigh_max_probes(const struct neighbour *n) -{ - const struct neigh_parms *p = n->parms; - return (n->nud_state & NUD_PROBE ? - p->ucast_probes : - p->ucast_probes + p->app_probes + p->mcast_probes); } -static void -neigh_timer_handler_offload(unsigned long arg) -{ - unsigned long now, next; - struct neighbour *neigh = (struct neighbour *)arg; - unsigned state; - int notify = 0; - - write_lock(&neigh->lock); - - state = neigh->nud_state; - now = jiffies; - next = now + HZ; - - if (!(state & NUD_IN_TIMER)) { -#ifndef CONFIG_SMP - log(LOG_WARNING, "neigh: timer & !nud_in_timer\n"); -#endif - goto out; - } - - if (state & NUD_REACHABLE) { - if (time_before_eq(now, - neigh->confirmed + - neigh->parms->reachable_time)) { - next = neigh->confirmed + neigh->parms->reachable_time; - } else if (time_before_eq(now, - neigh->used + - neigh->parms->delay_probe_time)) { - neigh->nud_state = NUD_DELAY; - neigh->updated = jiffies; - neigh_suspect(neigh); - next = now + neigh->parms->delay_probe_time; - } else { - neigh->nud_state = NUD_STALE; - neigh->updated = jiffies; - neigh_suspect(neigh); - cxgb_neigh_update(neigh); - } - } else if (state & NUD_DELAY) { - if (time_before_eq(now, - neigh->confirmed + - neigh->parms->delay_probe_time)) { - neigh->nud_state = NUD_REACHABLE; - neigh->updated = jiffies; - neigh_connect(neigh); - cxgb_neigh_update(neigh); - next = neigh->confirmed + neigh->parms->reachable_time; - } else { - neigh->nud_state = NUD_PROBE; - neigh->updated = jiffies; - atomic_set_int(&neigh->probes, 0); - next = now + neigh->parms->retrans_time; - } - } else { - /* NUD_PROBE|NUD_INCOMPLETE */ - next = now + neigh->parms->retrans_time; - } - /* - * Needed for read of probes - */ - mb(); - if ((neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) && - neigh->probes >= neigh_max_probes(neigh)) { - struct mbuf *m; - - neigh->nud_state = NUD_FAILED; - neigh->updated = jiffies; - notify = 1; - cxgb_neigh_update(neigh); - NEIGH_CACHE_STAT_INC(neigh->tbl, res_failed); - - /* It is very thin place. report_unreachable is very - complicated routine. Particularly, it can hit the same - neighbour entry! - So that, we try to be accurate and avoid dead loop. --ANK - */ - while (neigh->nud_state == NUD_FAILED && - (skb = __skb_dequeue(&neigh->arp_queue)) != NULL) { - write_unlock(&neigh->lock); - neigh->ops->error_report(neigh, skb); - write_lock(&neigh->lock); - } - skb_queue_purge(&neigh->arp_queue); - } - - if (neigh->nud_state & NUD_IN_TIMER) { - if (time_before(next, jiffies + HZ/2)) - next = jiffies + HZ/2; - if (!mod_timer(&neigh->timer, next)) - neigh_hold(neigh); - } - if (neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) { - struct mbuf *m = skb_peek(&neigh->arp_queue); - - write_unlock(&neigh->lock); - neigh->ops->solicit(neigh, skb); - atomic_add_int(&neigh->probes, 1); - if (m) - m_free(m); - } else { -out: - write_unlock(&neigh->lock); - } - -#ifdef CONFIG_ARPD - if (notify && neigh->parms->app_probes) - neigh_app_notify(neigh); -#endif - neigh_release(neigh); -} - -static int -arp_constructor_offload(struct neighbour *neigh) -{ - if (neigh->ifp && is_offloading(neigh->ifp)) - neigh->timer.function = neigh_timer_handler_offload; - return orig_arp_constructor(neigh); -} - -/* - * This must match exactly the signature of neigh_update for jprobes to work. - * It runs from a trap handler with interrupts off so don't disable BH. - */ -static int -neigh_update_offload(struct neighbour *neigh, const u8 *lladdr, - u8 new, u32 flags) -{ - write_lock(&neigh->lock); - cxgb_neigh_update(neigh); - write_unlock(&neigh->lock); - jprobe_return(); - /* NOTREACHED */ - return 0; -} - -static struct jprobe neigh_update_jprobe = { - .entry = (kprobe_opcode_t *) neigh_update_offload, - .kp.addr = (kprobe_opcode_t *) neigh_update -}; - -#ifdef MODULE_SUPPORT -static int -prepare_arp_with_t3core(void) -{ - int err; - - err = register_jprobe(&neigh_update_jprobe); - if (err) { - log(LOG_ERR, "Could not install neigh_update jprobe, " - "error %d\n", err); - return err; - } - - orig_arp_constructor = arp_tbl.constructor; - arp_tbl.constructor = arp_constructor_offload; - - return 0; -} - -static void -restore_arp_sans_t3core(void) -{ - arp_tbl.constructor = orig_arp_constructor; - unregister_jprobe(&neigh_update_jprobe); -} - -#else /* Module suport */ -static inline int -prepare_arp_with_t3core(void) -{ - return 0; -} - -static inline void -restore_arp_sans_t3core(void) -{} -#endif -#endif /* * Process a received packet with an unknown/unexpected CPL opcode. */