Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 214745
b: refs/heads/master
c: a0741ca
h: refs/heads/master
i:
  214743: afc69ce
v: v3
  • Loading branch information
David S. Miller committed Sep 22, 2010
1 parent af5adb2 commit 0a16345
Show file tree
Hide file tree
Showing 44 changed files with 1,060 additions and 265 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b618f6f885579a6237e5bf4582fa6167972ddef4
refs/heads/master: a0741ca949692904646c310573754859cba09bf1
6 changes: 2 additions & 4 deletions trunk/drivers/atm/horizon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1645,10 +1645,8 @@ static int hrz_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) {
unsigned short d = 0;
char * s = skb->data;
if (*s++ == 'D') {
for (i = 0; i < 4; ++i) {
d = (d<<4) | ((*s <= '9') ? (*s - '0') : (*s - 'a' + 10));
++s;
}
for (i = 0; i < 4; ++i)
d = (d << 4) | hex_to_bin(*s++);
PRINTK (KERN_INFO, "debug bitmap is now %hx", debug = d);
}
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/pppoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ static const struct proto_ops pppoe_ops = {
.ioctl = pppox_ioctl,
};

static struct pppox_proto pppoe_proto = {
static const struct pppox_proto pppoe_proto = {
.create = pppoe_create,
.ioctl = pppoe_ioctl,
.owner = THIS_MODULE,
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/net/pppox.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

#include <asm/uaccess.h>

static struct pppox_proto *pppox_protos[PX_MAX_PROTO + 1];
static const struct pppox_proto *pppox_protos[PX_MAX_PROTO + 1];

int register_pppox_proto(int proto_num, struct pppox_proto *pp)
int register_pppox_proto(int proto_num, const struct pppox_proto *pp)
{
if (proto_num < 0 || proto_num > PX_MAX_PROTO)
return -EINVAL;
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/net/pptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static struct pppox_sock **callid_sock;
static DEFINE_SPINLOCK(chan_lock);

static struct proto pptp_sk_proto __read_mostly;
static struct ppp_channel_ops pptp_chan_ops;
static const struct ppp_channel_ops pptp_chan_ops;
static const struct proto_ops pptp_ops;

#define PPP_LCP_ECHOREQ 0x09
Expand Down Expand Up @@ -628,7 +628,7 @@ static int pptp_ppp_ioctl(struct ppp_channel *chan, unsigned int cmd,
return err;
}

static struct ppp_channel_ops pptp_chan_ops = {
static const struct ppp_channel_ops pptp_chan_ops = {
.start_xmit = pptp_xmit,
.ioctl = pptp_ppp_ioctl,
};
Expand Down Expand Up @@ -659,12 +659,12 @@ static const struct proto_ops pptp_ops = {
.ioctl = pppox_ioctl,
};

static struct pppox_proto pppox_pptp_proto = {
static const struct pppox_proto pppox_pptp_proto = {
.create = pptp_create,
.owner = THIS_MODULE,
};

static struct gre_protocol gre_pptp_protocol = {
static const struct gre_protocol gre_pptp_protocol = {
.handler = pptp_rcv,
};

Expand Down
6 changes: 0 additions & 6 deletions trunk/drivers/net/qlcnic/qlcnic_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1418,8 +1418,6 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter,
if (pkt_offset)
skb_pull(skb, pkt_offset);

skb->truesize = skb->len + sizeof(struct sk_buff);

if (unlikely(qlcnic_check_rx_tagging(adapter, skb, &vid))) {
adapter->stats.rxdropped++;
dev_kfree_skb(skb);
Expand Down Expand Up @@ -1491,8 +1489,6 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,

skb_put(skb, lro_length + data_offset);

skb->truesize = skb->len + sizeof(struct sk_buff) + skb_headroom(skb);

skb_pull(skb, l2_hdr_offset);

if (unlikely(qlcnic_check_rx_tagging(adapter, skb, &vid))) {
Expand Down Expand Up @@ -1732,8 +1728,6 @@ qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter,
if (pkt_offset)
skb_pull(skb, pkt_offset);

skb->truesize = skb->len + sizeof(struct sk_buff);

if (!qlcnic_check_loopback_buff(skb->data))
adapter->diag_cnt++;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/sfc/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sfc-y += efx.o nic.o falcon.o siena.o tx.o rx.o \
sfc-y += efx.o nic.o falcon.o siena.o tx.o rx.o filter.o \
falcon_gmac.o falcon_xmac.o mcdi_mac.o \
selftest.o ethtool.o qt202x_phy.o mdio_10g.o \
tenxpress.o falcon_boards.o mcdi.o mcdi_phy.o
Expand Down
34 changes: 21 additions & 13 deletions trunk/drivers/net/sfc/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ MODULE_PARM_DESC(separate_tx_channels,
static int napi_weight = 64;

/* This is the time (in jiffies) between invocations of the hardware
* monitor, which checks for known hardware bugs and resets the
* hardware and driver as necessary.
* monitor. On Falcon-based NICs, this will:
* - Check the on-board hardware monitor;
* - Poll the link state and reconfigure the hardware as necessary.
*/
unsigned int efx_monitor_interval = 1 * HZ;

Expand Down Expand Up @@ -1357,8 +1358,17 @@ static int efx_probe_all(struct efx_nic *efx)
if (rc)
goto fail3;

rc = efx_probe_filters(efx);
if (rc) {
netif_err(efx, probe, efx->net_dev,
"failed to create filter tables\n");
goto fail4;
}

return 0;

fail4:
efx_remove_channels(efx);
fail3:
efx_remove_port(efx);
fail2:
Expand Down Expand Up @@ -1489,6 +1499,7 @@ static void efx_stop_all(struct efx_nic *efx)

static void efx_remove_all(struct efx_nic *efx)
{
efx_remove_filters(efx);
efx_remove_channels(efx);
efx_remove_port(efx);
efx_remove_nic(efx);
Expand Down Expand Up @@ -1535,8 +1546,7 @@ void efx_init_irq_moderation(struct efx_nic *efx, int tx_usecs, int rx_usecs,
*
**************************************************************************/

/* Run periodically off the general workqueue. Serialised against
* efx_reconfigure_port via the mac_lock */
/* Run periodically off the general workqueue */
static void efx_monitor(struct work_struct *data)
{
struct efx_nic *efx = container_of(data, struct efx_nic,
Expand All @@ -1549,16 +1559,13 @@ static void efx_monitor(struct work_struct *data)

/* If the mac_lock is already held then it is likely a port
* reconfiguration is already in place, which will likely do
* most of the work of check_hw() anyway. */
if (!mutex_trylock(&efx->mac_lock))
goto out_requeue;
if (!efx->port_enabled)
goto out_unlock;
efx->type->monitor(efx);
* most of the work of monitor() anyway. */
if (mutex_trylock(&efx->mac_lock)) {
if (efx->port_enabled)
efx->type->monitor(efx);
mutex_unlock(&efx->mac_lock);
}

out_unlock:
mutex_unlock(&efx->mac_lock);
out_requeue:
queue_delayed_work(efx->workqueue, &efx->monitor_work,
efx_monitor_interval);
}
Expand Down Expand Up @@ -2002,6 +2009,7 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok)
efx->mac_op->reconfigure(efx);

efx_init_channels(efx);
efx_restore_filters(efx);

mutex_unlock(&efx->spi_lock);
mutex_unlock(&efx->mac_lock);
Expand Down
14 changes: 14 additions & 0 deletions trunk/drivers/net/sfc/efx.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define EFX_EFX_H

#include "net_driver.h"
#include "filter.h"

/* PCI IDs */
#define EFX_VENDID_SFC 0x1924
Expand Down Expand Up @@ -64,6 +65,19 @@ extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue);
* skb. Falcon/A1 may require up to three descriptors per skb_frag. */
#define EFX_MIN_RING_SIZE (roundup_pow_of_two(2 * 3 * MAX_SKB_FRAGS))

/* Filters */
extern int efx_probe_filters(struct efx_nic *efx);
extern void efx_restore_filters(struct efx_nic *efx);
extern void efx_remove_filters(struct efx_nic *efx);
extern int efx_filter_insert_filter(struct efx_nic *efx,
struct efx_filter_spec *spec,
bool replace);
extern int efx_filter_remove_filter(struct efx_nic *efx,
struct efx_filter_spec *spec);
extern void efx_filter_table_clear(struct efx_nic *efx,
enum efx_filter_table_id table_id,
enum efx_filter_priority priority);

/* Channels */
extern void efx_process_channel_now(struct efx_channel *channel);
extern int
Expand Down
118 changes: 116 additions & 2 deletions trunk/drivers/net/sfc/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "workarounds.h"
#include "selftest.h"
#include "efx.h"
#include "filter.h"
#include "nic.h"
#include "spi.h"
#include "mdio_10g.h"
Expand Down Expand Up @@ -551,9 +552,22 @@ static u32 efx_ethtool_get_rx_csum(struct net_device *net_dev)
static int efx_ethtool_set_flags(struct net_device *net_dev, u32 data)
{
struct efx_nic *efx = netdev_priv(net_dev);
u32 supported = efx->type->offload_features & ETH_FLAG_RXHASH;
u32 supported = (efx->type->offload_features &
(ETH_FLAG_RXHASH | ETH_FLAG_NTUPLE));
int rc;

rc = ethtool_op_set_flags(net_dev, data, supported);
if (rc)
return rc;

if (!(data & ETH_FLAG_NTUPLE)) {
efx_filter_table_clear(efx, EFX_FILTER_TABLE_RX_IP,
EFX_FILTER_PRI_MANUAL);
efx_filter_table_clear(efx, EFX_FILTER_TABLE_RX_MAC,
EFX_FILTER_PRI_MANUAL);
}

return ethtool_op_set_flags(net_dev, data, supported);
return 0;
}

static void efx_ethtool_self_test(struct net_device *net_dev,
Expand Down Expand Up @@ -955,6 +969,105 @@ efx_ethtool_get_rxnfc(struct net_device *net_dev,
}
}

static int efx_ethtool_set_rx_ntuple(struct net_device *net_dev,
struct ethtool_rx_ntuple *ntuple)
{
struct efx_nic *efx = netdev_priv(net_dev);
struct ethtool_tcpip4_spec *ip_entry = &ntuple->fs.h_u.tcp_ip4_spec;
struct ethtool_tcpip4_spec *ip_mask = &ntuple->fs.m_u.tcp_ip4_spec;
struct ethhdr *mac_entry = &ntuple->fs.h_u.ether_spec;
struct ethhdr *mac_mask = &ntuple->fs.m_u.ether_spec;
struct efx_filter_spec filter;

/* Range-check action */
if (ntuple->fs.action < ETHTOOL_RXNTUPLE_ACTION_CLEAR ||
ntuple->fs.action >= (s32)efx->n_rx_channels)
return -EINVAL;

if (~ntuple->fs.data_mask)
return -EINVAL;

switch (ntuple->fs.flow_type) {
case TCP_V4_FLOW:
case UDP_V4_FLOW:
/* Must match all of destination, */
if (ip_mask->ip4dst | ip_mask->pdst)
return -EINVAL;
/* all or none of source, */
if ((ip_mask->ip4src | ip_mask->psrc) &&
((__force u32)~ip_mask->ip4src |
(__force u16)~ip_mask->psrc))
return -EINVAL;
/* and nothing else */
if ((u8)~ip_mask->tos | (u16)~ntuple->fs.vlan_tag_mask)
return -EINVAL;
break;
case ETHER_FLOW:
/* Must match all of destination, */
if (!is_zero_ether_addr(mac_mask->h_dest))
return -EINVAL;
/* all or none of VID, */
if (ntuple->fs.vlan_tag_mask != 0xf000 &&
ntuple->fs.vlan_tag_mask != 0xffff)
return -EINVAL;
/* and nothing else */
if (!is_broadcast_ether_addr(mac_mask->h_source) ||
mac_mask->h_proto != htons(0xffff))
return -EINVAL;
break;
default:
return -EINVAL;
}

filter.priority = EFX_FILTER_PRI_MANUAL;
filter.flags = 0;

switch (ntuple->fs.flow_type) {
case TCP_V4_FLOW:
if (!ip_mask->ip4src)
efx_filter_set_rx_tcp_full(&filter,
htonl(ip_entry->ip4src),
htons(ip_entry->psrc),
htonl(ip_entry->ip4dst),
htons(ip_entry->pdst));
else
efx_filter_set_rx_tcp_wild(&filter,
htonl(ip_entry->ip4dst),
htons(ip_entry->pdst));
break;
case UDP_V4_FLOW:
if (!ip_mask->ip4src)
efx_filter_set_rx_udp_full(&filter,
htonl(ip_entry->ip4src),
htons(ip_entry->psrc),
htonl(ip_entry->ip4dst),
htons(ip_entry->pdst));
else
efx_filter_set_rx_udp_wild(&filter,
htonl(ip_entry->ip4dst),
htons(ip_entry->pdst));
break;
case ETHER_FLOW:
if (ntuple->fs.vlan_tag_mask == 0xf000)
efx_filter_set_rx_mac_full(&filter,
ntuple->fs.vlan_tag & 0xfff,
mac_entry->h_dest);
else
efx_filter_set_rx_mac_wild(&filter, mac_entry->h_dest);
break;
}

if (ntuple->fs.action == ETHTOOL_RXNTUPLE_ACTION_CLEAR) {
return efx_filter_remove_filter(efx, &filter);
} else {
if (ntuple->fs.action == ETHTOOL_RXNTUPLE_ACTION_DROP)
filter.dmaq_id = 0xfff;
else
filter.dmaq_id = ntuple->fs.action;
return efx_filter_insert_filter(efx, &filter, true);
}
}

static int efx_ethtool_get_rxfh_indir(struct net_device *net_dev,
struct ethtool_rxfh_indir *indir)
{
Expand Down Expand Up @@ -1033,6 +1146,7 @@ const struct ethtool_ops efx_ethtool_ops = {
.set_wol = efx_ethtool_set_wol,
.reset = efx_ethtool_reset,
.get_rxnfc = efx_ethtool_get_rxnfc,
.set_rx_ntuple = efx_ethtool_set_rx_ntuple,
.get_rxfh_indir = efx_ethtool_get_rxfh_indir,
.set_rxfh_indir = efx_ethtool_set_rxfh_indir,
};
2 changes: 1 addition & 1 deletion trunk/drivers/net/sfc/falcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,7 @@ struct efx_nic_type falcon_b0_nic_type = {
* channels */
.tx_dc_base = 0x130000,
.rx_dc_base = 0x100000,
.offload_features = NETIF_F_IP_CSUM | NETIF_F_RXHASH,
.offload_features = NETIF_F_IP_CSUM | NETIF_F_RXHASH | NETIF_F_NTUPLE,
.reset_world_flags = ETH_RESET_IRQ,
};

Loading

0 comments on commit 0a16345

Please sign in to comment.