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 fixes from David Miller:

 1) Fix error path in netdevsim, from Jakub Kicinski.

 2) Default values listed in tcp_wmem and tcp_rmem documentation were
    inaccurate, from Tonghao Zhang.

 3) Fix route leaks in SCTP, both for ipv4 and ipv6. From Alexey Kodanev
    and Tommi Rantala.

 4) Fix "MASK < Y" meant to be "MASK << Y" in xgbe driver, from Wolfram
    Sang.

 5) Use after free in u32_destroy_key(), from Paolo Abeni.

 6) Fix two TX issues in be2net driver, from Suredh Reddy.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (25 commits)
  be2net: Handle transmit completion errors in Lancer
  be2net: Fix HW stall issue in Lancer
  RDS: IB: Fix null pointer issue
  nfp: fix kdoc warnings on nested structures
  sample/bpf: fix erspan metadata
  net: erspan: fix erspan config overwrite
  net: erspan: fix metadata extraction
  cls_u32: fix use after free in u32_destroy_key()
  net: amd-xgbe: fix comparison to bitshift when dealing with a mask
  net: phy: Handle not having GPIO enabled in the kernel
  ibmvnic: fix empty firmware version and errors cleanup
  sctp: fix dst refcnt leak in sctp_v4_get_dst
  sctp: fix dst refcnt leak in sctp_v6_get_dst()
  dwc-xlgmac: remove Jie Deng as co-maintainer
  doc: Change the min default value of tcp_wmem/tcp_rmem.
  samples/bpf: use bpf_set_link_xdp_fd
  libbpf: add missing SPDX-License-Identifier
  libbpf: add error reporting in XDP
  libbpf: add function to setup XDP
  tools: add netlink.h and if_link.h in tools uapi
  ...
  • Loading branch information
Linus Torvalds committed Feb 7, 2018
2 parents cbd7b8a + 176bfb4 commit 0dc400f
Show file tree
Hide file tree
Showing 51 changed files with 1,916 additions and 335 deletions.
31 changes: 31 additions & 0 deletions Documentation/bpf/bpf_devel_QA.txt
Original file line number Diff line number Diff line change
Expand Up @@ -516,4 +516,35 @@ A: LLVM has a -mcpu selector for the BPF back end in order to allow the
By the way, the BPF kernel selftests run with -mcpu=probe for better
test coverage.

Q: In some cases clang flag "-target bpf" is used but in other cases the
default clang target, which matches the underlying architecture, is used.
What is the difference and when I should use which?

A: Although LLVM IR generation and optimization try to stay architecture
independent, "-target <arch>" still has some impact on generated code:

- BPF program may recursively include header file(s) with file scope
inline assembly codes. The default target can handle this well,
while bpf target may fail if bpf backend assembler does not
understand these assembly codes, which is true in most cases.

- When compiled without -g, additional elf sections, e.g.,
.eh_frame and .rela.eh_frame, may be present in the object file
with default target, but not with bpf target.

- The default target may turn a C switch statement into a switch table
lookup and jump operation. Since the switch table is placed
in the global readonly section, the bpf program will fail to load.
The bpf target does not support switch table optimization.
The clang option "-fno-jump-tables" can be used to disable
switch table generation.

You should use default target when:

- Your program includes a header file, e.g., ptrace.h, which eventually
pulls in some header files containing file scope host assembly codes.
- You can add "-fno-jump-tables" to work around the switch table issue.

Otherwise, you can use bpf target.

Happy BPF hacking!
4 changes: 2 additions & 2 deletions Documentation/networking/ip-sysctl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ tcp_rmem - vector of 3 INTEGERs: min, default, max
min: Minimal size of receive buffer used by TCP sockets.
It is guaranteed to each TCP socket, even under moderate memory
pressure.
Default: 1 page
Default: 4K

default: initial size of receive buffer used by TCP sockets.
This value overrides net.core.rmem_default used by other protocols.
Expand Down Expand Up @@ -667,7 +667,7 @@ tcp_window_scaling - BOOLEAN
tcp_wmem - vector of 3 INTEGERs: min, default, max
min: Amount of memory reserved for send buffers for TCP sockets.
Each TCP socket has rights to use it due to fact of its birth.
Default: 1 page
Default: 4K

default: initial size of send buffer used by TCP sockets. This
value overrides net.core.wmem_default used by other protocols.
Expand Down
1 change: 0 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -13326,7 +13326,6 @@ F: include/linux/platform_data/dma-dw.h
F: drivers/dma/dw/

SYNOPSYS DESIGNWARE ENTERPRISE ETHERNET DRIVER
M: Jie Deng <jiedeng@synopsys.com>
M: Jose Abreu <Jose.Abreu@synopsys.com>
L: netdev@vger.kernel.org
S: Supported
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/amd/xgbe/xgbe-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ static void xgbe_isr_task(unsigned long data)

