Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Browse files Browse the repository at this point in the history
Pull networking bugfixes from David Miller:
 "Several bug fixes rolling in, some for changes introduced in this
  merge window, and some for problems that have existed for some time:

  1) Fix prepare_to_wait() handling in AF_VSOCK, from Claudio Imbrenda.

  2) The new DST_CACHE should be a silent config option, from Dave
     Jones.

  3) inet_current_timestamp() unintentionally truncates timestamps to
     16-bit, from Deepa Dinamani.

  4) Missing reference to netns in ppp, from Guillaume Nault.

  5) Free memory reference in hv_netvsc driver, from Haiyang Zhang.

  6) Missing kernel doc documentation for function arguments in various
     spots around the networking, from Luis de Bethencourt.

  7) UDP stopped receiving broadcast packets properly, due to
     overzealous multicast checks, fix from Paolo Abeni"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (59 commits)
  net: ping: make ping_v6_sendmsg static
  hv_netvsc: Fix the order of num_sc_offered decrement
  net: Fix typos and whitespace.
  hv_netvsc: Fix the array sizes to be max supported channels
  hv_netvsc: Fix accessing freed memory in netvsc_change_mtu()
  ppp: take reference on channels netns
  net: Reset encap_level to avoid resetting features on inner IP headers
  net: mediatek: fix checking for NULL instead of IS_ERR() in .probe
  net: phy: at803x: Request 'reset' GPIO only for AT8030 PHY
  at803x: fix reset handling
  AF_VSOCK: Shrink the area influenced by prepare_to_wait
  Revert "vsock: Fix blocking ops call in prepare_to_wait"
  macb: fix PHY reset
  ipv4: initialize flowi4_flags before calling fib_lookup()
  fsl/fman: Workaround for Errata A-007273
  ipv4: fix broadcast packets reception
  net: hns: bug fix about the overflow of mss
  net: hns: adds limitation for debug port mtu
  net: hns: fix the bug about mtu setting
  net: hns: fixes a bug of RSS
  ...
  • Loading branch information
torvalds committed Mar 24, 2016
2 parents 5a010c7 + 6579a02 commit aca04ce
Show file tree
Hide file tree
Showing 68 changed files with 710 additions and 460 deletions.
19 changes: 12 additions & 7 deletions Documentation/networking/ip-sysctl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -946,15 +946,20 @@ igmp_max_memberships - INTEGER
The value 5459 assumes no IP header options, so in practice
this number may be lower.

conf/interface/* changes special settings per interface (where
"interface" is the name of your network interface)

conf/all/* is special, changes the settings for all interfaces
igmp_max_msf - INTEGER
Maximum number of addresses allowed in the source filter list for a
multicast group.
Default: 10

igmp_qrv - INTEGER
Controls the IGMP query robustness variable (see RFC2236 8.1).
Default: 2 (as specified by RFC2236 8.1)
Minimum: 1 (as specified by RFC6636 4.5)
Controls the IGMP query robustness variable (see RFC2236 8.1).
Default: 2 (as specified by RFC2236 8.1)
Minimum: 1 (as specified by RFC6636 4.5)

conf/interface/* changes special settings per interface (where
"interface" is the name of your network interface)

conf/all/* is special, changes the settings for all interfaces

log_martians - BOOLEAN
Log packets with impossible addresses to kernel log.
Expand Down
69 changes: 29 additions & 40 deletions drivers/isdn/mISDN/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/spinlock.h>
#include <linux/ktime.h>
#include <linux/mISDNif.h>
#include <linux/export.h>
#include "core.h"
Expand All @@ -45,15 +46,15 @@ static u_int *debug;
static LIST_HEAD(iclock_list);
static DEFINE_RWLOCK(iclock_lock);
static u16 iclock_count; /* counter of last clock */
static struct timeval iclock_tv; /* time stamp of last clock */
static int iclock_tv_valid; /* already received one timestamp */
static ktime_t iclock_timestamp; /* time stamp of last clock */
static int iclock_timestamp_valid; /* already received one timestamp */
static struct mISDNclock *iclock_current;

