Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [TG3]: Bump driver version and reldate.
  [TG3]: Skip phy power down on some devices
  [TG3]: Fix SRAM access during tg3_init_one()
  [X25]: dte facilities 32 64 ioctl conversion
  [X25]: allow ITU-T DTE facilities for x25
  [X25]: fix kernel error message 64 bit kernel
  [X25]: ioctl conversion 32 bit user to 64 bit kernel
  [NET]: socket timestamp 32 bit handler for 64 bit kernel
  [NET]: allow 32 bit socket ioctl in 64 bit kernel
  [BLUETOOTH]: Return negative error constant
  • Loading branch information
Linus Torvalds committed Mar 22, 2006
2 parents 2152f85 + 056755f commit 36177ba
Show file tree
Hide file tree
Showing 12 changed files with 366 additions and 31 deletions.
32 changes: 25 additions & 7 deletions drivers/net/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@

#define DRV_MODULE_NAME "tg3"
#define PFX DRV_MODULE_NAME ": "
#define DRV_MODULE_VERSION "3.52"
#define DRV_MODULE_RELDATE "Mar 06, 2006"
#define DRV_MODULE_VERSION "3.53"
#define DRV_MODULE_RELDATE "Mar 22, 2006"

#define TG3_DEF_MAC_MODE 0
#define TG3_DEF_RX_MODE 0
Expand Down Expand Up @@ -1148,6 +1148,19 @@ static int tg3_halt_cpu(struct tg3 *, u32);
static int tg3_nvram_lock(struct tg3 *);
static void tg3_nvram_unlock(struct tg3 *);

static void tg3_power_down_phy(struct tg3 *tp)
{
/* The PHY should not be powered down on some chips because
* of bugs.
*/
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
(GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 &&
(tp->tg3_flags2 & TG3_FLG2_MII_SERDES)))
return;
tg3_writephy(tp, MII_BMCR, BMCR_PDOWN);
}

static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
{
u32 misc_host_ctrl;
Expand Down Expand Up @@ -1327,8 +1340,7 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
tg3_writephy(tp, MII_TG3_EXT_CTRL,
MII_TG3_EXT_CTRL_FORCE_LED_OFF);
tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2);
if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700)
tg3_writephy(tp, MII_BMCR, BMCR_PDOWN);
tg3_power_down_phy(tp);
}
}

Expand Down Expand Up @@ -9436,12 +9448,18 @@ static inline struct subsys_tbl_ent *lookup_by_subsys(struct tg3 *tp)
return NULL;
}