reissue_mask = 1 << 0;
if (!pdata->per_channel_irq)
reissue_mask |= 0xffff < 4;
reissue_mask |= 0xffff << 4;

XP_IOWRITE(pdata, XP_INT_REISSUE_EN, reissue_mask);
}
Expand Down
7 changes: 5 additions & 2 deletions drivers/net/ethernet/emulex/benet/be.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ struct be_tx_stats {
u32 tx_spoof_check_err;
u32 tx_qinq_err;
u32 tx_internal_parity_err;
u32 tx_sge_err;
struct u64_stats_sync sync;
struct u64_stats_sync sync_compl;
};
Expand Down Expand Up @@ -944,8 +945,10 @@ static inline bool is_ipv6_ext_hdr(struct sk_buff *skb)
#define BE_ERROR_EEH 1
#define BE_ERROR_UE BIT(1)
#define BE_ERROR_FW BIT(2)
#define BE_ERROR_HW (BE_ERROR_EEH | BE_ERROR_UE)
#define BE_ERROR_ANY (BE_ERROR_EEH | BE_ERROR_UE | BE_ERROR_FW)
#define BE_ERROR_TX BIT(3)
#define BE_ERROR_HW (BE_ERROR_EEH | BE_ERROR_UE | BE_ERROR_TX)
#define BE_ERROR_ANY (BE_ERROR_EEH | BE_ERROR_UE | BE_ERROR_FW | \
BE_ERROR_TX)
#define BE_CLEAR_ALL 0xFF

static inline u8 be_check_error(struct be_adapter *adapter, u32 err_type)
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/emulex/benet/be_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ static const struct be_ethtool_stat et_tx_stats[] = {
* packet data. This counter is applicable only for Lancer adapters.
*/
{DRVSTAT_TX_INFO(tx_internal_parity_err)},
{DRVSTAT_TX_INFO(tx_sge_err)},
{DRVSTAT_TX_INFO(tx_bytes)},
{DRVSTAT_TX_INFO(tx_pkts)},
{DRVSTAT_TX_INFO(tx_vxlan_offload_pkts)},
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/emulex/benet/be_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ struct be_eth_hdr_wrb {
#define LANCER_TX_COMP_HSW_DROP_MAC_ERR 0x3
#define LANCER_TX_COMP_HSW_DROP_VLAN_ERR 0x5
#define LANCER_TX_COMP_QINQ_ERR 0x7
#define LANCER_TX_COMP_SGE_ERR 0x9
#define LANCER_TX_COMP_PARITY_ERR 0xb
#define LANCER_TX_COMP_DMA_ERR 0xd

Expand Down
113 changes: 66 additions & 47 deletions drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2583,7 +2583,48 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp, u32 frags_needed)
}
}

static struct be_tx_compl_info *be_tx_compl_get(struct be_tx_obj *txo)
static inline void be_update_tx_err(struct be_tx_obj *txo, u8 status)
{
switch (status) {
case BE_TX_COMP_HDR_PARSE_ERR:
tx_stats(txo)->tx_hdr_parse_err++;
break;
case BE_TX_COMP_NDMA_ERR:
tx_stats(txo)->tx_dma_err++;
break;
case BE_TX_COMP_ACL_ERR:
tx_stats(txo)->tx_spoof_check_err++;
break;
}
}

static inline void lancer_update_tx_err(struct be_tx_obj *txo, u8 status)
{
switch (status) {
case LANCER_TX_COMP_LSO_ERR:
tx_stats(txo)->tx_tso_err++;
break;
case LANCER_TX_COMP_HSW_DROP_MAC_ERR:
case LANCER_TX_COMP_HSW_DROP_VLAN_ERR:
tx_stats(txo)->tx_spoof_check_err++;
break;
case LANCER_TX_COMP_QINQ_ERR:
tx_stats(txo)->tx_qinq_err++;
break;
case LANCER_TX_COMP_PARITY_ERR:
tx_stats(txo)->tx_internal_parity_err++;
break;
case LANCER_TX_COMP_DMA_ERR:
tx_stats(txo)->tx_dma_err++;
break;
case LANCER_TX_COMP_SGE_ERR:
tx_stats(txo)->tx_sge_err++;
break;
}
}

