Skip to content
7 changes: 6 additions & 1 deletion drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3191,7 +3191,12 @@ static void fec_reset_phy(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
return;
}
msleep(msec);

if (msec > 20)
msleep(msec);
else
usleep_range(msec * 1000, msec * 1000 + 1000);

gpio_set_value_cansleep(phy_reset, !active_high);
}
#else /* CONFIG_OF */
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,10 +482,6 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
if (hdr->hdr.flags & VIRTIO_NET_HDR_F_DATA_VALID)
skb->ip_summed = CHECKSUM_UNNECESSARY;

skb->protocol = eth_type_trans(skb, dev);
pr_debug("Receiving skb proto 0x%04x len %i type %i\n",
ntohs(skb->protocol), skb->len, skb->pkt_type);

if (virtio_net_hdr_to_skb(skb, &hdr->hdr,
virtio_is_little_endian(vi->vdev))) {
net_warn_ratelimited("%s: bad gso: type: %u, size: %u\n",
Expand All @@ -494,6 +490,10 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
goto frame_err;
}

skb->protocol = eth_type_trans(skb, dev);
pr_debug("Receiving skb proto 0x%04x len %i type %i\n",
ntohs(skb->protocol), skb->len, skb->pkt_type);

napi_gro_receive(&rq->napi, skb);
return;

Expand Down
1 change: 0 additions & 1 deletion include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ void netdev_set_default_ethtool_ops(struct net_device *dev,
#define NET_XMIT_SUCCESS 0x00
#define NET_XMIT_DROP 0x01 /* skb dropped */
#define NET_XMIT_CN 0x02 /* congestion notification */
#define NET_XMIT_POLICED 0x03 /* skb is shot by police */
#define NET_XMIT_MASK 0x0f /* qdisc flags in net/sch_generic.h */

/* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It
Expand Down
2 changes: 0 additions & 2 deletions include/linux/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,6 @@ struct tcp_sock {

/* RTT measurement */
u32 srtt_us; /* smoothed round trip time << 3 in usecs */
u32 mdev_us; /* medium deviation */
u32 mdev_max_us; /* maximal mdev for the last rtt period */
u32 rttvar_us; /* smoothed mdev_max */
u32 rtt_seq; /* sequence number to update rttvar */
struct rtt_meas {
Expand Down
4 changes: 2 additions & 2 deletions include/net/pkt_sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ struct qdisc_watchdog {
};

void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc);
void qdisc_watchdog_schedule_ns(struct qdisc_watchdog *wd, u64 expires, bool throttle);
void qdisc_watchdog_schedule_ns(struct qdisc_watchdog *wd, u64 expires);

static inline void qdisc_watchdog_schedule(struct qdisc_watchdog *wd,
psched_time_t expires)
{
qdisc_watchdog_schedule_ns(wd, PSCHED_TICKS2NS(expires), true);
qdisc_watchdog_schedule_ns(wd, PSCHED_TICKS2NS(expires));
}

void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
Expand Down
16 changes: 0 additions & 16 deletions include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ struct qdisc_rate_table {
enum qdisc_state_t {
__QDISC_STATE_SCHED,
__QDISC_STATE_DEACTIVATED,
__QDISC_STATE_THROTTLED,
};

struct qdisc_size_table {
Expand Down Expand Up @@ -125,21 +124,6 @@ static inline int qdisc_avail_bulklimit(const struct netdev_queue *txq)
#endif
}

static inline bool qdisc_is_throttled(const struct Qdisc *qdisc)
{
return test_bit(__QDISC_STATE_THROTTLED, &qdisc->state) ? true : false;
}

static inline void qdisc_throttled(struct Qdisc *qdisc)
{
set_bit(__QDISC_STATE_THROTTLED, &qdisc->state);
}

static inline void qdisc_unthrottled(struct Qdisc *qdisc)
{
clear_bit(__QDISC_STATE_THROTTLED, &qdisc->state);
}

struct Qdisc_class_ops {
/* Child qdisc manipulation */
struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *);
Expand Down
13 changes: 8 additions & 5 deletions include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,6 @@ static inline void tcp_bound_rto(const struct sock *sk)
inet_csk(sk)->icsk_rto = TCP_RTO_MAX;
}

static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
{
return usecs_to_jiffies((tp->srtt_us >> 3) + tp->rttvar_us);
}

static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
{
tp->pred_flags = htonl((tp->tcp_header_len << 26) |
Expand Down Expand Up @@ -666,6 +661,14 @@ static inline u32 tcp_rto_min_us(struct sock *sk)
return jiffies_to_usecs(tcp_rto_min(sk));
}

static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
{
const u32 rttvar_floor = max(tp->rttvar_us,
tcp_rto_min_us((struct sock *)tp));

return usecs_to_jiffies((tp->srtt_us >> 3) + rttvar_floor);
}

static inline bool tcp_ca_dst_locked(const struct dst_entry *dst)
{
return dst_metric_locked(dst, RTAX_CC_ALGO);
Expand Down
2 changes: 1 addition & 1 deletion net/batman-adv/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
len + ETH_HLEN);

ret = NET_RX_SUCCESS;
} else if (res == NET_XMIT_POLICED) {
} else if (res == -EINPROGRESS) {
/* skb was buffered and consumed */
ret = NET_RX_SUCCESS;
}
Expand Down
4 changes: 2 additions & 2 deletions net/batman-adv/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int batadv_send_unicast_skb(struct sk_buff *skb,
* attempted.
*
* Return: NET_XMIT_SUCCESS on success, NET_XMIT_DROP on failure, or
* NET_XMIT_POLICED if the skb is buffered for later transmit.
* -EINPROGRESS if the skb is buffered for later transmit.
*/
int batadv_send_skb_to_orig(struct sk_buff *skb,
struct batadv_orig_node *orig_node,
Expand Down Expand Up @@ -188,7 +188,7 @@ int batadv_send_skb_to_orig(struct sk_buff *skb,
* network coding fails, then send the packet as usual.
*/
if (recv_if && batadv_nc_skb_forward(skb, neigh_node)) {
ret = NET_XMIT_POLICED;
ret = -EINPROGRESS;
} else {
batadv_send_unicast_skb(skb, neigh_node);
ret = NET_XMIT_SUCCESS;
Expand Down
1 change: 0 additions & 1 deletion net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -3463,7 +3463,6 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
break;
case NET_XMIT_DROP:
case NET_XMIT_CN:
case NET_XMIT_POLICED:
/* skb has been consumed */
pkt_dev->errors++;
break;
Expand Down
3 changes: 1 addition & 2 deletions net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ void tcp_init_sock(struct sock *sk)
INIT_LIST_HEAD(&tp->tsq_node);

icsk->icsk_rto = TCP_TIMEOUT_INIT;
tp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT);
tp->rtt_min[0].rtt = ~0U;

/* So many TCP implementations out there (incorrectly) count the
Expand Down Expand Up @@ -2703,7 +2702,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info)
info->tcpi_pmtu = icsk->icsk_pmtu_cookie;
info->tcpi_rcv_ssthresh = tp->rcv_ssthresh;
info->tcpi_rtt = tp->srtt_us >> 3;
info->tcpi_rttvar = tp->mdev_us >> 2;
info->tcpi_rttvar = tp->rttvar_us >> 2;
info->tcpi_snd_ssthresh = tp->snd_ssthresh;
info->tcpi_snd_cwnd = tp->snd_cwnd;
info->tcpi_advmss = tp->advmss;
Expand Down
61 changes: 10 additions & 51 deletions net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,7 @@ static void tcp_event_data_recv(struct sock *sk, struct sk_buff *skb)
/* Called to compute a smoothed rtt estimate. The data fed to this
* routine either comes from timestamps, or from segments that were
* known _not_ to have been retransmitted [see Karn/Partridge
* Proceedings SIGCOMM 87]. The algorithm is from the SIGCOMM 88
* piece by Van Jacobson.
* Proceedings SIGCOMM 87].
* NOTE: the next three routines used to be one big routine.
* To save cycles in the RFC 1323 implementation it was better to break
* it up into three procedures. -- erics
Expand All @@ -692,59 +691,19 @@ static void tcp_rtt_estimator(struct sock *sk, long mrtt_us)
long m = mrtt_us; /* RTT */
u32 srtt = tp->srtt_us;

/* The following amusing code comes from Jacobson's
* article in SIGCOMM '88. Note that rtt and mdev
* are scaled versions of rtt and mean deviation.
* This is designed to be as fast as possible
* m stands for "measurement".
*
* On a 1990 paper the rto value is changed to:
* RTO = rtt + 4 * mdev
*
* Funny. This algorithm seems to be very broken.
* These formulae increase RTO, when it should be decreased, increase
* too slowly, when it should be increased quickly, decrease too quickly
* etc. I guess in BSD RTO takes ONE value, so that it is absolutely
* does not matter how to _calculate_ it. Seems, it was trap
* that VJ failed to avoid. 8)
*/
if (srtt != 0) {
m -= (srtt >> 3); /* m is now error in rtt est */
srtt += m; /* rtt = 7/8 rtt + 1/8 new */
if (m < 0) {
m = -m; /* m is now abs(error) */
m -= (tp->mdev_us >> 2); /* similar update on mdev */
/* This is similar to one of Eifel findings.
* Eifel blocks mdev updates when rtt decreases.
* This solution is a bit different: we use finer gain
* for mdev in this case (alpha*beta).
* Like Eifel it also prevents growth of rto,
* but also it limits too fast rto decreases,
* happening in pure Eifel.
*/
if (m > 0)
m >>= 3;
} else {
m -= (tp->mdev_us >> 2); /* similar update on mdev */
}
tp->mdev_us += m; /* mdev = 3/4 mdev + 1/4 new */
if (tp->mdev_us > tp->mdev_max_us) {
tp->mdev_max_us = tp->mdev_us;
if (tp->mdev_max_us > tp->rttvar_us)
tp->rttvar_us = tp->mdev_max_us;
}
if (after(tp->snd_una, tp->rtt_seq)) {
if (tp->mdev_max_us < tp->rttvar_us)
tp->rttvar_us -= (tp->rttvar_us - tp->mdev_max_us) >> 2;
m -= (srtt >> 3); /* m' = m - srtt / 8 = (R' - SRTT) */
srtt += m; /* srtt = srtt + m’ = srtt + m - srtt / 8 */
if (m < 0)
m = -m;
m -= (tp->rttvar_us >> 2); /* m'' = |m'| - rttvar / 4 */
tp->rttvar_us += m;
if (after(tp->snd_una, tp->rtt_seq))
tp->rtt_seq = tp->snd_nxt;
tp->mdev_max_us = tcp_rto_min_us(sk);
}
} else {
/* no previous measure. */
srtt = m << 3; /* take the measured time to be rtt */
tp->mdev_us = m << 1; /* make sure rto = 3*rtt */
tp->rttvar_us = max(tp->mdev_us, tcp_rto_min_us(sk));
tp->mdev_max_us = tp->rttvar_us;
srtt = m << 3;
tp->rttvar_us = max_t(u32, m << 1, tcp_rto_min_us(sk));
tp->rtt_seq = tp->snd_nxt;
}
tp->srtt_us = max(1U, srtt);
Expand Down
5 changes: 2 additions & 3 deletions net/ipv4/tcp_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ void tcp_update_metrics(struct sock *sk)

/* Scale deviation to rttvar fixed point */
m >>= 1;
if (m < tp->mdev_us)
m = tp->mdev_us;
if (m < tp->rttvar_us)
m = tp->rttvar_us;

var = tcp_metric_get(tm, TCP_METRIC_RTTVAR);
if (m >= var)
Expand Down Expand Up @@ -561,7 +561,6 @@ void tcp_init_metrics(struct sock *sk)
* retransmission.
*/
tp->rttvar_us = jiffies_to_usecs(TCP_TIMEOUT_FALLBACK);
tp->mdev_us = tp->mdev_max_us = tp->rttvar_us;

inet_csk(sk)->icsk_rto = TCP_TIMEOUT_FALLBACK;
}
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/tcp_minisocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
tcp_init_wl(newtp, treq->rcv_isn);

newtp->srtt_us = 0;
newtp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT);
newtp->rtt_min[0].rtt = ~0U;
newicsk->icsk_rto = TCP_TIMEOUT_INIT;

Expand Down
4 changes: 3 additions & 1 deletion net/ipv6/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,14 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
else if (!fl6.flowi6_oif)
fl6.flowi6_oif = np->ucast_oif;

ipc6.tclass = np->tclass;
fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);

dst = icmpv6_route_lookup(net, skb, sk, &fl6);
if (IS_ERR(dst))
goto out;

ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);
ipc6.tclass = np->tclass;
ipc6.dontfrag = np->dontfrag;
ipc6.opt = NULL;

Expand Down
4 changes: 3 additions & 1 deletion net/ipv6/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
else if (!fl6.flowi6_oif)
fl6.flowi6_oif = np->ucast_oif;

ipc6.tclass = np->tclass;
fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);

