-
Notifications
You must be signed in to change notification settings - Fork 4
/
linux-uek5-rds.patch
1474 lines (1411 loc) · 55 KB
/
linux-uek5-rds.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
From f5dd19c7af99c47c3eeacc63e1e42f96cf753727 Mon Sep 17 00:00:00 2001
From: Dongli Zhang <[email protected]>
Date: Wed, 25 Dec 2019 10:15:43 -0800
Subject: [PATCH 1/1] linux uek5 rds
v4.14.35-1902.8.1
Signed-off-by: Dongli Zhang <[email protected]>
Signed-off-by: Dongli Zhang <[email protected]>
---
drivers/infiniband/core/cma.c | 14 +
drivers/infiniband/core/core_priv.h | 5 +
drivers/infiniband/core/cq.c | 4 +
drivers/infiniband/core/verbs.c | 17 ++
drivers/infiniband/hw/mlx4/cq.c | 13 +
drivers/infiniband/hw/mlx4/qp.c | 64 ++++
drivers/net/ethernet/mellanox/mlx4/cq.c | 21 ++
drivers/net/ethernet/mellanox/mlx4/eq.c | 10 +
include/rdma/ib_verbs.h | 18 ++
net/netfilter/xt_hl.c | 171 ++++++++---
net/netfilter/xt_tcpmss.c | 383 +++++++++++++++++++-----
net/rds/ib.h | 6 +
net/rds/ib_cm.c | 20 ++
net/rds/ib_ring.c | 7 +
net/rds/ib_send.c | 12 +
net/rds/message.c | 7 +
net/rds/rds.h | 56 ++++
net/rds/send.c | 115 +++++++
net/rds/threads.c | 16 +
19 files changed, 840 insertions(+), 119 deletions(-)
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 008ae7249435..24521e78bbda 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -896,6 +896,20 @@ static int cma_init_conn_qp(struct rdma_id_private *id_priv, struct ib_qp *qp)
return ib_modify_qp(qp, &qp_attr, qp_attr_mask);
}
+/*
+ * called by:
+ * - drivers/infiniband/ulp/iser/iser_verbs.c|478| <<iser_create_ib_conn_res>> ret = rdma_create_qp(ib_conn->cma_id, device->pd, &init_attr);
+ * - drivers/infiniband/ulp/isert/ib_isert.c|146| <<isert_create_qp>> ret = rdma_create_qp(cma_id, device->pd, &attr);
+ * - drivers/nvme/host/rdma.c|265| <<nvme_rdma_create_qp>> ret = rdma_create_qp(queue->cm_id, dev->pd, &init_attr);
+ * - drivers/nvme/target/rdma.c|979| <<nvmet_rdma_create_queue_ib>> ret = rdma_create_qp(queue->cm_id, ndev->pd, &qp_attr);
+ * - drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c|770| <<kiblnd_create_conn>> rc = rdma_create_qp(cmid, conn->ibc_hdev->ibh_pd, init_qp_attr);
+ * - net/9p/trans_rdma.c|726| <<rdma_create_trans>> err = rdma_create_qp(rdma->cm_id, rdma->pd, &qp_attr);
+ * - net/rds/ib_cm.c|910| <<rds_ib_setup_qp>> ret = rdma_create_qp(ic->i_cm_id, ic->i_pd, &qp_attr);
+ * - net/sunrpc/xprtrdma/svc_rdma_transport.c|816| <<svc_rdma_accept>> ret = rdma_create_qp(newxprt->sc_cm_id, newxprt->sc_pd, &qp_attr);
+ * - net/sunrpc/xprtrdma/verbs.c|693| <<rpcrdma_ep_recreate_xprt>> err = rdma_create_qp(ia->ri_id, ia->ri_pd, &ep->rep_attr);
+ * - net/sunrpc/xprtrdma/verbs.c|742| <<rpcrdma_ep_reconnect>> err = rdma_create_qp(id, ia->ri_pd, &ep->rep_attr);
+ * - net/sunrpc/xprtrdma/verbs.c|776| <<rpcrdma_ep_connect>> rc = rdma_create_qp(ia->ri_id, ia->ri_pd, &ep->rep_attr);
+ */
int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd,
struct ib_qp_init_attr *qp_init_attr)
{
diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
index 022faae16e8f..c88f16ff66f0 100644
--- a/drivers/infiniband/core/core_priv.h
+++ b/drivers/infiniband/core/core_priv.h
@@ -324,6 +324,11 @@ struct ib_device *ib_device_get_by_index(u32 ifindex);
void nldev_init(void);
void nldev_exit(void);
+/*
+ * called by:
+ * - drivers/infiniband/core/uverbs_cmd.c|2200| <<_ib_create_qp>> qp = _ib_create_qp(device, pd, &attr, uhw,
+ * - drivers/infiniband/core/verbs.c|881| <<ib_create_qp>> qp = _ib_create_qp(device, pd, qp_init_attr, NULL, NULL);
+ */
static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
struct ib_pd *pd,
struct ib_qp_init_attr *attr,
diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c
index af5ad6a56ae4..8af4c4e81b84 100644
--- a/drivers/infiniband/core/cq.c
+++ b/drivers/infiniband/core/cq.c
@@ -134,6 +134,10 @@ static void ib_cq_completion_workqueue(struct ib_cq *cq, void *private)
* specified context. The ULP must use wr->wr_cqe instead of wr->wr_id
* to use this CQ abstraction.
*/
+/*
+ * called by:
+ * - include/rdma/ib_verbs.h|3478| <<ib_alloc_cq>> __ib_alloc_cq((device), (priv), (nr_cqe), (comp_vect), (poll_ctx), KBUILD_MODNAME)
+ */
struct ib_cq *__ib_alloc_cq(struct ib_device *dev, void *private,
int nr_cqe, int comp_vector,
enum ib_poll_context poll_ctx, const char *caller)
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index b75a783e3057..136e76ca01a6 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -856,6 +856,23 @@ static struct ib_qp *ib_create_xrc_qp(struct ib_qp *qp,
return qp;
}
+/*
+ * called by:
+ * - drivers/infiniband/core/cma.c|911| <<rdma_create_qp>> qp = ib_create_qp(pd, qp_init_attr);
+ * - drivers/infiniband/core/mad.c|3137| <<create_mad_qp>> qp_info->qp = ib_create_qp(qp_info->port_priv->pd, &qp_init_attr);
+ * - drivers/infiniband/core/uverbs_cmd.c|2198| <<create_mad_qp>> qp = ib_create_qp(pd, &attr);
+ * - drivers/infiniband/hw/mlx4/mad.c|1837| <<create_pv_sqp>> tun_qp->qp = ib_create_qp(ctx->pd, &qp_init_attr.init_attr);
+ * - drivers/infiniband/hw/mlx4/qp.c|1577| <<mlx4_ib_create_qp>> sqp->roce_v2_gsi = ib_create_qp(pd, init_attr);
+ * - drivers/infiniband/hw/mlx5/gsi.c|187| <<mlx5_ib_gsi_create_qp>> gsi->rx_qp = ib_create_qp(pd, &hw_init_attr);
+ * - drivers/infiniband/hw/mlx5/gsi.c|269| <<create_gsi_ud_qp>> return ib_create_qp(pd, &init_attr);
+ * - drivers/infiniband/ulp/ipoib/ipoib_cm.c|273| <<ipoib_cm_create_rx_qp>> return ib_create_qp(priv->pd, &attr);
+ * - drivers/infiniband/ulp/ipoib/ipoib_cm.c|1104| <<ipoib_cm_create_tx_qp>> tx_qp = ib_create_qp(priv->pd, &attr);
+ * - drivers/infiniband/ulp/ipoib/ipoib_verbs.c|205| <<ipoib_transport_dev_init>> priv->qp = ib_create_qp(priv->pd, &init_attr);
+ * - drivers/infiniband/ulp/srp/ib_srp.c|527| <<srp_create_ch_ib>> qp = ib_create_qp(dev->pd, init_attr);
+ * - drivers/infiniband/ulp/srpt/ib_srpt.c|1661| <<srpt_create_ch_ib>> ch->qp = ib_create_qp(sdev->pd, qp_init);
+ * - net/rds/ib_cm.c|1853| <<rds_ib_setup_fastreg>> rds_ibdev->fastreg_qp = ib_create_qp(rds_ibdev->pd, &qp_init_attr);
+ * - net/smc/smc_ib.c|251| <<smc_ib_create_queue_pair>> lnk->roce_qp = ib_create_qp(lnk->roce_pd, &qp_attr);
+ */
struct ib_qp *ib_create_qp(struct ib_pd *pd,
struct ib_qp_init_attr *qp_init_attr)
{
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index 0f94287822a3..823b90556216 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -171,6 +171,19 @@ static int mlx4_ib_get_cq_umem(struct mlx4_ib_dev *dev, struct ib_ucontext *cont
}
#define CQ_CREATE_FLAGS_SUPPORTED IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION
+/*
+ * used by:
+ * - drivers/infiniband/hw/mlx4/main.c|2916| <<mlx4_ib_add>> ibdev->ib_dev.create_cq = mlx4_ib_create_cq
+ *
+ * called by:
+ * - drivers/infiniband/core/cq.c|148| <<__ib_alloc_cq>> cq = dev->create_cq(dev, &cq_attr, NULL, NULL);
+ * - drivers/infiniband/core/uverbs_cmd.c|1704| <<__ib_alloc_cq>> cq = ib_dev->create_cq(ib_dev, &attr, obj->uobject.context, uhw);
+ * - drivers/infiniband/core/uverbs_cmd.c|1791| <<ib_uverbs_create_cq>> obj = create_cq(file, &ucore, &uhw, &cmd_ex,
+ * - drivers/infiniband/core/uverbs_cmd.c|1839| <<ib_uverbs_ex_create_cq>> obj = create_cq(file, ucore, uhw, &cmd,
+ * - drivers/infiniband/core/uverbs_std_types_cq.c|117| <<UVERBS_HANDLER>> cq = ib_dev->create_cq(ib_dev, &attr, obj->uobject.context, &uhw);
+ * - drivers/infiniband/core/verbs.c|1551| <<UVERBS_HANDLER>> cq = device->create_cq(device, cq_attr, NULL, NULL);
+ * - drivers/infiniband/hw/cxgb4/cq.c|960| <<c4iw_create_cq>> ret = create_cq(&rhp->rdev, &chp->cq,
+ */
struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev,
const struct ib_cq_init_attr *attr,
struct ib_ucontext *context,
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 8d346cb407e5..5bfd359fa256 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -841,6 +841,25 @@ static void mlx4_ib_release_wqn(struct mlx4_ib_ucontext *context,
mutex_unlock(&context->wqn_ranges_mutex);
}
+/*
+ * [0] mlx4_ib_create_qp [mlx4_ib]
+ * [0] ib_create_qp [ib_core]
+ * [0] rdma_create_qp [rdma_cm]
+ * [0] rds_ib_setup_qp [rds_rdma]
+ * [0] rds_ib_cm_initiate_connect [rds_rdma]
+ * [0] rds_rdma_cm_event_handler_cmn [rds_rdma]
+ * [0] rds_rdma_cm_event_handler [rds_rdma]
+ * [0] cma_work_handler [rdma_cm]
+ * [0] process_one_work
+ * [0] worker_thread
+ * [0] kthread
+ * [0] ret_from_fork
+ *
+ * called by:
+ * - drivers/infiniband/hw/mlx4/qp.c|1490| <<_mlx4_ib_create_qp>> err = create_qp_common(to_mdev(pd->device), pd, MLX4_IB_QP_SRC,
+ * - drivers/infiniband/hw/mlx4/qp.c|1521| <<_mlx4_ib_create_qp>> err = create_qp_common(to_mdev(pd->device), pd, MLX4_IB_QP_SRC,
+ * - drivers/infiniband/hw/mlx4/qp.c|4115| <<mlx4_ib_create_wq>> err = create_qp_common(dev, pd, MLX4_IB_RWQ_SRC, &ib_qp_init_attr,
+ */
static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
enum mlx4_ib_source_type src,
struct ib_qp_init_attr *init_attr,
@@ -1421,6 +1440,10 @@ static u32 get_sqp_num(struct mlx4_ib_dev *dev, struct ib_qp_init_attr *attr)
return dev->dev->caps.spec_qps[attr->port_num - 1].qp1_proxy;
}
+/*
+ * called by:
+ * - drivers/infiniband/hw/mlx4/qp.c|1546| <<mlx4_ib_create_qp>> ibqp = _mlx4_ib_create_qp(pd, init_attr, udata);
+ */
static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
struct ib_qp_init_attr *init_attr,
struct ib_udata *udata)
@@ -1536,6 +1559,47 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
return &qp->ibqp;
}
+/*
+ * [0] mlx4_ib_create_qp [mlx4_ib]
+ * [0] ib_create_qp [ib_core]
+ * [0] rdma_create_qp [rdma_cm]
+ * [0] rds_ib_setup_qp [rds_rdma]
+ * [0] rds_ib_cm_initiate_connect [rds_rdma]
+ * [0] rds_rdma_cm_event_handler_cmn [rds_rdma]
+ * [0] rds_rdma_cm_event_handler [rds_rdma]
+ * [0] cma_work_handler [rdma_cm]
+ * [0] process_one_work
+ * [0] worker_thread
+ * [0] kthread
+ * [0] ret_from_fork
+ *
+ * 其他创建qp的例子:
+ * [0] mlx4_ib_create_qp [mlx4_ib]
+ * [0] ib_create_qp [ib_core]
+ * [0] rdma_create_qp [rdma_cm]
+ * [0] rds_ib_setup_qp [rds_rdma]
+ * [0] rds_ib_cm_handle_connect [rds_rdma]
+ * [0] rds_rdma_cm_event_handler_cmn [rds_rdma]
+ * [0] rds_rdma_cm_event_handler [rds_rdma]
+ * [0] cma_listen_handler [rdma_cm]
+ * [0] cma_req_handler [rdma_cm]
+ * [0] cm_process_work [ib_cm]
+ * [0] cm_req_handler [ib_cm]
+ * [0] cm_work_handler [ib_cm]
+ * [0] process_one_work
+ * [0] worker_thread
+ * [0] kthread
+ * [0] ret_from_fork
+ *
+ * used by:
+ * - drivers/infiniband/hw/mlx4/main.c|2910| <<mlx4_ib_add>> ibdev->ib_dev.create_qp = mlx4_ib_create_qp;
+ *
+ * called by:
+ * - drivers/infiniband/core/core_priv.h|338| <<_ib_create_qp>> qp = dev->create_qp(pd, attr, udata);
+ * - drivers/infiniband/core/uverbs_cmd.c|2345| <<ib_uverbs_create_qp>> err = create_qp(file, &ucore, &uhw, &cmd_ex,
+ * - drivers/infiniband/core/uverbs_cmd.c|2392| <<ib_uverbs_ex_create_qp>> err = create_qp(file, ucore, uhw, &cmd,
+ * - drivers/infiniband/hw/cxgb4/qp.c|1895| <<c4iw_create_qp>> ret = create_qp(&rhp->rdev, &qhp->wq, &schp->cq, &rchp->cq,
+ */
struct ib_qp *mlx4_ib_create_qp(struct ib_pd *pd,
struct ib_qp_init_attr *init_attr,
struct ib_udata *udata) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c
index b80214e75599..9e492c839595 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cq.c
@@ -101,6 +101,19 @@ static void mlx4_add_cq_to_tasklet(struct mlx4_cq *cq)
spin_unlock_irqrestore(&tasklet_ctx->lock, flags);
}
+/*
+ * [0] mlx4_ib_cq_comp [mlx4_ib]
+ * [0] mlx4_cq_completion [mlx4_core]
+ * [0] mlx4_eq_int [mlx4_core]
+ * [0] mlx4_msi_x_interrupt [mlx4_core]
+ * [0] __handle_irq_event_percpu
+ * [0] handle_irq_event_percpu
+ * [0] handle_irq_event
+ * [0] handle_edge_irq
+ * [0] handle_irq
+ * [0] do_IRQ
+ * [0] common_interrupt
+ */
void mlx4_cq_completion(struct mlx4_dev *dev, u32 cqn)
{
struct mlx4_cq *cq;
@@ -120,6 +133,9 @@ void mlx4_cq_completion(struct mlx4_dev *dev, u32 cqn)
*/
++cq->arm_sn;
+ /*
+ * 对于ib的mlx4_ib_cq_comp [mlx4_ib]
+ */
cq->comp(cq);
}
@@ -287,6 +303,11 @@ static void mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn)
__mlx4_cq_free_icm(dev, cqn);
}
+/*
+ * called by:
+ * - drivers/infiniband/hw/mlx4/cq.c|253| <<mlx4_ib_create_cq>> err = mlx4_cq_alloc(dev->dev, entries, &cq->buf.mtt, uar,
+ * - drivers/net/ethernet/mellanox/mlx4/en_cq.c|144| <<mlx4_en_activate_cq>> err = mlx4_cq_alloc(mdev->dev, cq->size, &cq->wqres.mtt,
+ */
int mlx4_cq_alloc(struct mlx4_dev *dev, int nent,
struct mlx4_mtt *mtt, struct mlx4_uar *uar, u64 db_rec,
struct mlx4_cq *cq, unsigned vector, int collapsed,
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index ac40f26a0b17..1cffcfdbd461 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -490,6 +490,11 @@ void mlx4_master_handle_slave_flr(struct work_struct *work)
}
}
+/*
+ * called by:
+ * - drivers/net/ethernet/mellanox/mlx4/eq.c|856| <<mlx4_interrupt>> work |= mlx4_eq_int(dev, &priv->eq_table.eq[i]);
+ * - drivers/net/ethernet/mellanox/mlx4/eq.c|866| <<mlx4_msi_x_interrupt>> mlx4_eq_int(dev, eq);
+ */
static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
{
struct mlx4_priv *priv = mlx4_priv(dev);
@@ -1449,6 +1454,11 @@ struct cpu_rmap *mlx4_get_cpu_rmap(struct mlx4_dev *dev, int port)
}
EXPORT_SYMBOL(mlx4_get_cpu_rmap);
+/*
+ * called by:
+ * - drivers/infiniband/hw/mlx4/main.c|2582| <<mlx4_ib_alloc_eqs>> if (!mlx4_assign_eq(dev, i,
+ * - drivers/net/ethernet/mellanox/mlx4/en_cq.c|112| <<mlx4_en_activate_cq>> err = mlx4_assign_eq(mdev->dev, priv->port,
+ */
int mlx4_assign_eq(struct mlx4_dev *dev, u8 port, int *vector)
{
struct mlx4_priv *priv = mlx4_priv(dev);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 2d8f287813ab..5a8b7d8f55c9 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -3474,6 +3474,24 @@ static inline int ib_post_recv(struct ib_qp *qp,
struct ib_cq *__ib_alloc_cq(struct ib_device *dev, void *private,
int nr_cqe, int comp_vector,
enum ib_poll_context poll_ctx, const char *caller);
+/*
+ * called by:
+ * - drivers/infiniband/core/mad.c|3199| <<ib_mad_port_open>> port_priv->cq = ib_alloc_cq(port_priv->device, port_priv, cq_size, 0,
+ * - drivers/infiniband/hw/mlx5/gsi.c|171| <<mlx5_ib_gsi_create_qp>> gsi->cq = ib_alloc_cq(pd->device, gsi, init_attr->cap.max_send_wr, 0,
+ * - drivers/infiniband/hw/mlx5/main.c|3241| <<create_umr_res>> cq = ib_alloc_cq(&dev->ib_dev, NULL, 128, 0, IB_POLL_SOFTIRQ);
+ * - drivers/infiniband/ulp/iser/iser_verbs.c|99| <<iser_create_device_ib_res>> comp->cq = ib_alloc_cq(ib_dev, comp, max_cqe, i,
+ * - drivers/infiniband/ulp/isert/ib_isert.c|279| <<isert_alloc_comps>> comp->cq = ib_alloc_cq(device->ib_device, comp, max_cqe, i,
+ * - drivers/infiniband/ulp/srp/ib_srp.c|503| <<srp_create_ch_ib>> recv_cq = ib_alloc_cq(dev->dev, ch, target->queue_size + 1,
+ * - drivers/infiniband/ulp/srp/ib_srp.c|510| <<srp_create_ch_ib>> send_cq = ib_alloc_cq(dev->dev, ch, m * target->queue_size,
+ * - drivers/infiniband/ulp/srpt/ib_srpt.c|1632| <<srpt_create_ch_ib>> ch->cq = ib_alloc_cq(sdev->device, ch, ch->rq_size + srp_sq_size,
+ * - drivers/nvme/host/rdma.c|448| <<nvme_rdma_create_queue_ib>> queue->ib_cq = ib_alloc_cq(ibdev, queue,
+ * - drivers/nvme/target/rdma.c|948| <<nvmet_rdma_create_queue_ib>> queue->cq = ib_alloc_cq(ndev->device, queue,
+ * - net/9p/trans_rdma.c|703| <<rdma_create_trans>> rdma->cq = ib_alloc_cq(rdma->cm_id->device, client,
+ * - net/sunrpc/xprtrdma/svc_rdma_transport.c|783| <<svc_rdma_accept>> newxprt->sc_sq_cq = ib_alloc_cq(dev, newxprt, newxprt->sc_sq_depth,
+ * - net/sunrpc/xprtrdma/svc_rdma_transport.c|789| <<svc_rdma_accept>> newxprt->sc_rq_cq = ib_alloc_cq(dev, newxprt, newxprt->sc_rq_depth,
+ * - net/sunrpc/xprtrdma/verbs.c|577| <<rpcrdma_ep_create>> sendcq = ib_alloc_cq(ia->ri_device, NULL,
+ * - net/sunrpc/xprtrdma/verbs.c|587| <<rpcrdma_ep_create>> recvcq = ib_alloc_cq(ia->ri_device, NULL,
+ */
#define ib_alloc_cq(device, priv, nr_cqe, comp_vect, poll_ctx) \
__ib_alloc_cq((device), (priv), (nr_cqe), (comp_vect), (poll_ctx), KBUILD_MODNAME)
diff --git a/net/netfilter/xt_hl.c b/net/netfilter/xt_hl.c
index 003951149c9e..1535e87ed9bd 100644
--- a/net/netfilter/xt_hl.c
+++ b/net/netfilter/xt_hl.c
@@ -1,96 +1,169 @@
/*
- * IP tables module for matching the value of the TTL
- * (C) 2000,2001 by Harald Welte <[email protected]>
+ * TTL modification target for IP tables
+ * (C) 2000,2005 by Harald Welte <[email protected]>
*
- * Hop Limit matching module
- * (C) 2001-2002 Maciej Soltysiak <[email protected]>
+ * Hop Limit modification target for ip6tables
+ * Maciej Soltysiak <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-
-#include <linux/ip.h>
-#include <linux/ipv6.h>
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <net/checksum.h>
#include <linux/netfilter/x_tables.h>
-#include <linux/netfilter_ipv4/ipt_ttl.h>
-#include <linux/netfilter_ipv6/ip6t_hl.h>
+#include <linux/netfilter_ipv4/ipt_TTL.h>
+#include <linux/netfilter_ipv6/ip6t_HL.h>
+MODULE_AUTHOR("Harald Welte <[email protected]>");
MODULE_AUTHOR("Maciej Soltysiak <[email protected]>");
-MODULE_DESCRIPTION("Xtables: Hoplimit/TTL field match");
+MODULE_DESCRIPTION("Xtables: Hoplimit/TTL Limit field modification target");
MODULE_LICENSE("GPL");
-MODULE_ALIAS("ipt_ttl");
-MODULE_ALIAS("ip6t_hl");
-static bool ttl_mt(const struct sk_buff *skb, struct xt_action_param *par)
+static unsigned int
+ttl_tg(struct sk_buff *skb, const struct xt_action_param *par)
{
- const struct ipt_ttl_info *info = par->matchinfo;
- const u8 ttl = ip_hdr(skb)->ttl;
+ struct iphdr *iph;
+ const struct ipt_TTL_info *info = par->targinfo;
+ int new_ttl;
+
+ if (!skb_make_writable(skb, skb->len))
+ return NF_DROP;
+
+ iph = ip_hdr(skb);
switch (info->mode) {
- case IPT_TTL_EQ:
- return ttl == info->ttl;
- case IPT_TTL_NE:
- return ttl != info->ttl;
- case IPT_TTL_LT:
- return ttl < info->ttl;
- case IPT_TTL_GT:
- return ttl > info->ttl;
+ case IPT_TTL_SET:
+ new_ttl = info->ttl;
+ break;
+ case IPT_TTL_INC:
+ new_ttl = iph->ttl + info->ttl;
+ if (new_ttl > 255)
+ new_ttl = 255;
+ break;
+ case IPT_TTL_DEC:
+ new_ttl = iph->ttl - info->ttl;
+ if (new_ttl < 0)
+ new_ttl = 0;
+ break;
+ default:
+ new_ttl = iph->ttl;
+ break;
+ }
+
+ if (new_ttl != iph->ttl) {
+ csum_replace2(&iph->check, htons(iph->ttl << 8),
+ htons(new_ttl << 8));
+ iph->ttl = new_ttl;
}
- return false;
+ return XT_CONTINUE;
}
-static bool hl_mt6(const struct sk_buff *skb, struct xt_action_param *par)
+static unsigned int
+hl_tg6(struct sk_buff *skb, const struct xt_action_param *par)
{
- const struct ip6t_hl_info *info = par->matchinfo;
- const struct ipv6hdr *ip6h = ipv6_hdr(skb);
+ struct ipv6hdr *ip6h;
+ const struct ip6t_HL_info *info = par->targinfo;
+ int new_hl;
+
+ if (!skb_make_writable(skb, skb->len))
+ return NF_DROP;
+
+ ip6h = ipv6_hdr(skb);
switch (info->mode) {
- case IP6T_HL_EQ:
- return ip6h->hop_limit == info->hop_limit;
- case IP6T_HL_NE:
- return ip6h->hop_limit != info->hop_limit;
- case IP6T_HL_LT:
- return ip6h->hop_limit < info->hop_limit;
- case IP6T_HL_GT:
- return ip6h->hop_limit > info->hop_limit;
+ case IP6T_HL_SET:
+ new_hl = info->hop_limit;
+ break;
+ case IP6T_HL_INC:
+ new_hl = ip6h->hop_limit + info->hop_limit;
+ if (new_hl > 255)
+ new_hl = 255;
+ break;
+ case IP6T_HL_DEC:
+ new_hl = ip6h->hop_limit - info->hop_limit;
+ if (new_hl < 0)
+ new_hl = 0;
+ break;
+ default:
+ new_hl = ip6h->hop_limit;
+ break;
}
- return false;
+ ip6h->hop_limit = new_hl;
+
+ return XT_CONTINUE;
+}
+
+static int ttl_tg_check(const struct xt_tgchk_param *par)
+{
+ const struct ipt_TTL_info *info = par->targinfo;
+
+ if (info->mode > IPT_TTL_MAXMODE) {
+ pr_info("TTL: invalid or unknown mode %u\n", info->mode);
+ return -EINVAL;
+ }
+ if (info->mode != IPT_TTL_SET && info->ttl == 0)
+ return -EINVAL;
+ return 0;
+}
+
+static int hl_tg6_check(const struct xt_tgchk_param *par)
+{
+ const struct ip6t_HL_info *info = par->targinfo;
+
+ if (info->mode > IP6T_HL_MAXMODE) {
+ pr_info("invalid or unknown mode %u\n", info->mode);
+ return -EINVAL;
+ }
+ if (info->mode != IP6T_HL_SET && info->hop_limit == 0) {
+ pr_info("increment/decrement does not "
+ "make sense with value 0\n");
+ return -EINVAL;
+ }
+ return 0;
}
-static struct xt_match hl_mt_reg[] __read_mostly = {
+static struct xt_target hl_tg_reg[] __read_mostly = {
{
- .name = "ttl",
+ .name = "TTL",
.revision = 0,
.family = NFPROTO_IPV4,
- .match = ttl_mt,
- .matchsize = sizeof(struct ipt_ttl_info),
+ .target = ttl_tg,
+ .targetsize = sizeof(struct ipt_TTL_info),
+ .table = "mangle",
+ .checkentry = ttl_tg_check,
.me = THIS_MODULE,
},
{
- .name = "hl",
+ .name = "HL",
.revision = 0,
.family = NFPROTO_IPV6,
- .match = hl_mt6,
- .matchsize = sizeof(struct ip6t_hl_info),
+ .target = hl_tg6,
+ .targetsize = sizeof(struct ip6t_HL_info),
+ .table = "mangle",
+ .checkentry = hl_tg6_check,
.me = THIS_MODULE,
},
};
-static int __init hl_mt_init(void)
+static int __init hl_tg_init(void)
{
- return xt_register_matches(hl_mt_reg, ARRAY_SIZE(hl_mt_reg));
+ return xt_register_targets(hl_tg_reg, ARRAY_SIZE(hl_tg_reg));
}
-static void __exit hl_mt_exit(void)
+static void __exit hl_tg_exit(void)
{
- xt_unregister_matches(hl_mt_reg, ARRAY_SIZE(hl_mt_reg));
+ xt_unregister_targets(hl_tg_reg, ARRAY_SIZE(hl_tg_reg));
}
-module_init(hl_mt_init);
-module_exit(hl_mt_exit);
+module_init(hl_tg_init);
+module_exit(hl_tg_exit);
+MODULE_ALIAS("ipt_TTL");
+MODULE_ALIAS("ip6t_HL");
diff --git a/net/netfilter/xt_tcpmss.c b/net/netfilter/xt_tcpmss.c
index c53d4d18eadf..9dae4d665965 100644
--- a/net/netfilter/xt_tcpmss.c
+++ b/net/netfilter/xt_tcpmss.c
@@ -1,110 +1,353 @@
-/* Kernel module to match TCP MSS values. */
-
-/* Copyright (C) 2000 Marc Boucher <[email protected]>
- * Portions (C) 2005 by Harald Welte <[email protected]>
+/*
+ * This is a module which is used for setting the MSS option in TCP packets.
+ *
+ * Copyright (C) 2000 Marc Boucher <[email protected]>
+ * Copyright (C) 2007 Patrick McHardy <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
+#include <linux/ip.h>
+#include <linux/gfp.h>
+#include <linux/ipv6.h>
+#include <linux/tcp.h>
+#include <net/dst.h>
+#include <net/flow.h>
+#include <net/ipv6.h>
+#include <net/route.h>
#include <net/tcp.h>
-#include <linux/netfilter/xt_tcpmss.h>
-#include <linux/netfilter/x_tables.h>
-
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv6/ip6_tables.h>
+#include <linux/netfilter/x_tables.h>
+#include <linux/netfilter/xt_tcpudp.h>
+#include <linux/netfilter/xt_TCPMSS.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Marc Boucher <[email protected]>");
-MODULE_DESCRIPTION("Xtables: TCP MSS match");
-MODULE_ALIAS("ipt_tcpmss");
-MODULE_ALIAS("ip6t_tcpmss");
+MODULE_DESCRIPTION("Xtables: TCP Maximum Segment Size (MSS) adjustment");
+MODULE_ALIAS("ipt_TCPMSS");
+MODULE_ALIAS("ip6t_TCPMSS");
+
+static inline unsigned int
+optlen(const u_int8_t *opt, unsigned int offset)
+{
+ /* Beware zero-length options: make finite progress */
+ if (opt[offset] <= TCPOPT_NOP || opt[offset+1] == 0)
+ return 1;
+ else
+ return opt[offset+1];
+}
+
+static u_int32_t tcpmss_reverse_mtu(struct net *net,
+ const struct sk_buff *skb,
+ unsigned int family)
+{
+ struct flowi fl;
+ const struct nf_afinfo *ai;
+ struct rtable *rt = NULL;
+ u_int32_t mtu = ~0U;
+
+ if (family == PF_INET) {
+ struct flowi4 *fl4 = &fl.u.ip4;
+ memset(fl4, 0, sizeof(*fl4));
+ fl4->daddr = ip_hdr(skb)->saddr;
+ } else {
+ struct flowi6 *fl6 = &fl.u.ip6;
+
+ memset(fl6, 0, sizeof(*fl6));
+ fl6->daddr = ipv6_hdr(skb)->saddr;
+ }
+ ai = nf_get_afinfo(family);
+ if (ai != NULL)
+ ai->route(net, (struct dst_entry **)&rt, &fl, false);
+
+ if (rt != NULL) {
+ mtu = dst_mtu(&rt->dst);
+ dst_release(&rt->dst);
+ }
+ return mtu;
+}
-static bool
-tcpmss_mt(const struct sk_buff *skb, struct xt_action_param *par)
+static int
+tcpmss_mangle_packet(struct sk_buff *skb,
+ const struct xt_action_param *par,
+ unsigned int family,
+ unsigned int tcphoff,
+ unsigned int minlen)
{
- const struct xt_tcpmss_match_info *info = par->matchinfo;
- const struct tcphdr *th;
- struct tcphdr _tcph;
- /* tcp.doff is only 4 bits, ie. max 15 * 4 bytes */
- const u_int8_t *op;
- u8 _opt[15 * 4 - sizeof(_tcph)];
- unsigned int i, optlen;
-
- /* If we don't have the whole header, drop packet. */
- th = skb_header_pointer(skb, par->thoff, sizeof(_tcph), &_tcph);
- if (th == NULL)
- goto dropit;
-
- /* Malformed. */
- if (th->doff*4 < sizeof(*th))
- goto dropit;
-
- optlen = th->doff*4 - sizeof(*th);
- if (!optlen)
- goto out;
-
- /* Truncated options. */
- op = skb_header_pointer(skb, par->thoff + sizeof(*th), optlen, _opt);
- if (op == NULL)
- goto dropit;
-
- for (i = 0; i < optlen; ) {
- if (op[i] == TCPOPT_MSS
- && (optlen - i) >= TCPOLEN_MSS
- && op[i+1] == TCPOLEN_MSS) {
- u_int16_t mssval;
-
- mssval = (op[i+2] << 8) | op[i+3];
-
- return (mssval >= info->mss_min &&
- mssval <= info->mss_max) ^ info->invert;
+ const struct xt_tcpmss_info *info = par->targinfo;
+ struct tcphdr *tcph;
+ int len, tcp_hdrlen;
+ unsigned int i;
+ __be16 oldval;
+ u16 newmss;
+ u8 *opt;
+
+ /* This is a fragment, no TCP header is available */
+ if (par->fragoff != 0)
+ return 0;
+
+ if (!skb_make_writable(skb, skb->len))
+ return -1;
+
+ len = skb->len - tcphoff;
+ if (len < (int)sizeof(struct tcphdr))
+ return -1;
+
+ tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);
+ tcp_hdrlen = tcph->doff * 4;
+
+ if (len < tcp_hdrlen || tcp_hdrlen < sizeof(struct tcphdr))
+ return -1;
+
+ if (info->mss == XT_TCPMSS_CLAMP_PMTU) {
+ struct net *net = xt_net(par);
+ unsigned int in_mtu = tcpmss_reverse_mtu(net, skb, family);
+ unsigned int min_mtu = min(dst_mtu(skb_dst(skb)), in_mtu);
+
+ if (min_mtu <= minlen) {
+ net_err_ratelimited("unknown or invalid path-MTU (%u)\n",
+ min_mtu);
+ return -1;
+ }
+ newmss = min_mtu - minlen;
+ } else
+ newmss = info->mss;
+
+ opt = (u_int8_t *)tcph;
+ for (i = sizeof(struct tcphdr); i <= tcp_hdrlen - TCPOLEN_MSS; i += optlen(opt, i)) {
+ if (opt[i] == TCPOPT_MSS && opt[i+1] == TCPOLEN_MSS) {
+ u_int16_t oldmss;
+
+ oldmss = (opt[i+2] << 8) | opt[i+3];
+
+ /* Never increase MSS, even when setting it, as
+ * doing so results in problems for hosts that rely
+ * on MSS being set correctly.
+ */
+ if (oldmss <= newmss)
+ return 0;
+
+ opt[i+2] = (newmss & 0xff00) >> 8;
+ opt[i+3] = newmss & 0x00ff;
+
+ inet_proto_csum_replace2(&tcph->check, skb,
+ htons(oldmss), htons(newmss),
+ false);
+ return 0;
}
- if (op[i] < 2)
- i++;
- else
- i += op[i+1] ? : 1;
}
-out:
- return info->invert;
-dropit:
- par->hotdrop = true;
+ /* There is data after the header so the option can't be added
+ * without moving it, and doing so may make the SYN packet
+ * itself too large. Accept the packet unmodified instead.
+ */
+ if (len > tcp_hdrlen)
+ return 0;
+
+ /* tcph->doff has 4 bits, do not wrap it to 0 */
+ if (tcp_hdrlen >= 15 * 4)
+ return 0;
+
+ /*
+ * MSS Option not found ?! add it..
+ */
+ if (skb_tailroom(skb) < TCPOLEN_MSS) {
+ if (pskb_expand_head(skb, 0,
+ TCPOLEN_MSS - skb_tailroom(skb),
+ GFP_ATOMIC))
+ return -1;
+ tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);
+ }
+
+ skb_put(skb, TCPOLEN_MSS);
+
+ /*
+ * IPv4: RFC 1122 states "If an MSS option is not received at
+ * connection setup, TCP MUST assume a default send MSS of 536".
+ * IPv6: RFC 2460 states IPv6 has a minimum MTU of 1280 and a minimum
+ * length IPv6 header of 60, ergo the default MSS value is 1220
+ * Since no MSS was provided, we must use the default values
+ */
+ if (xt_family(par) == NFPROTO_IPV4)
+ newmss = min(newmss, (u16)536);
+ else
+ newmss = min(newmss, (u16)1220);
+
+ opt = (u_int8_t *)tcph + sizeof(struct tcphdr);
+ memmove(opt + TCPOLEN_MSS, opt, len - sizeof(struct tcphdr));
+
+ inet_proto_csum_replace2(&tcph->check, skb,
+ htons(len), htons(len + TCPOLEN_MSS), true);
+ opt[0] = TCPOPT_MSS;
+ opt[1] = TCPOLEN_MSS;
+ opt[2] = (newmss & 0xff00) >> 8;
+ opt[3] = newmss & 0x00ff;
+
+ inet_proto_csum_replace4(&tcph->check, skb, 0, *((__be32 *)opt), false);
+
+ oldval = ((__be16 *)tcph)[6];
+ tcph->doff += TCPOLEN_MSS/4;
+ inet_proto_csum_replace2(&tcph->check, skb,
+ oldval, ((__be16 *)tcph)[6], false);
+ return TCPOLEN_MSS;
+}
+
+static unsigned int
+tcpmss_tg4(struct sk_buff *skb, const struct xt_action_param *par)
+{
+ struct iphdr *iph = ip_hdr(skb);
+ __be16 newlen;
+ int ret;
+
+ ret = tcpmss_mangle_packet(skb, par,
+ PF_INET,
+ iph->ihl * 4,
+ sizeof(*iph) + sizeof(struct tcphdr));
+ if (ret < 0)
+ return NF_DROP;
+ if (ret > 0) {
+ iph = ip_hdr(skb);
+ newlen = htons(ntohs(iph->tot_len) + ret);
+ csum_replace2(&iph->check, iph->tot_len, newlen);
+ iph->tot_len = newlen;
+ }
+ return XT_CONTINUE;
+}
+
+#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
+static unsigned int
+tcpmss_tg6(struct sk_buff *skb, const struct xt_action_param *par)
+{
+ struct ipv6hdr *ipv6h = ipv6_hdr(skb);
+ u8 nexthdr;
+ __be16 frag_off, oldlen, newlen;
+ int tcphoff;
+ int ret;
+
+ nexthdr = ipv6h->nexthdr;
+ tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr, &frag_off);
+ if (tcphoff < 0)
+ return NF_DROP;
+ ret = tcpmss_mangle_packet(skb, par,
+ PF_INET6,
+ tcphoff,
+ sizeof(*ipv6h) + sizeof(struct tcphdr));
+ if (ret < 0)
+ return NF_DROP;
+ if (ret > 0) {
+ ipv6h = ipv6_hdr(skb);
+ oldlen = ipv6h->payload_len;
+ newlen = htons(ntohs(oldlen) + ret);
+ if (skb->ip_summed == CHECKSUM_COMPLETE)
+ skb->csum = csum_add(csum_sub(skb->csum, oldlen),
+ newlen);
+ ipv6h->payload_len = newlen;
+ }
+ return XT_CONTINUE;
+}
+#endif
+
+/* Must specify -p tcp --syn */
+static inline bool find_syn_match(const struct xt_entry_match *m)
+{
+ const struct xt_tcp *tcpinfo = (const struct xt_tcp *)m->data;
+
+ if (strcmp(m->u.kernel.match->name, "tcp") == 0 &&
+ tcpinfo->flg_cmp & TCPHDR_SYN &&
+ !(tcpinfo->invflags & XT_TCP_INV_FLAGS))
+ return true;
+
return false;
}
-static struct xt_match tcpmss_mt_reg[] __read_mostly = {
+static int tcpmss_tg4_check(const struct xt_tgchk_param *par)
+{
+ const struct xt_tcpmss_info *info = par->targinfo;
+ const struct ipt_entry *e = par->entryinfo;
+ const struct xt_entry_match *ematch;
+
+ if (info->mss == XT_TCPMSS_CLAMP_PMTU &&
+ (par->hook_mask & ~((1 << NF_INET_FORWARD) |
+ (1 << NF_INET_LOCAL_OUT) |
+ (1 << NF_INET_POST_ROUTING))) != 0) {
+ pr_info("path-MTU clamping only supported in "
+ "FORWARD, OUTPUT and POSTROUTING hooks\n");
+ return -EINVAL;
+ }
+ if (par->nft_compat)
+ return 0;
+
+ xt_ematch_foreach(ematch, e)
+ if (find_syn_match(ematch))
+ return 0;
+ pr_info("Only works on TCP SYN packets\n");
+ return -EINVAL;
+}
+
+#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
+static int tcpmss_tg6_check(const struct xt_tgchk_param *par)
+{
+ const struct xt_tcpmss_info *info = par->targinfo;
+ const struct ip6t_entry *e = par->entryinfo;
+ const struct xt_entry_match *ematch;
+
+ if (info->mss == XT_TCPMSS_CLAMP_PMTU &&
+ (par->hook_mask & ~((1 << NF_INET_FORWARD) |
+ (1 << NF_INET_LOCAL_OUT) |
+ (1 << NF_INET_POST_ROUTING))) != 0) {
+ pr_info("path-MTU clamping only supported in "
+ "FORWARD, OUTPUT and POSTROUTING hooks\n");
+ return -EINVAL;
+ }
+ if (par->nft_compat)
+ return 0;
+
+ xt_ematch_foreach(ematch, e)
+ if (find_syn_match(ematch))
+ return 0;
+ pr_info("Only works on TCP SYN packets\n");
+ return -EINVAL;
+}
+#endif
+
+static struct xt_target tcpmss_tg_reg[] __read_mostly = {
{
- .name = "tcpmss",
.family = NFPROTO_IPV4,
- .match = tcpmss_mt,
- .matchsize = sizeof(struct xt_tcpmss_match_info),
+ .name = "TCPMSS",
+ .checkentry = tcpmss_tg4_check,
+ .target = tcpmss_tg4,
+ .targetsize = sizeof(struct xt_tcpmss_info),
.proto = IPPROTO_TCP,
.me = THIS_MODULE,
},
+#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
{
- .name = "tcpmss",
.family = NFPROTO_IPV6,
- .match = tcpmss_mt,
- .matchsize = sizeof(struct xt_tcpmss_match_info),
+ .name = "TCPMSS",
+ .checkentry = tcpmss_tg6_check,
+ .target = tcpmss_tg6,
+ .targetsize = sizeof(struct xt_tcpmss_info),
.proto = IPPROTO_TCP,
.me = THIS_MODULE,
},
+#endif
};
-static int __init tcpmss_mt_init(void)
+static int __init tcpmss_tg_init(void)
{
- return xt_register_matches(tcpmss_mt_reg, ARRAY_SIZE(tcpmss_mt_reg));
+ return xt_register_targets(tcpmss_tg_reg, ARRAY_SIZE(tcpmss_tg_reg));
}
-static void __exit tcpmss_mt_exit(void)
+static void __exit tcpmss_tg_exit(void)
{
- xt_unregister_matches(tcpmss_mt_reg, ARRAY_SIZE(tcpmss_mt_reg));
+ xt_unregister_targets(tcpmss_tg_reg, ARRAY_SIZE(tcpmss_tg_reg));
}
-module_init(tcpmss_mt_init);
-module_exit(tcpmss_mt_exit);
+module_init(tcpmss_tg_init);
+module_exit(tcpmss_tg_exit);
diff --git a/net/rds/ib.h b/net/rds/ib.h
index 80228d14976d..9d446cce2106 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -452,6 +452,12 @@ static inline struct rds_connection *rds_ib_map_conn(struct rds_connection *conn
return (struct rds_connection *)(unsigned long)id;
}
+/*
+ * called by:
+ * - net/rds/ib.c|413| <<rds_ib_laddr_check_cm>> cm_id = rds_ib_rdma_create_id(net, rds_rdma_cm_event_handler, &dummy_ic,
+ * - net/rds/ib_cm.c|1459| <<rds_ib_conn_path_connect>> ic->i_cm_id = rds_ib_rdma_create_id(rds_conn_net(conn),
+ * - net/rds/rdma_transport.c|386| <<rds_rdma_listen_init_common>> cm_id = rds_ib_rdma_create_id(&init_net, handler, dummy_ic, NULL, RDMA_PS_TCP, IB_QPT_RC);
+ */
static inline struct rdma_cm_id *rds_ib_rdma_create_id(struct net *net,
rdma_cm_event_handler event_handler,
struct rds_ib_connection *ic,
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c