/* Since this function may be called in D3-hot power state during
* tg3_init_one(), only config cycles are allowed.
*/
static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
{
u32 val;
u16 pmcsr;

/* On some early chips the SRAM cannot be accessed in D3hot state,
* so need make sure we're in D0.
*/
pci_read_config_word(tp->pdev, tp->pm_cap + PCI_PM_CTRL, &pmcsr);
pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
pci_write_config_word(tp->pdev, tp->pm_cap + PCI_PM_CTRL, pmcsr);
msleep(1);

/* Make sure register accesses (indirect or otherwise)
* will function correctly.
Expand Down
6 changes: 6 additions & 0 deletions include/linux/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ struct proto_ops {
struct poll_table_struct *wait);
int (*ioctl) (struct socket *sock, unsigned int cmd,
unsigned long arg);
int (*compat_ioctl) (struct socket *sock, unsigned int cmd,
unsigned long arg);
int (*listen) (struct socket *sock, int len);
int (*shutdown) (struct socket *sock, int flags);
int (*setsockopt)(struct socket *sock, int level,
Expand Down Expand Up @@ -251,6 +253,8 @@ SOCKCALL_UWRAP(name, poll, (struct file *file, struct socket *sock, struct poll_
(file, sock, wait)) \
SOCKCALL_WRAP(name, ioctl, (struct socket *sock, unsigned int cmd, \
unsigned long arg), (sock, cmd, arg)) \
SOCKCALL_WRAP(name, compat_ioctl, (struct socket *sock, unsigned int cmd, \
unsigned long arg), (sock, cmd, arg)) \
SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \
SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \
SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \
Expand All @@ -275,6 +279,7 @@ static const struct proto_ops name##_ops = { \
.getname = __lock_##name##_getname, \
.poll = __lock_##name##_poll, \
.ioctl = __lock_##name##_ioctl, \
.compat_ioctl = __lock_##name##_compat_ioctl, \
.listen = __lock_##name##_listen, \
.shutdown = __lock_##name##_shutdown, \
.setsockopt = __lock_##name##_setsockopt, \
Expand All @@ -283,6 +288,7 @@ static const struct proto_ops name##_ops = { \
.recvmsg = __lock_##name##_recvmsg, \
.mmap = __lock_##name##_mmap, \
};

#endif

#define MODULE_ALIAS_NETPROTO(proto) \
Expand Down
26 changes: 26 additions & 0 deletions include/linux/x25.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#ifndef X25_KERNEL_H
#define X25_KERNEL_H

#include <linux/types.h>

#define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0)
#define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1)
#define SIOCX25GFACILITIES (SIOCPROTOPRIVATE + 2)
Expand All @@ -21,6 +23,8 @@
#define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7)
#define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8)
#define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9)
#define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10)
#define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11)

/*
* Values for {get,set}sockopt.
Expand Down Expand Up @@ -77,6 +81,8 @@ struct x25_subscrip_struct {
#define X25_MASK_PACKET_SIZE 0x04
#define X25_MASK_WINDOW_SIZE 0x08

#define X25_MASK_CALLING_AE 0x10
#define X25_MASK_CALLED_AE 0x20


/*
Expand All @@ -98,6 +104,26 @@ struct x25_facilities {
unsigned int reverse;
};

/*
* ITU DTE facilities
* Only the called and calling address
* extension are currently implemented.
* The rest are in place to avoid the struct
* changing size if someone needs them later
*/

struct x25_dte_facilities {
__u16 delay_cumul;
__u16 delay_target;
__u16 delay_max;
__u8 min_throughput;
__u8 expedited;
__u8 calling_len;
__u8 called_len;
__u8 calling_ae[20];
__u8 called_ae[20];
};

/*
* Call User Data structure.
*/
Expand Down
4 changes: 3 additions & 1 deletion include/net/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ struct compat_cmsghdr {
compat_int_t cmsg_type;
};

struct sock;
extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *);

#else /* defined(CONFIG_COMPAT) */
#define compat_msghdr msghdr /* to avoid compiler warnings */
#endif /* defined(CONFIG_COMPAT) */
Expand All @@ -34,7 +37,6 @@ extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsi
extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);

struct sock;
extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);

#endif /* NET_COMPAT_H */
21 changes: 17 additions & 4 deletions include/net/x25.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,17 @@ enum {
#define X25_FAC_PACKET_SIZE 0x42
#define X25_FAC_WINDOW_SIZE 0x43

#define X25_MAX_FAC_LEN 20 /* Plenty to spare */
#define X25_MAX_FAC_LEN 60
#define X25_MAX_CUD_LEN 128

#define X25_FAC_CALLING_AE 0xCB
#define X25_FAC_CALLED_AE 0xC9

#define X25_MARKER 0x00
#define X25_DTE_SERVICES 0x0F
#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */
#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */

/**
* struct x25_route - x25 routing entry
* @node - entry in x25_list_lock
Expand Down Expand Up @@ -148,6 +156,7 @@ struct x25_sock {
struct timer_list timer;
struct x25_causediag causediag;
struct x25_facilities facilities;
struct x25_dte_facilities dte_facilities;
struct x25_calluserdata calluserdata;
unsigned long vc_facil_mask; /* inc_call facilities mask */
};
Expand Down Expand Up @@ -180,9 +189,13 @@ extern void x25_establish_link(struct x25_neigh *);
extern void x25_terminate_link(struct x25_neigh *);