static struct be_tx_compl_info *be_tx_compl_get(struct be_adapter *adapter,
struct be_tx_obj *txo)
{
struct be_queue_info *tx_cq = &txo->cq;
struct be_tx_compl_info *txcp = &txo->txcp;
Expand All @@ -2599,6 +2640,24 @@ static struct be_tx_compl_info *be_tx_compl_get(struct be_tx_obj *txo)
txcp->status = GET_TX_COMPL_BITS(status, compl);
txcp->end_index = GET_TX_COMPL_BITS(wrb_index, compl);

if (txcp->status) {
if (lancer_chip(adapter)) {
lancer_update_tx_err(txo, txcp->status);
/* Reset the adapter incase of TSO,
* SGE or Parity error
*/
if (txcp->status == LANCER_TX_COMP_LSO_ERR ||
txcp->status == LANCER_TX_COMP_PARITY_ERR ||
txcp->status == LANCER_TX_COMP_SGE_ERR)
be_set_error(adapter, BE_ERROR_TX);
} else {
be_update_tx_err(txo, txcp->status);
}
}

if (be_check_error(adapter, BE_ERROR_TX))
return NULL;

compl->dw[offsetof(struct amap_eth_tx_compl, valid) / 32] = 0;
queue_tail_inc(tx_cq);
return txcp;
Expand Down Expand Up @@ -2741,7 +2800,7 @@ static void be_tx_compl_clean(struct be_adapter *adapter)
cmpl = 0;
num_wrbs = 0;
txq = &txo->q;
while ((txcp = be_tx_compl_get(txo))) {
while ((txcp = be_tx_compl_get(adapter, txo))) {
num_wrbs +=
be_tx_compl_process(adapter, txo,
txcp->end_index);
Expand Down Expand Up @@ -3120,59 +3179,16 @@ static int be_process_rx(struct be_rx_obj *rxo, struct napi_struct *napi,
return work_done;
}

static inline void be_update_tx_err(struct be_tx_obj *txo, u8 status)
{
switch (status) {
case BE_TX_COMP_HDR_PARSE_ERR:
tx_stats(txo)->tx_hdr_parse_err++;
break;
case BE_TX_COMP_NDMA_ERR:
tx_stats(txo)->tx_dma_err++;
break;
case BE_TX_COMP_ACL_ERR:
tx_stats(txo)->tx_spoof_check_err++;
break;
}
}

static inline void lancer_update_tx_err(struct be_tx_obj *txo, u8 status)
{
switch (status) {
case LANCER_TX_COMP_LSO_ERR:
tx_stats(txo)->tx_tso_err++;
break;
case LANCER_TX_COMP_HSW_DROP_MAC_ERR:
case LANCER_TX_COMP_HSW_DROP_VLAN_ERR:
tx_stats(txo)->tx_spoof_check_err++;
break;
case LANCER_TX_COMP_QINQ_ERR:
tx_stats(txo)->tx_qinq_err++;
break;
case LANCER_TX_COMP_PARITY_ERR:
tx_stats(txo)->tx_internal_parity_err++;
break;
case LANCER_TX_COMP_DMA_ERR:
tx_stats(txo)->tx_dma_err++;
break;
}
}

static void be_process_tx(struct be_adapter *adapter, struct be_tx_obj *txo,
int idx)
{
int num_wrbs = 0, work_done = 0;
struct be_tx_compl_info *txcp;

while ((txcp = be_tx_compl_get(txo))) {
while ((txcp = be_tx_compl_get(adapter, txo))) {
num_wrbs += be_tx_compl_process(adapter, txo, txcp->end_index);
work_done++;

if (txcp->status) {
if (lancer_chip(adapter))
lancer_update_tx_err(txo, txcp->status);
else
be_update_tx_err(txo, txcp->status);
}
}

if (work_done) {
Expand Down Expand Up @@ -5104,9 +5120,12 @@ static netdev_features_t be_features_check(struct sk_buff *skb,
features &= ~NETIF_F_TSO6;

/* Lancer cannot handle the packet with MSS less than 256.
* Also it can't handle a TSO packet with a single segment
* Disable the GSO support in such cases
*/
if (lancer_chip(adapter) && skb_shinfo(skb)->gso_size < 256)
if (lancer_chip(adapter) &&
(skb_shinfo(skb)->gso_size < 256 ||
skb_shinfo(skb)->gso_segs == 1))
features &= ~NETIF_F_GSO_MASK;
}

Expand Down
14 changes: 4 additions & 10 deletions drivers/net/ethernet/ibm/ibmvnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -3286,7 +3286,7 @@ static void handle_vpd_rsp(union ibmvnic_crq *crq,
struct ibmvnic_adapter *adapter)
{
struct device *dev = &adapter->vdev->dev;
unsigned char *substr = NULL, *ptr = NULL;
unsigned char *substr = NULL;
u8 fw_level_len = 0;

memset(adapter->fw_version, 0, 32);
Expand All @@ -3306,10 +3306,6 @@ static void handle_vpd_rsp(union ibmvnic_crq *crq,
substr = strnstr(adapter->vpd->buff, "RM", adapter->vpd->len);
if (!substr) {
dev_info(dev, "Warning - No FW level has been provided in the VPD buffer by the VIOS Server\n");
ptr = strncpy((char *)adapter->fw_version, "N/A",
3 * sizeof(char));
if (!ptr)
dev_err(dev, "Failed to inform that firmware version is unavailable to the adapter\n");
goto complete;
}

Expand All @@ -3324,16 +3320,14 @@ static void handle_vpd_rsp(union ibmvnic_crq *crq,
/* copy firmware version string from vpd into adapter */
if ((substr + 3 + fw_level_len) <
(adapter->vpd->buff + adapter->vpd->len)) {
ptr = strncpy((char *)adapter->fw_version,
substr + 3, fw_level_len);

if (!ptr)
dev_err(dev, "Failed to isolate FW level string\n");
strncpy((char *)adapter->fw_version, substr + 3, fw_level_len);
} else {
dev_info(dev, "FW substr extrapolated VPD buff\n");
}

complete:
if (adapter->fw_version[0] == '\0')
strncpy((char *)adapter->fw_version, "N/A", 3 * sizeof(char));
complete(&adapter->fw_done);
}

Expand Down
24 changes: 12 additions & 12 deletions drivers/net/ethernet/netronome/nfp/bpf/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,22 @@ enum pkt_vec {
* @map_elems_in_use: number of elements allocated to offloaded maps
*
* @adjust_head: adjust head capability
* @flags: extra flags for adjust head
* @off_min: minimal packet offset within buffer required
* @off_max: maximum packet offset within buffer required
* @guaranteed_sub: amount of negative adjustment guaranteed possible
* @guaranteed_add: amount of positive adjustment guaranteed possible
* @adjust_head.flags: extra flags for adjust head
* @adjust_head.off_min: minimal packet offset within buffer required
* @adjust_head.off_max: maximum packet offset within buffer required
* @adjust_head.guaranteed_sub: negative adjustment guaranteed possible
* @adjust_head.guaranteed_add: positive adjustment guaranteed possible
*
* @maps: map capability
* @types: supported map types
* @max_maps: max number of maps supported
* @max_elems: max number of entries in each map
* @max_key_sz: max size of map key
* @max_val_sz: max size of map value
* @max_elem_sz: max size of map entry (key + value)
* @maps.types: supported map types
* @maps.max_maps: max number of maps supported
* @maps.max_elems: max number of entries in each map
* @maps.max_key_sz: max size of map key
* @maps.max_val_sz: max size of map value
* @maps.max_elem_sz: max size of map entry (key + value)
*
* @helpers: helper addressess for various calls
* @map_lookup: map lookup helper address
* @helpers.map_lookup: map lookup helper address
*/
struct nfp_app_bpf {
struct nfp_app *app;
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
* @seq: sequence number of the message
* @count: number of tunnels report in message
* @flags: options part of the request
* @ipv4: dest IPv4 address of active route
* @egress_port: port the encapsulated packet egressed
* @extra: reserved for future use
* @tun_info.ipv4: dest IPv4 address of active route
* @tun_info.egress_port: port the encapsulated packet egressed
* @tun_info.extra: reserved for future use
* @tun_info: tunnels that have sent traffic in reported period
*/
struct nfp_tun_active_tuns {
Expand Down Expand Up @@ -132,8 +132,8 @@ struct nfp_ipv4_addr_entry {
* struct nfp_tun_mac_addr - configure MAC address of tunnel EP on NFP
* @reserved: reserved for future use
* @count: number of MAC addresses in the message
* @index: index of MAC address in the lookup table
* @addr: interface MAC address
* @addresses.index: index of MAC address in the lookup table
* @addresses.addr: interface MAC address
* @addresses: series of MACs to offload
*/
struct nfp_tun_mac_addr {
Expand Down
6 changes: 5 additions & 1 deletion drivers/net/ethernet/netronome/nfp/nfp_net.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ struct nfp_net_tx_desc {

/**
* struct nfp_net_tx_buf - software TX buffer descriptor
* @skb: sk_buff associated with this buffer
* @skb: normal ring, sk_buff associated with this buffer
* @frag: XDP ring, page frag associated with this buffer
* @dma_addr: DMA mapping address of the buffer
* @fidx: Fragment index (-1 for the head and [0..nr_frags-1] for frags)
* @pkt_cnt: Number of packets to be produced out of the skb associated
Expand Down Expand Up @@ -377,6 +378,9 @@ struct nfp_net_rx_ring {
* struct nfp_net_r_vector - Per ring interrupt vector configuration
* @nfp_net: Backpointer to nfp_net structure
* @napi: NAPI structure for this ring vec
* @tasklet: ctrl vNIC, tasklet for servicing the r_vec
* @queue: ctrl vNIC, send queue
* @lock: ctrl vNIC, r_vec lock protects @queue
* @tx_ring: Pointer to TX ring
* @rx_ring: Pointer to RX ring
* @xdp_ring: Pointer to an extra TX ring for XDP
Expand Down
Loading

0 comments on commit 0dc400f

Please sign in to comment.