From owner-p4-projects@FreeBSD.ORG Thu Dec 20 08:06:57 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 16D6616A41B; Thu, 20 Dec 2007 08:06:57 +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 98CD016A418 for ; Thu, 20 Dec 2007 08:06:56 +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 8E37613C47E for ; Thu, 20 Dec 2007 08:06:56 +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 lBK86uLW082342 for ; Thu, 20 Dec 2007 08:06:56 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBK86uUU082339 for perforce@freebsd.org; Thu, 20 Dec 2007 08:06:56 GMT (envelope-from kmacy@freebsd.org) Date: Thu, 20 Dec 2007 08:06:56 GMT Message-Id: <200712200806.lBK86uUU082339@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 131303 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: Thu, 20 Dec 2007 08:06:57 -0000 http://perforce.freebsd.org/chv.cgi?CH=131303 Change 131303 by kmacy@kmacy:storage:toehead on 2007/12/20 08:06:03 IFC loose ends Affected files ... .. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#2 edit .. //depot/projects/toehead/sys/netinet/if_ether.c#4 edit .. //depot/projects/toehead/sys/netinet/toedev.h#2 edit Differences ... ==== //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#2 (text+ko) ==== @@ -147,6 +147,10 @@ static inline void free_atid(struct t3cdev *cdev, unsigned int tid); static void handle_syncache_event(int event, void *arg); +#ifndef TCP_USRREQS_OVERLOAD +#define cxgb_tcp_drop tcp_drop +#endif + static inline int is_t3a(const struct toedev *dev) ==== //depot/projects/toehead/sys/netinet/if_ether.c#4 (text+ko) ==== @@ -888,10 +888,6 @@ la->la_preempt = arp_maxtries; hold = la->la_hold; la->la_hold = NULL; - - sin.sin_addr.s_addr = ntohl(itaddr.s_addr); - EVENTHANDLER_INVOKE(route_event, RTEVENT_ARP_UPDATE, rt, NULL, - (struct sockaddr *)&sin); RT_UNLOCK(rt); if (hold != NULL) (*ifp->if_output)(ifp, hold, rt_key(rt), rt); ==== //depot/projects/toehead/sys/netinet/toedev.h#2 (text+ko) ==== @@ -1,46 +1,46 @@ +/*- + * Copyright (c) 2007, Chelsio Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Neither the name of the Chelsio Corporation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/sys/netinet/toedev.h,v 1.4 2007/12/16 05:30:21 kmacy Exp $ + */ -/************************************************************************** +#ifndef _NETINET_TOEDEV_H_ +#define _NETINET_TOEDEV_H_ -Copyright (c) 2007, Chelsio Inc. -All rights reserved. +#ifndef _KERNEL +#error "no user-serviceable parts inside" +#endif -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Neither the name of the Chelsio Corporation nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -$FreeBSD: src/sys/dev/cxgb/ulp/toecore/toedev.h,v 1.1 2007/05/25 16:17:59 kmacy Exp $ - -***************************************************************************/ - -#ifndef _OFFLOAD_DEV_H_ -#define _OFFLOAD_DEV_H_ - - -/* Parameter values for offload_get_phys_egress() */ +/* Parameter values for offload_get_phys_egress(). */ enum { TOE_OPEN, TOE_FAILOVER, }; -/* Parameter values for toe_failover() */ +/* Parameter values for toe_failover(). */ enum { TOE_ACTIVE_SLAVE, TOE_LINK_DOWN, @@ -49,16 +49,14 @@ TOE_RELEASE_ALL, }; -#define TOENAMSIZ 16 +#define TOENAMSIZ 16 -/* belongs in linux/netdevice.h */ -#define NETIF_F_TCPIP_OFFLOAD (1 << 15) +/* Get the toedev associated with a ifnet. */ +#define TOEDEV(ifp) ((ifp)->if_llsoftc) -/* Get the toedev associated with a ifnet */ -#define TOEDEV(ifp) ((ifp)->if_llsoftc) struct offload_id { - unsigned int id; - unsigned long data; + unsigned int id; + unsigned long data; }; struct ifnet; @@ -70,87 +68,73 @@ struct toedev { TAILQ_ENTRY(toedev) entry; - char name[TOENAMSIZ]; /* TOE device name */ - unsigned int ttid; /* TOE type id */ - unsigned long flags; /* device flags */ - unsigned int mtu; /* max size of TX offloaded data */ - unsigned int nconn; /* max # of offloaded connections */ - struct ifnet *lldev; /* LL device associated with TOE messages */ - const struct tom_info *offload_mod; /* attached TCP offload module */ - struct sysctl_oid *sysctl_root; /* root of proc dir for this TOE */ - int (*open)(struct toedev *dev); - int (*close)(struct toedev *dev); - int (*can_offload)(struct toedev *dev, struct socket *so); - int (*connect)(struct toedev *dev, struct socket *so, - struct ifnet *egress_ifp); - int (*send)(struct toedev *dev, struct mbuf *m); - int (*recv)(struct toedev *dev, struct mbuf **m, int n); - int (*ctl)(struct toedev *dev, unsigned int req, void *data); - void (*arp_update)(struct toedev *dev, struct rtentry *neigh); - void (*failover)(struct toedev *dev, struct ifnet *bond_ifp, + char tod_name[TOENAMSIZ]; /* TOE device name */ + unsigned int tod_ttid; /* TOE type id */ + unsigned long tod_flags; /* device flags */ + unsigned int tod_mtu; /* max TX offloaded data */ + unsigned int tod_nconn; /* max # of offloaded + * connections + */ + struct ifnet *tod_lldev; /* first interface */ + const struct tom_info *tod_offload_mod; /* TCP offload module */ + + int (*tod_open)(struct toedev *dev); + int (*tod_close)(struct toedev *dev); + int (*tod_can_offload)(struct toedev *dev, struct socket *so); + int (*tod_connect)(struct toedev *dev, struct socket *so, + struct rtentry *rt, struct sockaddr *nam); + int (*tod_send)(struct toedev *dev, struct mbuf *m); + int (*tod_recv)(struct toedev *dev, struct mbuf **m, int n); + int (*tod_ctl)(struct toedev *dev, unsigned int req, void *data); + void (*tod_arp_update)(struct toedev *dev, struct rtentry *neigh); + void (*tod_failover)(struct toedev *dev, struct ifnet *bond_ifp, struct ifnet *ndev, int event); - void *priv; /* driver private data */ - void *l2opt; /* optional layer 2 data */ - void *l3opt; /* optional layer 3 data */ - void *l4opt; /* optional layer 4 data */ - void *ulp; /* ulp stuff */ + void *tod_priv; /* driver private data */ + void *tod_l2opt; /* optional layer 2 data */ + void *tod_l3opt; /* optional layer 3 data */ + void *tod_l4opt; /* optional layer 4 data */ + void *tod_ulp; /* upper lever protocol */ }; struct tom_info { - TAILQ_ENTRY(tom_info) entry; - int (*attach)(struct toedev *dev, const struct offload_id *entry); - int (*detach)(struct toedev *dev); - const char *name; - const struct offload_id *id_table; + TAILQ_ENTRY(tom_info) entry; + int (*ti_attach)(struct toedev *dev, + const struct offload_id *entry); + int (*ti_detach)(struct toedev *dev); + const char *ti_name; + const struct offload_id *ti_id_table; }; -static inline void init_offload_dev(struct toedev *dev) +static __inline void +init_offload_dev(struct toedev *dev) { +} + +int register_tom(struct tom_info *t); +int unregister_tom(struct tom_info *t); +int register_toedev(struct toedev *dev, const char *name); +int unregister_toedev(struct toedev *dev); +int activate_offload(struct toedev *dev); +int toe_send(struct toedev *dev, struct mbuf *m); +void toe_arp_update(struct rtentry *rt); +struct ifnet *offload_get_phys_egress(struct ifnet *ifp, + struct socket *so, int context); +int toe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n); +static __inline void +toe_neigh_update(struct ifnet *ifp) +{ } -extern int register_tom(struct tom_info *t); -extern int unregister_tom(struct tom_info *t); -extern int register_toedev(struct toedev *dev, const char *name); -extern int unregister_toedev(struct toedev *dev); -extern int activate_offload(struct toedev *dev); -extern int toe_send(struct toedev *dev, struct mbuf *m); -extern void toe_arp_update(struct rtentry *rt); -extern struct ifnet *offload_get_phys_egress(struct ifnet *dev, - struct socket *so, - int context); -extern int toe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n); - -#if defined(CONFIG_TCP_OFFLOAD_MODULE) -static inline int toe_receive_mbuf(struct toedev *dev, struct mbuf **m, - int n) +static __inline void +toe_failover(struct ifnet *bond_ifp, struct ifnet *fail_ifp, int event) { - return dev->recv(dev, m, n); } -extern int prepare_tcp_for_offload(void); -extern void restore_tcp_to_nonoffload(void); -#elif defined(CONFIG_TCP_OFFLOAD) -extern int toe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n); -#endif - -#if defined(CONFIG_TCP_OFFLOAD) || \ - (defined(CONFIG_TCP_OFFLOAD_MODULE) && defined(MODULE)) -extern void toe_neigh_update(struct rtentry *neigh); -extern void toe_failover(struct ifnet *bond_ifp, - struct ifnet *fail_ifp, int event); -extern int toe_enslave(struct ifnet *bond_ifp, - struct ifnet *slave_ifp); -#else -static inline void toe_neigh_update(struct ifnet *neigh) {} -static inline void toe_failover(struct ifnet *bond_ifp, - struct ifnet *fail_ifp, int event) -{} -static inline int toe_enslave(struct ifnet *bond_ifp, - struct ifnet *slave_ifp) +static __inline int +toe_enslave(struct ifnet *bond_ifp, struct ifnet *slave_ifp) { - return 0; + return (0); } -#endif /* CONFIG_TCP_OFFLOAD */ -#endif /* _OFFLOAD_DEV_H_ */ +#endif /* _NETINET_TOEDEV_H_ */