/* x25_facilities.c */
extern int x25_parse_facilities(struct sk_buff *, struct x25_facilities *, unsigned long *);
extern int x25_create_facilities(unsigned char *, struct x25_facilities *, unsigned long);
extern int x25_negotiate_facilities(struct sk_buff *, struct sock *, struct x25_facilities *);
extern int x25_parse_facilities(struct sk_buff *, struct x25_facilities *,
struct x25_dte_facilities *, unsigned long *);
extern int x25_create_facilities(unsigned char *, struct x25_facilities *,
struct x25_dte_facilities *, unsigned long);
extern int x25_negotiate_facilities(struct sk_buff *, struct sock *,
struct x25_facilities *,
struct x25_dte_facilities *);
extern void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *);

/* x25_in.c */
Expand Down
4 changes: 2 additions & 2 deletions net/bluetooth/bnep/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
dev = alloc_netdev(sizeof(struct bnep_session),
(*req->device) ? req->device : "bnep%d",
bnep_net_setup);
if (!dev)
return ENOMEM;
if (!dev)
return -ENOMEM;


down_write(&bnep_session_sem);
Expand Down
19 changes: 19 additions & 0 deletions net/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,25 @@ static int compat_sock_getsockopt(struct socket *sock, int level, int optname,
return sock_getsockopt(sock, level, optname, optval, optlen);
}

int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
{
struct compat_timeval __user *ctv =
(struct compat_timeval __user*) userstamp;
int err = -ENOENT;

if (!sock_flag(sk, SOCK_TIMESTAMP))
sock_enable_timestamp(sk);
if (sk->sk_stamp.tv_sec == -1)
return err;
if (sk->sk_stamp.tv_sec == 0)
do_gettimeofday(&sk->sk_stamp);
if (put_user(sk->sk_stamp.tv_sec, &ctv->tv_sec) ||
put_user(sk->sk_stamp.tv_usec, &ctv->tv_usec))
err = -EFAULT;
return err;
}
EXPORT_SYMBOL(compat_sock_get_timestamp);

asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
char __user *optval, int __user *optlen)
{
Expand Down
21 changes: 21 additions & 0 deletions net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ static unsigned int sock_poll(struct file *file,
struct poll_table_struct *wait);
static long sock_ioctl(struct file *file,
unsigned int cmd, unsigned long arg);
#ifdef CONFIG_COMPAT
static long compat_sock_ioctl(struct file *file,
unsigned int cmd, unsigned long arg);
#endif
static int sock_fasync(int fd, struct file *filp, int on);
static ssize_t sock_readv(struct file *file, const struct iovec *vector,
unsigned long count, loff_t *ppos);
Expand All @@ -128,6 +132,9 @@ static struct file_operations socket_file_ops = {
.aio_write = sock_aio_write,
.poll = sock_poll,
.unlocked_ioctl = sock_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = compat_sock_ioctl,
#endif
.mmap = sock_mmap,
.open = sock_no_open, /* special open code to disallow open via /proc */
.release = sock_close,
Expand Down Expand Up @@ -2136,6 +2143,20 @@ void socket_seq_show(struct seq_file *seq)
}
#endif /* CONFIG_PROC_FS */

#ifdef CONFIG_COMPAT
static long compat_sock_ioctl(struct file *file, unsigned cmd,
unsigned long arg)
{
struct socket *sock = file->private_data;
int ret = -ENOIOCTLCMD;

if (sock->ops->compat_ioctl)
ret = sock->ops->compat_ioctl(sock, cmd, arg);

return ret;
}
#endif

/* ABI emulation layers need these two */
EXPORT_SYMBOL(move_addr_to_kernel);
EXPORT_SYMBOL(move_addr_to_user);
Expand Down
Loading

0 comments on commit 36177ba

Please sign in to comment.