dst = ip6_sk_dst_lookup_flow(sk, &fl6, daddr);
if (IS_ERR(dst))
return PTR_ERR(dst);
Expand All @@ -140,7 +143,6 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
pfh.family = AF_INET6;

ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);
ipc6.tclass = np->tclass;
ipc6.dontfrag = np->dontfrag;
ipc6.opt = NULL;

Expand Down
8 changes: 5 additions & 3 deletions net/ipv6/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,11 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (inet->hdrincl)
fl6.flowi6_flags |= FLOWI_FLAG_KNOWN_NH;

if (ipc6.tclass < 0)
ipc6.tclass = np->tclass;

fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);

dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
if (IS_ERR(dst)) {
err = PTR_ERR(dst);
Expand All @@ -886,9 +891,6 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (ipc6.hlimit < 0)
ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);

if (ipc6.tclass < 0)
ipc6.tclass = np->tclass;

if (ipc6.dontfrag < 0)
ipc6.dontfrag = np->dontfrag;

Expand Down
2 changes: 2 additions & 0 deletions net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -3306,6 +3306,8 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)

err = -EINVAL;
memset(&fl6, 0, sizeof(fl6));
rtm = nlmsg_data(nlh);
fl6.flowlabel = ip6_make_flowinfo(rtm->rtm_tos, 0);

