PERFORCE change 128367 for review
Kip Macy
kmacy at FreeBSD.org
Tue Oct 30 14:12:39 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=128367
Change 128367 by kmacy at 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 <linux/config.h>
-#include <linux/kallsyms.h>
-#include <linux/kprobes.h>
-#include <net/arp.h>
-
-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.
*/
More information about the p4-projects
mailing list