void
mISDN_init_clock(u_int *dp)
{
debug = dp;
do_gettimeofday(&iclock_tv);
iclock_timestamp = ktime_get();
}

static void
Expand Down Expand Up @@ -86,7 +87,7 @@ select_iclock(void)
}
if (bestclock != iclock_current) {
/* no clock received yet */
iclock_tv_valid = 0;
iclock_timestamp_valid = 0;
}
iclock_current = bestclock;
}
Expand Down Expand Up @@ -139,12 +140,11 @@ mISDN_unregister_clock(struct mISDNclock *iclock)
EXPORT_SYMBOL(mISDN_unregister_clock);

void
mISDN_clock_update(struct mISDNclock *iclock, int samples, struct timeval *tv)
mISDN_clock_update(struct mISDNclock *iclock, int samples, ktime_t *timestamp)
{
u_long flags;
struct timeval tv_now;
time_t elapsed_sec;
int elapsed_8000th;
ktime_t timestamp_now;
u16 delta;

write_lock_irqsave(&iclock_lock, flags);
if (iclock_current != iclock) {
Expand All @@ -156,33 +156,27 @@ mISDN_clock_update(struct mISDNclock *iclock, int samples, struct timeval *tv)
write_unlock_irqrestore(&iclock_lock, flags);
return;
}
if (iclock_tv_valid) {
if (iclock_timestamp_valid) {
/* increment sample counter by given samples */
iclock_count += samples;
if (tv) { /* tv must be set, if function call is delayed */
iclock_tv.tv_sec = tv->tv_sec;
iclock_tv.tv_usec = tv->tv_usec;
} else
do_gettimeofday(&iclock_tv);
if (timestamp) { /* timestamp must be set, if function call is delayed */
iclock_timestamp = *timestamp;
} else {
iclock_timestamp = ktime_get();
}
} else {
/* calc elapsed time by system clock */
if (tv) { /* tv must be set, if function call is delayed */
tv_now.tv_sec = tv->tv_sec;
tv_now.tv_usec = tv->tv_usec;
} else
do_gettimeofday(&tv_now);
elapsed_sec = tv_now.tv_sec - iclock_tv.tv_sec;
elapsed_8000th = (tv_now.tv_usec / 125)
- (iclock_tv.tv_usec / 125);
if (elapsed_8000th < 0) {
elapsed_sec -= 1;
elapsed_8000th += 8000;
if (timestamp) { /* timestamp must be set, if function call is delayed */
timestamp_now = *timestamp;
} else {
timestamp_now = ktime_get();
}
delta = ktime_divns(ktime_sub(timestamp_now, iclock_timestamp),
(NSEC_PER_SEC / 8000));
/* add elapsed time to counter and set new timestamp */
iclock_count += elapsed_sec * 8000 + elapsed_8000th;
iclock_tv.tv_sec = tv_now.tv_sec;
iclock_tv.tv_usec = tv_now.tv_usec;
iclock_tv_valid = 1;
iclock_count += delta;
iclock_timestamp = timestamp_now;
iclock_timestamp_valid = 1;
if (*debug & DEBUG_CLOCK)
printk("Received first clock from source '%s'.\n",
iclock_current ? iclock_current->name : "nothing");
Expand All @@ -195,22 +189,17 @@ unsigned short
mISDN_clock_get(void)
{
u_long flags;
struct timeval tv_now;
time_t elapsed_sec;
int elapsed_8000th;
ktime_t timestamp_now;
u16 delta;
u16 count;

read_lock_irqsave(&iclock_lock, flags);
/* calc elapsed time by system clock */
do_gettimeofday(&tv_now);
elapsed_sec = tv_now.tv_sec - iclock_tv.tv_sec;
elapsed_8000th = (tv_now.tv_usec / 125) - (iclock_tv.tv_usec / 125);
if (elapsed_8000th < 0) {
elapsed_sec -= 1;
elapsed_8000th += 8000;
}
timestamp_now = ktime_get();
delta = ktime_divns(ktime_sub(timestamp_now, iclock_timestamp),
(NSEC_PER_SEC / 8000));
/* add elapsed time to counter */
count = iclock_count + elapsed_sec * 8000 + elapsed_8000th;
count = iclock_count + delta;
read_unlock_irqrestore(&iclock_lock, flags);
return count;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/cadence/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2959,7 +2959,7 @@ static int macb_probe(struct platform_device *pdev)
int gpio = of_get_named_gpio(phy_node, "reset-gpios", 0);
if (gpio_is_valid(gpio))
bp->reset_gpio = gpio_to_desc(gpio);
gpiod_set_value(bp->reset_gpio, GPIOD_OUT_HIGH);
gpiod_direction_output(bp->reset_gpio, 1);
}
of_node_put(phy_node);

Expand Down Expand Up @@ -3029,7 +3029,7 @@ static int macb_remove(struct platform_device *pdev)
mdiobus_free(bp->mii_bus);

/* Shutdown the PHY if there is a GPIO reset */
gpiod_set_value(bp->reset_gpio, GPIOD_OUT_LOW);
gpiod_set_value(bp->reset_gpio, 0);

unregister_netdev(dev);
clk_disable_unprepare(bp->tx_clk);
Expand Down
104 changes: 88 additions & 16 deletions drivers/net/ethernet/freescale/fman/fman.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "fman.h"
#include "fman_muram.h"

#include <linux/fsl/guts.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/module.h>
Expand Down Expand Up @@ -1871,6 +1872,90 @@ static int fman_config(struct fman *fman)
return -EINVAL;
}

static int fman_reset(struct fman *fman)
{
u32 count;
int err = 0;

if (fman->state->rev_info.major < 6) {
iowrite32be(FPM_RSTC_FM_RESET, &fman->fpm_regs->fm_rstc);
/* Wait for reset completion */
count = 100;
do {
udelay(1);
} while (((ioread32be(&fman->fpm_regs->fm_rstc)) &
FPM_RSTC_FM_RESET) && --count);
if (count == 0)
err = -EBUSY;

goto _return;
} else {
struct device_node *guts_node;
struct ccsr_guts __iomem *guts_regs;
u32 devdisr2, reg;

/* Errata A007273 */
guts_node =
of_find_compatible_node(NULL, NULL,
"fsl,qoriq-device-config-2.0");
if (!guts_node) {
dev_err(fman->dev, "%s: Couldn't find guts node\n",
__func__);
goto guts_node;
}

guts_regs = of_iomap(guts_node, 0);
if (!guts_regs) {
dev_err(fman->dev, "%s: Couldn't map %s regs\n",
__func__, guts_node->full_name);
goto guts_regs;
}
#define FMAN1_ALL_MACS_MASK 0xFCC00000
#define FMAN2_ALL_MACS_MASK 0x000FCC00
/* Read current state */
devdisr2 = ioread32be(&guts_regs->devdisr2);
if (fman->dts_params.id == 0)
reg = devdisr2 & ~FMAN1_ALL_MACS_MASK;
else
reg = devdisr2 & ~FMAN2_ALL_MACS_MASK;

/* Enable all MACs */
iowrite32be(reg, &guts_regs->devdisr2);

/* Perform FMan reset */
iowrite32be(FPM_RSTC_FM_RESET, &fman->fpm_regs->fm_rstc);

/* Wait for reset completion */
count = 100;
do {
udelay(1);
} while (((ioread32be(&fman->fpm_regs->fm_rstc)) &
FPM_RSTC_FM_RESET) && --count);
if (count == 0) {
iounmap(guts_regs);
of_node_put(guts_node);
err = -EBUSY;
goto _return;
}

/* Restore devdisr2 value */
iowrite32be(devdisr2, &guts_regs->devdisr2);

iounmap(guts_regs);
of_node_put(guts_node);

goto _return;

guts_regs:
of_node_put(guts_node);
guts_node:
dev_dbg(fman->dev, "%s: Didn't perform FManV3 reset due to Errata A007273!\n",
__func__);
}
_return:
return err;
}

static int fman_init(struct fman *fman)
{
struct fman_cfg *cfg = NULL;
Expand Down Expand Up @@ -1914,22 +1999,9 @@ static int fman_init(struct fman *fman)
fman->liodn_base[i] = liodn_base;
}

/* FMan Reset (supported only for FMan V2) */
if (fman->state->rev_info.major >= 6) {
/* Errata A007273 */
dev_dbg(fman->dev, "%s: FManV3 reset is not supported!\n",
__func__);
} else {
iowrite32be(FPM_RSTC_FM_RESET, &fman->fpm_regs->fm_rstc);
/* Wait for reset completion */
count = 100;
do {
udelay(1);
} while (((ioread32be(&fman->fpm_regs->fm_rstc)) &
FPM_RSTC_FM_RESET) && --count);
if (count == 0)
return -EBUSY;
}
err = fman_reset(fman);
if (err)
return err;

if (ioread32be(&fman->qmi_regs->fmqm_gs) & QMI_GS_HALT_NOT_BUSY) {
resume(fman->fpm_regs);
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/hisilicon/hns/hnae.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ enum hnae_led_state {

#define HNSV2_TXD_BUFNUM_S 0
#define HNSV2_TXD_BUFNUM_M (0x7 << HNSV2_TXD_BUFNUM_S)
#define HNSV2_TXD_PORTID_S 4
#define HNSV2_TXD_PORTID_M (0X7 << HNSV2_TXD_PORTID_S)
#define HNSV2_TXD_RI_B 1
#define HNSV2_TXD_L4CS_B 2
#define HNSV2_TXD_L3CS_B 3
Expand Down Expand Up @@ -516,6 +518,7 @@ struct hnae_handle {
int q_num;
int vf_id;
u32 eport_id;
u32 dport_id; /* v2 tx bd should fill the dport_id */
enum hnae_port_type port_type;
struct list_head node; /* list to hnae_ae_dev->handle_list */
struct hnae_buf_ops *bops; /* operation for the buffer */
Expand Down
12 changes: 9 additions & 3 deletions drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ struct hnae_handle *hns_ae_get_handle(struct hnae_ae_dev *dev,
ae_handle->phy_node = vf_cb->mac_cb->phy_node;
ae_handle->if_support = vf_cb->mac_cb->if_support;
ae_handle->port_type = vf_cb->mac_cb->mac_type;
ae_handle->dport_id = port_idx;

return ae_handle;
vf_id_err:
Expand Down Expand Up @@ -419,7 +420,10 @@ static int hns_ae_set_autoneg(struct hnae_handle *handle, u8 enable)

static void hns_ae_set_promisc_mode(struct hnae_handle *handle, u32 en)
{
struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle);

hns_dsaf_set_promisc_mode(hns_ae_get_dsaf_dev(handle->dev), en);
hns_mac_set_promisc(mac_cb, (u8)!!en);
}

static int hns_ae_get_autoneg(struct hnae_handle *handle)
Expand Down Expand Up @@ -787,7 +791,8 @@ static int hns_ae_get_rss(struct hnae_handle *handle, u32 *indir, u8 *key,
memcpy(key, ppe_cb->rss_key, HNS_PPEV2_RSS_KEY_SIZE);

/* update the current hash->queue mappings from the shadow RSS table */
memcpy(indir, ppe_cb->rss_indir_table, HNS_PPEV2_RSS_IND_TBL_SIZE);
memcpy(indir, ppe_cb->rss_indir_table,
HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir));

return 0;
}
Expand All @@ -799,10 +804,11 @@ static int hns_ae_set_rss(struct hnae_handle *handle, const u32 *indir,

/* set the RSS Hash Key if specififed by the user */
if (key)
hns_ppe_set_rss_key(ppe_cb, (int *)key);
hns_ppe_set_rss_key(ppe_cb, (u32 *)key);

/* update the shadow RSS table with user specified qids */
memcpy(ppe_cb->rss_indir_table, indir, HNS_PPEV2_RSS_IND_TBL_SIZE);
memcpy(ppe_cb->rss_indir_table, indir,
HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir));

/* now update the hardware */
hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table);
Expand Down
Loading

0 comments on commit aca04ce

Please sign in to comment.