aboutsummaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorRandall Stewart <rrs@FreeBSD.org>2020-02-26 13:48:33 +0000
committerRandall Stewart <rrs@FreeBSD.org>2020-02-26 13:48:33 +0000
commitd7313dc6f5fcab29946951936597772dfff6a4be (patch)
tree8b639f9e665deca877725af8ead3b57ccb694f71 /sys/net
parenta4c354bdd5ffa611dfd7f5daddb5da7a68b79aa9 (diff)
downloadsrc-d7313dc6f5fcab29946951936597772dfff6a4be.tar.gz
src-d7313dc6f5fcab29946951936597772dfff6a4be.zip
This commit expands tcp_ratelimit to be able to handle cards
like the mlx-c5 and c6 that require a "setup" routine before the tcp_ratelimit code can declare and use a rate. I add the setup routine to if_var as well as fix tcp_ratelimit to call it. I also revisit the rates so that in the case of a mlx card of type c5/6 we will use about 100 rates concentrated in the range where the most gain can be had (1-200Mbps). Note that I have tested these on a c5 and they work and perform well. In fact in an unloaded system they pace right to the correct rate (great job mlx!). There will be a further commit here from Hans that will add the respective changes to the mlx driver to support this work (which I was testing with). Sponsored by: Netflix Inc. Differential Revision: ttps://reviews.freebsd.org/D23647
Notes
Notes: svn path=/head/; revision=358332
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_var.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index e1d22d5b436b..77d5c12ee91b 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -252,6 +252,7 @@ union if_snd_tag_query_params {
*/
#define RT_IS_FIXED_TABLE 0x00000004 /* A fixed table is attached */
#define RT_IS_UNUSABLE 0x00000008 /* It is not usable for this */
+#define RT_IS_SETUP_REQ 0x00000010 /* The interface setup must be called before use */
struct if_ratelimit_query_results {
const uint64_t *rate_table; /* Pointer to table if present */
@@ -268,7 +269,7 @@ typedef int (if_snd_tag_query_t)(struct m_snd_tag *, union if_snd_tag_query_para
typedef void (if_snd_tag_free_t)(struct m_snd_tag *);
typedef void (if_ratelimit_query_t)(struct ifnet *,
struct if_ratelimit_query_results *);
-
+typedef int (if_ratelimit_setup_t)(struct ifnet *, uint64_t, uint32_t);
/*
* Structure defining a network interface.
@@ -368,7 +369,7 @@ struct ifnet {
if_init_fn_t if_init; /* Init routine */
int (*if_resolvemulti) /* validate/resolve multicast */
(struct ifnet *, struct sockaddr **, struct sockaddr *);
- if_qflush_fn_t if_qflush; /* flush any queue */
+ if_qflush_fn_t if_qflush; /* flush any queue */
if_transmit_fn_t if_transmit; /* initiate output routine */
void (*if_reassign) /* reassign to vnet routine */
@@ -411,6 +412,7 @@ struct ifnet {
if_snd_tag_query_t *if_snd_tag_query;
if_snd_tag_free_t *if_snd_tag_free;
if_ratelimit_query_t *if_ratelimit_query;
+ if_ratelimit_setup_t *if_ratelimit_setup;
/* Ethernet PCP */
uint8_t if_pcp;
@@ -555,7 +557,7 @@ struct ifaddr {
u_int ifa_refcnt; /* references to this structure */
counter_u64_t ifa_ipackets;
- counter_u64_t ifa_opackets;
+ counter_u64_t ifa_opackets;
counter_u64_t ifa_ibytes;
counter_u64_t ifa_obytes;
struct epoch_context ifa_epoch_ctx;
@@ -769,7 +771,7 @@ void if_setstartfn(if_t ifp, void (*)(if_t));
void if_settransmitfn(if_t ifp, if_transmit_fn_t);
void if_setqflushfn(if_t ifp, if_qflush_fn_t);
void if_setgetcounterfn(if_t ifp, if_get_counter_t);
-
+
/* Revisit the below. These are inline functions originally */
int drbr_inuse_drv(if_t ifp, struct buf_ring *br);
struct mbuf* drbr_dequeue_drv(if_t ifp, struct buf_ring *br);