if (tb[RTA_SRC]) {
if (nla_len(tb[RTA_SRC]) < sizeof(struct in6_addr))
Expand Down
8 changes: 5 additions & 3 deletions net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,11 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)

security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));

if (ipc6.tclass < 0)
ipc6.tclass = np->tclass;

fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);

dst = ip6_sk_dst_lookup_flow(sk, &fl6, final_p);
if (IS_ERR(dst)) {
err = PTR_ERR(dst);
Expand All @@ -1256,9 +1261,6 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (ipc6.hlimit < 0)
ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);

if (ipc6.tclass < 0)
ipc6.tclass = np->tclass;

if (msg->msg_flags&MSG_CONFIRM)
goto do_confirm;
back_from_confirm:
Expand Down
8 changes: 5 additions & 3 deletions net/l2tp/l2tp_ip6.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,11 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)

security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));

if (ipc6.tclass < 0)
ipc6.tclass = np->tclass;

fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);

dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
if (IS_ERR(dst)) {
err = PTR_ERR(dst);
Expand All @@ -620,9 +625,6 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (ipc6.hlimit < 0)
ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);

if (ipc6.tclass < 0)
ipc6.tclass = np->tclass;

if (ipc6.dontfrag < 0)
ipc6.dontfrag = np->dontfrag;

Expand Down
Loading