b24413180f
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
317 lines
6.9 KiB
C
317 lines
6.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright IBM Corp. 2001, 2007
|
|
* Authors: Fritz Elfert (felfert@millenux.com)
|
|
* Peter Tiedemann (ptiedem@de.ibm.com)
|
|
*/
|
|
|
|
#ifndef _CTCM_MAIN_H_
|
|
#define _CTCM_MAIN_H_
|
|
|
|
#include <asm/ccwdev.h>
|
|
#include <asm/ccwgroup.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
#include <linux/netdevice.h>
|
|
|
|
#include "fsm.h"
|
|
#include "ctcm_dbug.h"
|
|
#include "ctcm_mpc.h"
|
|
|
|
#define CTC_DRIVER_NAME "ctcm"
|
|
#define CTC_DEVICE_NAME "ctc"
|
|
#define MPC_DEVICE_NAME "mpc"
|
|
#define CTC_DEVICE_GENE CTC_DEVICE_NAME "%d"
|
|
#define MPC_DEVICE_GENE MPC_DEVICE_NAME "%d"
|
|
|
|
#define CHANNEL_FLAGS_READ 0
|
|
#define CHANNEL_FLAGS_WRITE 1
|
|
#define CHANNEL_FLAGS_INUSE 2
|
|
#define CHANNEL_FLAGS_BUFSIZE_CHANGED 4
|
|
#define CHANNEL_FLAGS_FAILED 8
|
|
#define CHANNEL_FLAGS_WAITIRQ 16
|
|
#define CHANNEL_FLAGS_RWMASK 1
|
|
#define CHANNEL_DIRECTION(f) (f & CHANNEL_FLAGS_RWMASK)
|
|
|
|
#define LOG_FLAG_ILLEGALPKT 1
|
|
#define LOG_FLAG_ILLEGALSIZE 2
|
|
#define LOG_FLAG_OVERRUN 4
|
|
#define LOG_FLAG_NOMEM 8
|
|
|
|
#define ctcm_pr_debug(fmt, arg...) printk(KERN_DEBUG fmt, ##arg)
|
|
|
|
#define CTCM_PR_DEBUG(fmt, arg...) \
|
|
do { \
|
|
if (do_debug) \
|
|
printk(KERN_DEBUG fmt, ##arg); \
|
|
} while (0)
|
|
|
|
#define CTCM_PR_DBGDATA(fmt, arg...) \
|
|
do { \
|
|
if (do_debug_data) \
|
|
printk(KERN_DEBUG fmt, ##arg); \
|
|
} while (0)
|
|
|
|
#define CTCM_D3_DUMP(buf, len) \
|
|
do { \
|
|
if (do_debug_data) \
|
|
ctcmpc_dumpit(buf, len); \
|
|
} while (0)
|
|
|
|
#define CTCM_CCW_DUMP(buf, len) \
|
|
do { \
|
|
if (do_debug_ccw) \
|
|
ctcmpc_dumpit(buf, len); \
|
|
} while (0)
|
|
|
|
/**
|
|
* Enum for classifying detected devices
|
|
*/
|
|
enum ctcm_channel_types {
|
|
/* Device is not a channel */
|
|
ctcm_channel_type_none,
|
|
|
|
/* Device is a CTC/A */
|
|
ctcm_channel_type_parallel,
|
|
|
|
/* Device is a FICON channel */
|
|
ctcm_channel_type_ficon,
|
|
|
|
/* Device is a ESCON channel */
|
|
ctcm_channel_type_escon
|
|
};
|
|
|
|
/*
|
|
* CCW commands, used in this driver.
|
|
*/
|
|
#define CCW_CMD_WRITE 0x01
|
|
#define CCW_CMD_READ 0x02
|
|
#define CCW_CMD_NOOP 0x03
|
|
#define CCW_CMD_TIC 0x08
|
|
#define CCW_CMD_SENSE_CMD 0x14
|
|
#define CCW_CMD_WRITE_CTL 0x17
|
|
#define CCW_CMD_SET_EXTENDED 0xc3
|
|
#define CCW_CMD_PREPARE 0xe3
|
|
|
|
#define CTCM_PROTO_S390 0
|
|
#define CTCM_PROTO_LINUX 1
|
|
#define CTCM_PROTO_LINUX_TTY 2
|
|
#define CTCM_PROTO_OS390 3
|
|
#define CTCM_PROTO_MPC 4
|
|
#define CTCM_PROTO_MAX 4
|
|
|
|
#define CTCM_BUFSIZE_LIMIT 65535
|
|
#define CTCM_BUFSIZE_DEFAULT 32768
|
|
#define MPC_BUFSIZE_DEFAULT CTCM_BUFSIZE_LIMIT
|
|
|
|
#define CTCM_TIME_1_SEC 1000
|
|
#define CTCM_TIME_5_SEC 5000
|
|
#define CTCM_TIME_10_SEC 10000
|
|
|
|
#define CTCM_INITIAL_BLOCKLEN 2
|
|
|
|
#define CTCM_READ 0
|
|
#define CTCM_WRITE 1
|
|
|
|
#define CTCM_ID_SIZE 20+3
|
|
|
|
struct ctcm_profile {
|
|
unsigned long maxmulti;
|
|
unsigned long maxcqueue;
|
|
unsigned long doios_single;
|
|
unsigned long doios_multi;
|
|
unsigned long txlen;
|
|
unsigned long tx_time;
|
|
unsigned long send_stamp;
|
|
};
|
|
|
|
/*
|
|
* Definition of one channel
|
|
*/
|
|
struct channel {
|
|
struct channel *next;
|
|
char id[CTCM_ID_SIZE];
|
|
struct ccw_device *cdev;
|
|
/*
|
|
* Type of this channel.
|
|
* CTC/A or Escon for valid channels.
|
|
*/
|
|
enum ctcm_channel_types type;
|
|
/*
|
|
* Misc. flags. See CHANNEL_FLAGS_... below
|
|
*/
|
|
__u32 flags;
|
|
__u16 protocol; /* protocol of this channel (4 = MPC) */
|
|
/*
|
|
* I/O and irq related stuff
|
|
*/
|
|
struct ccw1 *ccw;
|
|
struct irb *irb;
|
|
/*
|
|
* RX/TX buffer size
|
|
*/
|
|
int max_bufsize;
|
|
struct sk_buff *trans_skb; /* transmit/receive buffer */
|
|
struct sk_buff_head io_queue; /* universal I/O queue */
|
|
struct tasklet_struct ch_tasklet; /* MPC ONLY */
|
|
/*
|
|
* TX queue for collecting skb's during busy.
|
|
*/
|
|
struct sk_buff_head collect_queue;
|
|
/*
|
|
* Amount of data in collect_queue.
|
|
*/
|
|
int collect_len;
|
|
/*
|
|
* spinlock for collect_queue and collect_len
|
|
*/
|
|
spinlock_t collect_lock;
|
|
/*
|
|
* Timer for detecting unresposive
|
|
* I/O operations.
|
|
*/
|
|
fsm_timer timer;
|
|
/* MPC ONLY section begin */
|
|
__u32 th_seq_num; /* SNA TH seq number */
|
|
__u8 th_seg;
|
|
__u32 pdu_seq;
|
|
struct sk_buff *xid_skb;
|
|
char *xid_skb_data;
|
|
struct th_header *xid_th;
|
|
struct xid2 *xid;
|
|
char *xid_id;
|
|
struct th_header *rcvd_xid_th;
|
|
struct xid2 *rcvd_xid;
|
|
char *rcvd_xid_id;
|
|
__u8 in_mpcgroup;
|
|
fsm_timer sweep_timer;
|
|
struct sk_buff_head sweep_queue;
|
|
struct th_header *discontact_th;
|
|
struct tasklet_struct ch_disc_tasklet;
|
|
/* MPC ONLY section end */
|
|
|
|
int retry; /* retry counter for misc. operations */
|
|
fsm_instance *fsm; /* finite state machine of this channel */
|
|
struct net_device *netdev; /* corresponding net_device */
|
|
struct ctcm_profile prof;
|
|
__u8 *trans_skb_data;
|
|
__u16 logflags;
|
|
__u8 sense_rc; /* last unit check sense code report control */
|
|
};
|
|
|
|
struct ctcm_priv {
|
|
struct net_device_stats stats;
|
|
unsigned long tbusy;
|
|
|
|
/* The MPC group struct of this interface */
|
|
struct mpc_group *mpcg; /* MPC only */
|
|
struct xid2 *xid; /* MPC only */
|
|
|
|
/* The finite state machine of this interface */
|
|
fsm_instance *fsm;
|
|
|
|
/* The protocol of this device */
|
|
__u16 protocol;
|
|
|
|
/* Timer for restarting after I/O Errors */
|
|
fsm_timer restart_timer;
|
|
|
|
int buffer_size; /* ctc only */
|
|
|
|
struct channel *channel[2];
|
|
};
|
|
|
|
int ctcm_open(struct net_device *dev);
|
|
int ctcm_close(struct net_device *dev);
|
|
|
|
extern const struct attribute_group *ctcm_attr_groups[];
|
|
|
|
/*
|
|
* Compatibility macros for busy handling
|
|
* of network devices.
|
|
*/
|
|
static inline void ctcm_clear_busy_do(struct net_device *dev)
|
|
{
|
|
clear_bit(0, &(((struct ctcm_priv *)dev->ml_priv)->tbusy));
|
|
netif_wake_queue(dev);
|
|
}
|
|
|
|
static inline void ctcm_clear_busy(struct net_device *dev)
|
|
{
|
|
struct mpc_group *grp;
|
|
grp = ((struct ctcm_priv *)dev->ml_priv)->mpcg;
|
|
|
|
if (!(grp && grp->in_sweep))
|
|
ctcm_clear_busy_do(dev);
|
|
}
|
|
|
|
|
|
static inline int ctcm_test_and_set_busy(struct net_device *dev)
|
|
{
|
|
netif_stop_queue(dev);
|
|
return test_and_set_bit(0,
|
|
&(((struct ctcm_priv *)dev->ml_priv)->tbusy));
|
|
}
|
|
|
|
extern int loglevel;
|
|
extern struct channel *channels;
|
|
|
|
void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb);
|
|
|
|
/*
|
|
* Functions related to setup and device detection.
|
|
*/
|
|
|
|
static inline int ctcm_less_than(char *id1, char *id2)
|
|
{
|
|
unsigned long dev1, dev2;
|
|
|
|
id1 = id1 + 5;
|
|
id2 = id2 + 5;
|
|
|
|
dev1 = simple_strtoul(id1, &id1, 16);
|
|
dev2 = simple_strtoul(id2, &id2, 16);
|
|
|
|
return (dev1 < dev2);
|
|
}
|
|
|
|
int ctcm_ch_alloc_buffer(struct channel *ch);
|
|
|
|
static inline int ctcm_checkalloc_buffer(struct channel *ch)
|
|
{
|
|
if (ch->trans_skb == NULL)
|
|
return ctcm_ch_alloc_buffer(ch);
|
|
if (ch->flags & CHANNEL_FLAGS_BUFSIZE_CHANGED) {
|
|
dev_kfree_skb(ch->trans_skb);
|
|
return ctcm_ch_alloc_buffer(ch);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv);
|
|
|
|
/* test if protocol attribute (of struct ctcm_priv or struct channel)
|
|
* has MPC protocol setting. Type is not checked
|
|
*/
|
|
#define IS_MPC(p) ((p)->protocol == CTCM_PROTO_MPC)
|
|
|
|
/* test if struct ctcm_priv of struct net_device has MPC protocol setting */
|
|
#define IS_MPCDEV(dev) IS_MPC((struct ctcm_priv *)dev->ml_priv)
|
|
|
|
static inline gfp_t gfp_type(void)
|
|
{
|
|
return in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
|
|
}
|
|
|
|
/*
|
|
* Definition of our link level header.
|
|
*/
|
|
struct ll_header {
|
|
__u16 length;
|
|
__u16 type;
|
|
__u16 unused;
|
|
};
|
|
#define LL_HEADER_LENGTH (sizeof(struct ll_header))
|
|
|
|
#endif
|