Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 376669
b: refs/heads/master
c: fb68e2f
h: refs/heads/master
i:
  376667: 2705337
v: v3
  • Loading branch information
David S. Miller committed May 31, 2013
1 parent f8fb332 commit 82e2c02
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 48 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: 50cc1cab4cfc8ab32dc6ae470c271cdf65e82de3
refs/heads/master: fb68e2f43887582fde8c03613ae10e7fd5405bb5
1 change: 1 addition & 0 deletions trunk/drivers/net/ethernet/emulex/benet/be.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ struct be_rx_compl_info {
u8 ipv6;
u8 vtm;
u8 pkt_type;
u8 ip_frag;
};

struct be_rx_obj {
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/net/ethernet/emulex/benet/be_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ int lancer_test_and_set_rdy_state(struct be_adapter *adapter)

resource_error = lancer_provisioning_error(adapter);
if (resource_error)
return -1;
return -EAGAIN;

status = lancer_wait_ready(adapter);
if (!status) {
Expand Down Expand Up @@ -590,8 +590,8 @@ int lancer_test_and_set_rdy_state(struct be_adapter *adapter)
* when PF provisions resources.
*/
resource_error = lancer_provisioning_error(adapter);
if (status == -1 && !resource_error)
adapter->eeh_error = true;
if (resource_error)
status = -EAGAIN;

return status;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/ethernet/emulex/benet/be_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ struct amap_eth_rx_compl_v0 {
u8 ip_version; /* dword 1 */
u8 macdst[6]; /* dword 1 */
u8 vtp; /* dword 1 */
u8 rsvd0; /* dword 1 */
u8 ip_frag; /* dword 1 */
u8 fragndx[10]; /* dword 1 */
u8 ct[2]; /* dword 1 */
u8 sw; /* dword 1 */
Expand Down
55 changes: 29 additions & 26 deletions trunk/drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,8 @@ static void be_parse_rx_compl_v0(struct be_eth_rx_compl *compl,
compl);
}
rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl);
rxcp->ip_frag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0,
ip_frag, compl);
}

static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
Expand All @@ -1620,6 +1622,9 @@ static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
else
be_parse_rx_compl_v0(compl, rxcp);

if (rxcp->ip_frag)
rxcp->l4_csum = 0;

if (rxcp->vlanf) {
/* vlanf could be wrongly set in some cards.
* ignore if vtm is not set */
Expand Down Expand Up @@ -2168,7 +2173,7 @@ static irqreturn_t be_msix(int irq, void *dev)

static inline bool do_gro(struct be_rx_compl_info *rxcp)
{
return (rxcp->tcpf && !rxcp->err) ? true : false;
return (rxcp->tcpf && !rxcp->err && rxcp->l4_csum) ? true : false;
}

static int be_process_rx(struct be_rx_obj *rxo, struct napi_struct *napi,
Expand Down Expand Up @@ -4093,6 +4098,7 @@ static int be_get_initial_config(struct be_adapter *adapter)

static int lancer_recover_func(struct be_adapter *adapter)
{
struct device *dev = &adapter->pdev->dev;
int status;

status = lancer_test_and_set_rdy_state(adapter);
Expand All @@ -4104,8 +4110,7 @@ static int lancer_recover_func(struct be_adapter *adapter)

be_clear(adapter);

adapter->hw_error = false;
adapter->fw_timeout = false;
be_clear_all_error(adapter);

status = be_setup(adapter);
if (status)
Expand All @@ -4117,13 +4122,13 @@ static int lancer_recover_func(struct be_adapter *adapter)
goto err;
}

dev_err(&adapter->pdev->dev,
"Adapter SLIPORT recovery succeeded\n");
dev_err(dev, "Error recovery successful\n");
return 0;
err:
if (adapter->eeh_error)
dev_err(&adapter->pdev->dev,
"Adapter SLIPORT recovery failed\n");
if (status == -EAGAIN)
dev_err(dev, "Waiting for resource provisioning\n");
else
dev_err(dev, "Error recovery failed\n");

return status;
}
Expand All @@ -4132,28 +4137,27 @@ static void be_func_recovery_task(struct work_struct *work)
{
struct be_adapter *adapter =
container_of(work, struct be_adapter, func_recovery_work.work);
int status;
int status = 0;

be_detect_error(adapter);

if (adapter->hw_error && lancer_chip(adapter)) {

if (adapter->eeh_error)
goto out;

rtnl_lock();
netif_device_detach(adapter->netdev);
rtnl_unlock();

status = lancer_recover_func(adapter);

if (!status)
netif_device_attach(adapter->netdev);
}

out:
schedule_delayed_work(&adapter->func_recovery_work,
msecs_to_jiffies(1000));
/* In Lancer, for all errors other than provisioning error (-EAGAIN),
* no need to attempt further recovery.
*/
if (!status || status == -EAGAIN)
schedule_delayed_work(&adapter->func_recovery_work,
msecs_to_jiffies(1000));
}

static void be_worker(struct work_struct *work)
Expand Down Expand Up @@ -4436,20 +4440,19 @@ static pci_ers_result_t be_eeh_err_detected(struct pci_dev *pdev,

dev_err(&adapter->pdev->dev, "EEH error detected\n");

adapter->eeh_error = true;

cancel_delayed_work_sync(&adapter->func_recovery_work);
if (!adapter->eeh_error) {
adapter->eeh_error = true;

rtnl_lock();
netif_device_detach(netdev);
rtnl_unlock();
cancel_delayed_work_sync(&adapter->func_recovery_work);

if (netif_running(netdev)) {
rtnl_lock();
be_close(netdev);
netif_device_detach(netdev);
if (netif_running(netdev))
be_close(netdev);
rtnl_unlock();

be_clear(adapter);
}
be_clear(adapter);

if (state == pci_channel_io_perm_failure)
return PCI_ERS_RESULT_DISCONNECT;
Expand All @@ -4474,7 +4477,6 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev)
int status;

dev_info(&adapter->pdev->dev, "EEH reset\n");
be_clear_all_error(adapter);

status = pci_enable_device(pdev);
if (status)
Expand All @@ -4492,6 +4494,7 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev)
return PCI_ERS_RESULT_DISCONNECT;

pci_cleanup_aer_uncorrect_error_status(pdev);
be_clear_all_error(adapter);
return PCI_ERS_RESULT_RECOVERED;
}

