"Fossies" - the Fresh Open Source Software archive

Member "open-fcoe/kernel/fcoe/fcoe_def.h" of archive open-fcoe.tar.gz:


/*
 * Copyright(c) 2007 Intel Corporation. All rights reserved.
 * 
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 * 
 * This program is distributed in the hope 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.,
 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 * 
 * Maintained at www.Open-FCoE.org
 */

#ifndef _FCOE_DEF_H_
#define _FCOE_DEF_H_

#include <linux/etherdevice.h>
#include <linux/if_ether.h>

#include "fc_fcoe.h"
#include "fc_exch.h"

#define FCOE_CLASS_NAME	    "fcoe"	/* class name for udev */
#define FCOE_CTL_DEV_NAME   "fcoe"	/* control device name for udev */
#define	FCOE_DRIVER_NAME    "fcoe"	/* driver name for ioctls */
#define	FCOE_DRIVER_VENDOR  "Open-FC.org" /* vendor name for ioctls */

#define FCOE_MIN_FRAME	36
#define FCOE_WORD_TO_BYTE  4

/*
 * this is the main  common structure across all instance of fcoe driver.
 * There is one to one mapping between hba struct and ethernet nic.
 * list of hbas contains pointer to the hba struct, these structures are
 * stored in this array using there corresponding if_index.
 */

struct fcoe_percpu_s {
	int		cpu;
	struct task_struct *thread;
	struct sk_buff_head fcoe_rx_list;
	struct fc_frame	frame;
};

struct fcoe_info {
	int		fcoe_major;
	struct class   *fcoe_class;

	struct timer_list timer;
	atomic_t	cleanup_needed;
	/*
	 * fcoe host list is protected by the following read/write lock
	 */
	rwlock_t fcoe_hostlist_lock;
	struct list_head fcoe_hostlist;

	struct fcoe_percpu_s *fcoe_percpu[NR_CPUS];
};

struct fcoe_softc {
	struct list_head list;
	struct fcdev *fd;
	struct net_device *real_dev;
	struct packet_type  fcoe_packet_type;
	struct sk_buff_head fcoe_pending_queue;

        uint8_t    dest_addr[ETH_ALEN];
        uint8_t    ctl_src_addr[ETH_ALEN];
        uint8_t    data_src_addr[ETH_ALEN];
        /*
         * fcoe protocol address learning related stuff
         */
        uint16_t  flogi_oxid;
        uint8_t   flogi_progress;
        uint8_t   address_mode;
	uint8_t	  fcoe_hlen;		/* FCoE header length (implies ver) */
};

struct fcoe_rcv_info {
	struct fcdev 	*fd;
	struct packet_type  *ptype;
};

/*
 * Get fc_frame pointer for an skb that's already been imported.
 */
static inline struct fcoe_rcv_info *fcoe_dev_from_skb(struct sk_buff *skb)
{
        ASSERT(sizeof(struct fcoe_rcv_info) <= sizeof(skb->cb));
        return ((struct fcoe_rcv_info *) skb->cb);
}


/*
 * HBA transport ops prototypes
 */
extern struct fcoe_info fcoei;

void		fcoe_clean_pending_queue(struct fcdev *fd);
void		fcoe_watchdog(ulong vp);
int		fcoe_destroy_interface(struct fcdev *);
int		fcoe_create_interface(struct fcoe_info *, void *);
int		fcoe_xmit(struct fcdev *, struct fc_frame *);
int		fcoe_rcv(struct sk_buff *, struct net_device *,
			 struct packet_type *, struct net_device *);
struct fc_frame *fcoe_frame_alloc(size_t);
void fcoe_put_dev(struct fcdev *dev);
struct fcoe_softc *fcoe_find_fcdev(char *);
#endif /* _FCOE_DEF_H_ */