Skip to content

Commit d14d2b2

Browse files
vedangpatel1davem330
authored andcommitted
etf: Add skip_sock_check
Currently, etf expects a socket with SO_TXTIME option set for each packet it encounters. So, it will drop all other packets. But, in the future commits we are planning to add functionality where tstamp value will be set by another qdisc. Also, some packets which are generated from within the kernel (e.g. ICMP packets) do not have any socket associated with them. So, this commit adds support for skip_sock_check. When this option is set, etf will skip checking for a socket and other associated options for all skbs. Signed-off-by: Vedang Patel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9903c8d commit d14d2b2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

include/uapi/linux/pkt_sched.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,7 @@ struct tc_etf_qopt {
990990
__u32 flags;
991991
#define TC_ETF_DEADLINE_MODE_ON _BITUL(0)
992992
#define TC_ETF_OFFLOAD_ON _BITUL(1)
993+
#define TC_ETF_SKIP_SOCK_CHECK _BITUL(2)
993994
};
994995

995996
enum {

net/sched/sch_etf.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222

2323
#define DEADLINE_MODE_IS_ON(x) ((x)->flags & TC_ETF_DEADLINE_MODE_ON)
2424
#define OFFLOAD_IS_ON(x) ((x)->flags & TC_ETF_OFFLOAD_ON)
25+
#define SKIP_SOCK_CHECK_IS_SET(x) ((x)->flags & TC_ETF_SKIP_SOCK_CHECK)
2526

2627
struct etf_sched_data {
2728
bool offload;
2829
bool deadline_mode;
30+
bool skip_sock_check;
2931
int clockid;
3032
int queue;
3133
s32 delta; /* in ns */
@@ -77,6 +79,9 @@ static bool is_packet_valid(struct Qdisc *sch, struct sk_buff *nskb)
7779
struct sock *sk = nskb->sk;
7880
ktime_t now;
7981

82+
if (q->skip_sock_check)
83+
goto skip;
84+
8085
if (!sk)
8186
return false;
8287

@@ -92,6 +97,7 @@ static bool is_packet_valid(struct Qdisc *sch, struct sk_buff *nskb)
9297
if (sk->sk_txtime_deadline_mode != q->deadline_mode)
9398
return false;
9499

100+
skip:
95101
now = q->get_time();
96102
if (ktime_before(txtime, now) || ktime_before(txtime, q->last))
97103
return false;
@@ -385,6 +391,7 @@ static int etf_init(struct Qdisc *sch, struct nlattr *opt,
385391
q->clockid = qopt->clockid;
386392
q->offload = OFFLOAD_IS_ON(qopt);
387393
q->deadline_mode = DEADLINE_MODE_IS_ON(qopt);
394+
q->skip_sock_check = SKIP_SOCK_CHECK_IS_SET(qopt);
388395

389396
switch (q->clockid) {
390397
case CLOCK_REALTIME:
@@ -473,6 +480,9 @@ static int etf_dump(struct Qdisc *sch, struct sk_buff *skb)
473480
if (q->deadline_mode)
474481
opt.flags |= TC_ETF_DEADLINE_MODE_ON;
475482

483+
if (q->skip_sock_check)
484+
opt.flags |= TC_ETF_SKIP_SOCK_CHECK;
485+
476486
if (nla_put(skb, TCA_ETF_PARMS, sizeof(opt), &opt))
477487
goto nla_put_failure;
478488

0 commit comments

Comments
 (0)