From: David S. Miller Date: Tue, 22 Nov 2016 16:29:28 +0000 (-0500) Subject: Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f9aa9dc7d2d00e6eb02168ffc64ef614b89d7998;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Merge git://git./linux/kernel/git/davem/net All conflicts were simple overlapping changes except perhaps for the Thunder driver. That driver has a change_mtu method explicitly for sending a message to the hardware. If that fails it returns an error. Normally a driver doesn't need an ndo_change_mtu method becuase those are usually just range changes, which are now handled generically. But since this extra operation is needed in the Thunder driver, it has to stay. However, if the message send fails we have to restore the original MTU before the change because the entire call chain expects that if an error is thrown by ndo_change_mtu then the MTU did not change. Therefore code is added to nicvf_change_mtu to remember the original MTU, and to restore it upon nicvf_update_hw_max_frs() failue. Signed-off-by: David S. Miller --- f9aa9dc7d2d00e6eb02168ffc64ef614b89d7998 diff --cc drivers/net/ethernet/cavium/thunder/nicvf_main.c index b192712c93b7,8a37012c9c89..7c2c37388c12 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@@ -1300,22 -1291,20 +1291,17 @@@ napi_del static int nicvf_change_mtu(struct net_device *netdev, int new_mtu) { struct nicvf *nic = netdev_priv(netdev); - - if (new_mtu > NIC_HW_MAX_FRS) - return -EINVAL; - - if (new_mtu < NIC_HW_MIN_FRS) - return -EINVAL; ++ int orig_mtu = netdev->mtu; - if (nicvf_update_hw_max_frs(nic, new_mtu)) - return -EINVAL; netdev->mtu = new_mtu; - nic->mtu = new_mtu; + + if (!netif_running(netdev)) + return 0; + - if (nicvf_update_hw_max_frs(nic, new_mtu)) ++ if (nicvf_update_hw_max_frs(nic, new_mtu)) { ++ netdev->mtu = orig_mtu; + return -EINVAL; ++ } return 0; } diff --cc drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c index bec72d3103a1,a601f8d43b75..a340fc8bd0de --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c @@@ -205,14 -211,18 +212,18 @@@ static void dwmac4_rd_enable_tx_timesta static int dwmac4_wrback_get_tx_timestamp_status(struct dma_desc *p) { - return (le32_to_cpu(p->des3) & TDES3_TIMESTAMP_STATUS) - >> TDES3_TIMESTAMP_STATUS_SHIFT; + /* Context type from W/B descriptor must be zero */ - if (p->des3 & TDES3_CONTEXT_TYPE) ++ if (le32_to_cpu(p->des3) & TDES3_CONTEXT_TYPE) + return -EINVAL; + + /* Tx Timestamp Status is 1 so des0 and des1'll have valid values */ - if (p->des3 & TDES3_TIMESTAMP_STATUS) ++ if (le32_to_cpu(p->des3) & TDES3_TIMESTAMP_STATUS) + return 0; + + return 1; } - /* NOTE: For RX CTX bit has to be checked before - * HAVE a specific function for TX and another one for RX - */ - static u64 dwmac4_wrback_get_timestamp(void *desc, u32 ats) + static inline u64 dwmac4_get_timestamp(void *desc, u32 ats) { struct dma_desc *p = (struct dma_desc *)desc; u64 ns; @@@ -224,12 -234,54 +235,54 @@@ return ns; } - static int dwmac4_context_get_rx_timestamp_status(void *desc, u32 ats) + static int dwmac4_rx_check_timestamp(void *desc) + { + struct dma_desc *p = (struct dma_desc *)desc; + u32 own, ctxt; + int ret = 1; + + own = p->des3 & RDES3_OWN; + ctxt = ((p->des3 & RDES3_CONTEXT_DESCRIPTOR) + >> RDES3_CONTEXT_DESCRIPTOR_SHIFT); + + if (likely(!own && ctxt)) { + if ((p->des0 == 0xffffffff) && (p->des1 == 0xffffffff)) + /* Corrupted value */ + ret = -EINVAL; + else + /* A valid Timestamp is ready to be read */ + ret = 0; + } + + /* Timestamp not ready */ + return ret; + } + + static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats) { struct dma_desc *p = (struct dma_desc *)desc; + int ret = -EINVAL; + + /* Get the status from normal w/b descriptor */ + if (likely(p->des3 & TDES3_RS1V)) { - if (likely(p->des1 & RDES1_TIMESTAMP_AVAILABLE)) { ++ if (likely(le32_to_cpu(p->des1) & RDES1_TIMESTAMP_AVAILABLE)) { + int i = 0; + + /* Check if timestamp is OK from context descriptor */ + do { + ret = dwmac4_rx_check_timestamp(desc); + if (ret < 0) + goto exit; + i++; - return (le32_to_cpu(p->des1) & RDES1_TIMESTAMP_AVAILABLE) - >> RDES1_TIMESTAMP_AVAILABLE_SHIFT; + } while ((ret == 1) || (i < 10)); + + if (i == 10) + ret = -EBUSY; + } + } + exit: + return ret; } static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic, diff --cc drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index fbd1cd79233d,1f9ec02fa7f8..29557d27e991 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@@ -2635,11 -2628,8 +2638,9 @@@ static int stmmac_rx(struct stmmac_pri DMA_FROM_DEVICE); } - stmmac_get_rx_hwtstamp(priv, entry, skb); - if (netif_msg_pktdata(priv)) { - pr_debug("frame received (%dbytes)", frame_len); + netdev_dbg(priv->dev, "frame received (%dbytes)", + frame_len); print_pkt(skb->data, frame_len); } diff --cc include/linux/bpf_verifier.h index ac5b393ee6b2,6aaf425cebc3..7453c1281531 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@@ -22,8 -22,8 +22,9 @@@ struct bpf_reg_state * Used to determine if any memory access using this register will * result in a bad access. */ - u64 min_value, max_value; + s64 min_value; + u64 max_value; + u32 id; union { /* valid when type == CONST_IMM | PTR_TO_STACK | UNKNOWN_VALUE */ s64 imm; diff --cc kernel/bpf/verifier.c index 89f787ca47ef,6a936159c6e0..8740c5fa02fc --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@@ -229,13 -212,12 +229,13 @@@ static void print_verifier_state(struc else if (t == CONST_PTR_TO_MAP || t == PTR_TO_MAP_VALUE || t == PTR_TO_MAP_VALUE_OR_NULL || t == PTR_TO_MAP_VALUE_ADJ) - verbose("(ks=%d,vs=%d)", + verbose("(ks=%d,vs=%d,id=%u)", reg->map_ptr->key_size, - reg->map_ptr->value_size); + reg->map_ptr->value_size, + reg->id); if (reg->min_value != BPF_REGISTER_MIN_RANGE) - verbose(",min_value=%llu", - (unsigned long long)reg->min_value); + verbose(",min_value=%lld", + (long long)reg->min_value); if (reg->max_value != BPF_REGISTER_MAX_RANGE) verbose(",max_value=%llu", (unsigned long long)reg->max_value); @@@ -1498,7 -1477,9 +1499,8 @@@ static void adjust_reg_min_max_vals(str struct bpf_insn *insn) { struct bpf_reg_state *regs = env->cur_state.regs, *dst_reg; - u64 min_val = BPF_REGISTER_MIN_RANGE, max_val = BPF_REGISTER_MAX_RANGE; + s64 min_val = BPF_REGISTER_MIN_RANGE; + u64 max_val = BPF_REGISTER_MAX_RANGE; - bool min_set = false, max_set = false; u8 opcode = BPF_OP(insn->code); dst_reg = ®s[insn->dst_reg];