Expand Down
16 changes: 16 additions & 0 deletions trunk/include/linux/netfilter_ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ extern __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,

extern int ipv6_netfilter_init(void);
extern void ipv6_netfilter_fini(void);

/*
* Hook functions for ipv6 to allow xt_* modules to be built-in even
* if IPv6 is a module.
*/
struct nf_ipv6_ops {
int (*chk_addr)(struct net *net, const struct in6_addr *addr,
const struct net_device *dev, int strict);
};

extern const struct nf_ipv6_ops __rcu *nf_ipv6_ops;
static inline const struct nf_ipv6_ops *nf_get_ipv6_ops(void)
{
return rcu_dereference(nf_ipv6_ops);
}

#else /* CONFIG_NETFILTER */
static inline int ipv6_netfilter_init(void) { return 0; }
static inline void ipv6_netfilter_fini(void) { return; }
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/net/addrconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extern int addrconf_set_dstaddr(struct net *net,

extern int ipv6_chk_addr(struct net *net,
const struct in6_addr *addr,
struct net_device *dev,
const struct net_device *dev,
int strict);

#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
Expand Down
6 changes: 4 additions & 2 deletions trunk/net/ipv4/netfilter/ipt_ULOG.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,10 @@ static void ipt_ulog_packet(struct net *net,
put_unaligned(tv.tv_usec, &pm->timestamp_usec);
put_unaligned(skb->mark, &pm->mark);
pm->hook = hooknum;
if (prefix != NULL)
strncpy(pm->prefix, prefix, sizeof(pm->prefix));
if (prefix != NULL) {
strncpy(pm->prefix, prefix, sizeof(pm->prefix) - 1);
pm->prefix[sizeof(pm->prefix) - 1] = '\0';
}
else if (loginfo->prefix[0] != '\0')
strncpy(pm->prefix, loginfo->prefix, sizeof(pm->prefix));
else
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ static int ipv6_count_addresses(struct inet6_dev *idev)
}

int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
struct net_device *dev, int strict)
const struct net_device *dev, int strict)
{
struct inet6_ifaddr *ifp;
unsigned int hash = inet6_addr_hash(addr);
Expand Down
7 changes: 7 additions & 0 deletions trunk/net/ipv6/netfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <linux/netfilter.h>
#include <linux/netfilter_ipv6.h>
#include <linux/export.h>
#include <net/addrconf.h>
#include <net/dst.h>
#include <net/ipv6.h>
#include <net/ip6_route.h>
Expand Down Expand Up @@ -186,6 +187,10 @@ static __sum16 nf_ip6_checksum_partial(struct sk_buff *skb, unsigned int hook,
return csum;
};

static const struct nf_ipv6_ops ipv6ops = {
.chk_addr = ipv6_chk_addr,
};

static const struct nf_afinfo nf_ip6_afinfo = {
.family = AF_INET6,
.checksum = nf_ip6_checksum,
Expand All @@ -198,6 +203,7 @@ static const struct nf_afinfo nf_ip6_afinfo = {

int __init ipv6_netfilter_init(void)
{
RCU_INIT_POINTER(nf_ipv6_ops, &ipv6ops);
return nf_register_afinfo(&nf_ip6_afinfo);
}

Expand All @@ -206,5 +212,6 @@ int __init ipv6_netfilter_init(void)
*/
void ipv6_netfilter_fini(void)
{
RCU_INIT_POINTER(nf_ipv6_ops, NULL);
nf_unregister_afinfo(&nf_ip6_afinfo);
}
2 changes: 2 additions & 0 deletions trunk/net/netfilter/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ static DEFINE_MUTEX(afinfo_mutex);

const struct nf_afinfo __rcu *nf_afinfo[NFPROTO_NUMPROTO] __read_mostly;
EXPORT_SYMBOL(nf_afinfo);
const struct nf_ipv6_ops __rcu *nf_ipv6_ops __read_mostly;
EXPORT_SYMBOL_GPL(nf_ipv6_ops);

int nf_register_afinfo(const struct nf_afinfo *afinfo)
{
Expand Down
35 changes: 35 additions & 0 deletions trunk/net/netfilter/ipvs/ip_vs_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,32 @@ static inline int is_tcp_reset(const struct sk_buff *skb, int nh_len)
return th->rst;
}

static inline bool is_new_conn(const struct sk_buff *skb,
struct ip_vs_iphdr *iph)
{
switch (iph->protocol) {
case IPPROTO_TCP: {
struct tcphdr _tcph, *th;

th = skb_header_pointer(skb, iph->len, sizeof(_tcph), &_tcph);
if (th == NULL)
return false;
return th->syn;
}
case IPPROTO_SCTP: {
sctp_chunkhdr_t *sch, schunk;

sch = skb_header_pointer(skb, iph->len + sizeof(sctp_sctphdr_t),
sizeof(schunk), &schunk);
if (sch == NULL)
return false;
return sch->type == SCTP_CID_INIT;
}
default:
return false;
}
}

/* Handle response packets: rewrite addresses and send away...
*/
static unsigned int
Expand Down Expand Up @@ -1612,6 +1638,15 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
* Check if the packet belongs to an existing connection entry
*/
cp = pp->conn_in_get(af, skb, &iph, 0);

if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp && cp->dest &&
unlikely(!atomic_read(&cp->dest->weight)) && !iph.fragoffs &&
is_new_conn(skb, &iph)) {
ip_vs_conn_expire_now(cp);
__ip_vs_conn_put(cp);
cp = NULL;
}

if (unlikely(!cp) && !iph.fragoffs) {
/* No (second) fragments need to enter here, as nf_defrag_ipv6
* replayed fragment zero will already have created the cp
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/netfilter/ipvs/ip_vs_sh.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ struct ip_vs_sh_bucket {
#define IP_VS_SH_TAB_MASK (IP_VS_SH_TAB_SIZE - 1)

struct ip_vs_sh_state {
struct ip_vs_sh_bucket buckets[IP_VS_SH_TAB_SIZE];
struct rcu_head rcu_head;
struct ip_vs_sh_bucket buckets[IP_VS_SH_TAB_SIZE];
};

/*
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/netfilter/xt_LOG.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ static void dump_ipv6_packet(struct sbuff *m,
dump_sk_uid_gid(m, skb->sk);

/* Max length: 16 "MARK=0xFFFFFFFF " */
if (!recurse && skb->mark)
if (recurse && skb->mark)
sb_add(m, "MARK=0x%x ", skb->mark);
}

Expand Down
Loading

0 comments on commit 82e2c02

Please sign in to comment.