@@ -45,6 +45,37 @@ MODULE_DESCRIPTION("NIU ethernet driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_MODULE_VERSION);
+#define RDC_RED_PARA_WIN_MAX (RDC_RED_PARA_WIN >> RDC_RED_PARA_WIN_SHIFT)
+static unsigned int wred_nonsyn_window __read_mostly = 0;
+module_param(wred_nonsyn_window, uint, 0644);
+MODULE_PARM_DESC(wred_nonsyn_window,
+ "Weighted Random Early Discard window for non-TCP packets (0-"
+ __stringify(RDC_RED_PARA_WIN_MAX) ")");
+
+#define RDC_RED_PARA_WIN_SYN_MAX \
+ (RDC_RED_PARA_WIN_SYN >> RDC_RED_PARA_WIN_SYN_SHIFT)
+static unsigned int wred_syn_window __read_mostly = 0;
+module_param(wred_syn_window, uint, 0644);
+MODULE_PARM_DESC(wred_syn_window,
+ "Weight Random Early Discard window for TCP packets (0-)"
+ __stringify(RDC_RED_PARA_WIN_SYN_MAX) ")");
+
+#define RCRCFIG_B_TIMEOUT_MAX (RCRCFIG_B_TIMEOUT >> RCRCFIG_B_TIMEOUT_SHIFT)
+static unsigned int rcr_timeout __read_mostly = 8;
+module_param(rcr_timeout, uint, 0644);
+MODULE_PARM_DESC(rcr_timeout, "RCR timeout (0-"
+ __stringify(RCRCFIG_B_TIMEOUT_MAX) ")");
+
+#define RCRCFIG_B_PTHRES_MAX (RCRCFIG_B_PTHRES >> RCRCFIG_B_PTHRES_SHIFT)
+static unsigned int rcr_pkt_threshold __read_mostly = 16;
+module_param(rcr_pkt_threshold, uint, 0644);
+MODULE_PARM_DESC(rcr_pkt_threshold, "RCR packet threshold (0-"
+ __stringify(RCRCFIG_B_PTHRES_MAX) ")");
+
+static unsigned int rbr_refill_min __read_mostly = RBR_REFILL_MIN;
+module_param(rbr_refill_min, uint, 0644);
+MODULE_PARM_DESC(rbr_refill_min, "Minimum RBR refill threshold");
+
#ifndef readq
static u64 readq(void __iomem *reg)
{
@@ -4550,14 +4581,30 @@ static int niu_alloc_channels(struct niu *np)
niu_size_rbr(np, rp);
- /* XXX better defaults, configurable, etc... XXX */
- rp->nonsyn_window = 64;
+ if (wred_nonsyn_window > RDC_RED_PARA_WIN_MAX)
+ wred_nonsyn_window = RDC_RED_PARA_WIN_MAX;
+ rp->nonsyn_window = wred_nonsyn_window;
rp->nonsyn_threshold = rp->rcr_table_size - 64;
- rp->syn_window = 64;
+
+ if (wred_syn_window > RDC_RED_PARA_WIN_SYN_MAX)
+ wred_syn_window = RDC_RED_PARA_WIN_SYN_MAX;
+ rp->syn_window = wred_syn_window;
rp->syn_threshold = rp->rcr_table_size - 64;
- rp->rcr_pkt_threshold = 16;
- rp->rcr_timeout = 8;
- rp->rbr_kick_thresh = RBR_REFILL_MIN;
+
+ if (rcr_pkt_threshold > RCRCFIG_B_PTHRES_MAX)
+ rcr_pkt_threshold = RCRCFIG_B_PTHRES_MAX;
+ rp->rcr_pkt_threshold = rcr_pkt_threshold;
+
+ if (rcr_timeout > RCRCFIG_B_TIMEOUT_MAX)
+ rcr_timeout = RCRCFIG_B_TIMEOUT_MAX;
+ rp->rcr_timeout = rcr_timeout;
+
+ if (rbr_refill_min < 1)
+ rbr_refill_min = 1;
+ if (rbr_refill_min > (rp->rbr_table_size / 2))
+ rbr_refill_min = rp->rbr_table_size / 2;
+ rp->rbr_kick_thresh = rbr_refill_min;
+
if (rp->rbr_kick_thresh < rp->rbr_blocks_per_page)
rp->rbr_kick_thresh = rp->rbr_blocks_per_page;