From owner-p4-projects@FreeBSD.ORG Fri Apr 27 06:44:21 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C17C316A406; Fri, 27 Apr 2007 06:44:20 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 61D2B16A409 for ; Fri, 27 Apr 2007 06:44:20 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 46E6513C4C9 for ; Fri, 27 Apr 2007 06:44:20 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l3R6iKiA077944 for ; Fri, 27 Apr 2007 06:44:20 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l3R6iJ6c077941 for perforce@freebsd.org; Fri, 27 Apr 2007 06:44:19 GMT (envelope-from kmacy@freebsd.org) Date: Fri, 27 Apr 2007 06:44:19 GMT Message-Id: <200704270644.l3R6iJ6c077941@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 118860 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: Fri, 27 Apr 2007 06:44:21 -0000 http://perforce.freebsd.org/chv.cgi?CH=118860 Change 118860 by kmacy@kmacy_vt-x:opentoe_init on 2007/04/27 06:43:52 switch to todev definition in toecore Affected files ... .. //depot/projects/opentoe/sys/dev/cxgb/cxgb_adapter.h#14 edit .. //depot/projects/opentoe/sys/dev/cxgb/cxgb_l2t.h#5 edit .. //depot/projects/opentoe/sys/dev/cxgb/cxgb_main.c#8 edit .. //depot/projects/opentoe/sys/dev/cxgb/cxgb_offload.h#8 edit .. //depot/projects/opentoe/sys/dev/cxgb/cxgb_toedev.h#7 delete .. //depot/projects/opentoe/sys/dev/cxgb/ulp/toecore/toedev.h#2 edit Differences ... ==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_adapter.h#14 (text+ko) ==== @@ -59,7 +59,7 @@ #include #include -#include +#include struct adapter; struct sge_qset; extern int cxgb_debug; ==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_l2t.h#5 (text+ko) ==== @@ -1,7 +1,7 @@ #ifndef _CHELSIO_L2T_H #define _CHELSIO_L2T_H -#include +#include #include enum { ==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_main.c#8 (text+ko) ==== @@ -188,10 +188,6 @@ SYSCTL_NODE(_hw, OID_AUTO, cxgb, CTLFLAG_RD, 0, "CXGB driver parameters"); SYSCTL_UINT(_hw_cxgb, OID_AUTO, msi_allowed, CTLFLAG_RDTUN, &msi_allowed, 0, "MSI-X, MSI, INTx selector"); -/* - * Multiple queues need further tuning - */ -static int singleq = 1; /* * The driver enables offload as a default. @@ -206,7 +202,7 @@ * The driver uses an auto-queue algorithm by default. * To disable it and force a single queue-set per port, use singleq = 1. */ -static int singleq = 0; +static int singleq = 1; TUNABLE_INT("hw.cxgb.singleq", &singleq); SYSCTL_UINT(_hw_cxgb, OID_AUTO, singleq, CTLFLAG_RDTUN, &singleq, 0, "use a single queue-set per port"); ==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_offload.h#8 (text+ko) ==== @@ -41,7 +41,7 @@ #include #include -#include +#include #include struct adapter; ==== //depot/projects/opentoe/sys/dev/cxgb/ulp/toecore/toedev.h#2 (text+ko) ==== @@ -1,29 +1,41 @@ -/* - * Network offload device definitions. - * - * Copyright (C) 2003-2006 Chelsio Communications. All rights reserved. - * - * Written by Dimitris Michailidis (dm@chelsio.com) - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + +/************************************************************************** + +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. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. 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$ +***************************************************************************/ #ifndef _OFFLOAD_DEV_H_ #define _OFFLOAD_DEV_H_ -struct neighbour; /* Parameter values for offload_get_phys_egress() */ enum { @@ -40,16 +52,14 @@ TOE_RELEASE_ALL, }; -#if defined(CONFIG_TCP_OFFLOAD) || defined(CONFIG_TCP_OFFLOAD_MODULE) -#include #define TOENAMSIZ 16 /* belongs in linux/netdevice.h */ #define NETIF_F_TCPIP_OFFLOAD (1 << 15) -/* Get the toedev associated with a net_device */ -#define TOEDEV(netdev) (*(struct toedev **)&(netdev)->ec_ptr) +/* Get the toedev associated with a ifnet */ +#define TOEDEV(netdev) (*(struct toedev **)&(netdev)->if_softc) /* offload type ids */ enum { @@ -65,33 +75,41 @@ unsigned long data; }; -struct net_device; +struct ifnet; +struct rt_entry; struct tom_info; -struct proc_dir_entry; -struct sock; -struct sk_buff; +struct sysctl_oid; +struct socket; +struct mbuf; + +enum toetype { + T3A = 0, + T3B +}; struct toedev { char name[TOENAMSIZ]; /* TOE device name */ - struct list_head toe_list; /* for list linking */ + enum toetype type; + struct adapter *adapter; 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 net_device *lldev; /* LL device associated with TOE messages */ + struct ifnet *lldev; /* LL device associated with TOE messages */ const struct tom_info *offload_mod; /* attached TCP offload module */ - struct proc_dir_entry *proc_dir; /* root of proc dir for this TOE */ + struct sysctl_oid *sysctl_root; /* root of proc dir for this TOE */ + TAILQ_ENTRY(toedev) ofld_entry; /* for list linking */ int (*open)(struct toedev *dev); int (*close)(struct toedev *dev); - int (*can_offload)(struct toedev *dev, struct sock *sk); - int (*connect)(struct toedev *dev, struct sock *sk, - struct net_device *egress_dev); - int (*send)(struct toedev *dev, struct sk_buff *skb); - int (*recv)(struct toedev *dev, struct sk_buff **skb, int n); + int (*can_offload)(struct toedev *dev, struct socket *so); + int (*connect)(struct toedev *dev, struct socket *so, + struct ifnet *egress_dev); + int (*send)(struct toedev *dev, struct mbuf *skb); + int (*recv)(struct toedev *dev, struct mbuf **skb, int n); int (*ctl)(struct toedev *dev, unsigned int req, void *data); - void (*neigh_update)(struct toedev *dev, struct neighbour *neigh); - void (*failover)(struct toedev *dev, struct net_device *bond_dev, - struct net_device *ndev, int event); + void (*neigh_update)(struct toedev *dev, struct rtentry *neigh); + void (*failover)(struct toedev *dev, struct ifnet *bond_dev, + struct ifnet *ndev, int event); void *priv; /* driver private data */ void *l2opt; /* optional layer 2 data */ void *l3opt; /* optional layer 3 data */ @@ -104,12 +122,12 @@ int (*detach)(struct toedev *dev); const char *name; const struct offload_id *id_table; - struct list_head list_node; + TAILQ_ENTRY(tom_info) entry; }; static inline void init_offload_dev(struct toedev *dev) { - INIT_LIST_HEAD(&dev->toe_list); + } extern int register_tom(struct tom_info *t); @@ -117,14 +135,13 @@ 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 sk_buff *skb); -extern struct net_device *offload_get_phys_egress(struct net_device *dev, - struct sock *sk, +extern int toe_send(struct toedev *dev, struct mbuf *skb); +extern struct ifnet *offload_get_phys_egress(struct ifnet *dev, + struct socket *so, int context); -#endif #if defined(CONFIG_TCP_OFFLOAD_MODULE) -static inline int toe_receive_skb(struct toedev *dev, struct sk_buff **skb, +static inline int toe_receive_skb(struct toedev *dev, struct mbuf **skb, int n) { return dev->recv(dev, skb, n); @@ -133,23 +150,23 @@ extern int prepare_tcp_for_offload(void); extern void restore_tcp_to_nonoffload(void); #elif defined(CONFIG_TCP_OFFLOAD) -extern int toe_receive_skb(struct toedev *dev, struct sk_buff **skb, int n); +extern int toe_receive_skb(struct toedev *dev, struct mbuf **skb, int n); #endif #if defined(CONFIG_TCP_OFFLOAD) || \ (defined(CONFIG_TCP_OFFLOAD_MODULE) && defined(MODULE)) -extern void toe_neigh_update(struct neighbour *neigh); -extern void toe_failover(struct net_device *bond_dev, - struct net_device *fail_dev, int event); -extern int toe_enslave(struct net_device *bond_dev, - struct net_device *slave_dev); +extern void toe_neigh_update(struct rtentry *neigh); +extern void toe_failover(struct ifnet *bond_dev, + struct ifnet *fail_dev, int event); +extern int toe_enslave(struct ifnet *bond_dev, + struct ifnet *slave_dev); #else -static inline void toe_neigh_update(struct neighbour *neigh) {} -static inline void toe_failover(struct net_device *bond_dev, - struct net_device *fail_dev, int event) +static inline void toe_neigh_update(struct ifnet *neigh) {} +static inline void toe_failover(struct ifnet *bond_dev, + struct ifnet *fail_dev, int event) {} -static inline int toe_enslave(struct net_device *bond_dev, - struct net_device *slave_dev) +static inline int toe_enslave(struct ifnet *bond_dev, + struct ifnet *slave_dev) { return 0; }