Commit f8afcf0f authored by Mike Hibler's avatar Mike Hibler

Tweak to pull jumbo frame info from the DB.

Strategy is: if experiment-wide "usejumboframes" flag is set
and an interface has a speed of at least 10000 (10Gbps), then
we set "MTU=9000". Otherwise we return "MTU=".
parent 2c8e1a74
...@@ -266,6 +266,7 @@ typedef struct { ...@@ -266,6 +266,7 @@ typedef struct {
int genisliver_idx; int genisliver_idx;
int geniflags; int geniflags;
int isnonlocal_pid; int isnonlocal_pid;
int usejumboframes;
unsigned short taintstates; unsigned short taintstates;
unsigned short experiment_keys; unsigned short experiment_keys;
char nfsmounts[TBDB_FLEN_TINYTEXT]; char nfsmounts[TBDB_FLEN_TINYTEXT];
...@@ -2115,6 +2116,9 @@ COMMAND_PROTOTYPE(doifconfig) ...@@ -2115,6 +2116,9 @@ COMMAND_PROTOTYPE(doifconfig)
return 1; return 1;
} }
/*
* Handle physical interfaces with IP addresses
*/
nrows = (int)mysql_num_rows(res); nrows = (int)mysql_num_rows(res);
while (nrows) { while (nrows) {
row = mysql_fetch_row(res); row = mysql_fetch_row(res);
...@@ -2151,11 +2155,12 @@ COMMAND_PROTOTYPE(doifconfig) ...@@ -2151,11 +2155,12 @@ COMMAND_PROTOTYPE(doifconfig)
duplex = row[4]; duplex = row[4];
/* /*
* XXX MTU should come out of DB. * MTU:
* "9000" if using jumbo frames, * "9000" if using jumbo frames,
* "1500" if not, * "" otherwise (use client default)
* "" if not specified in DB (use client default)
*/ */
if (reqp->usejumboframes && atoi(speed) >= 10000)
mtu = "9000";
/* /*
* We now use the MAC to determine the interface, but * We now use the MAC to determine the interface, but
...@@ -2398,11 +2403,13 @@ COMMAND_PROTOTYPE(doifconfig) ...@@ -2398,11 +2403,13 @@ COMMAND_PROTOTYPE(doifconfig)
aliasstr); aliasstr);
/* /*
* XXX MTU should come out of DB. * XXX MTU:
* "9000" if using jumbo frames, * "9000" if using jumbo frames,
* "1500" if not, * "" if not (use client default)
* "" if not specified in DB (use client default)
*/ */
if (reqp->usejumboframes && atoi(row[2]))
mtu = "9000";
if (vers >= 44) { if (vers >= 44) {
bufp += OUTPUT(bufp, ebufp - bufp, bufp += OUTPUT(bufp, ebufp - bufp,
" MTU=%s", mtu); " MTU=%s", mtu);
...@@ -2462,7 +2469,6 @@ COMMAND_PROTOTYPE(doifconfig) ...@@ -2462,7 +2469,6 @@ COMMAND_PROTOTYPE(doifconfig)
while (nrows) { while (nrows) {
char *bufp = buf; char *bufp = buf;
char *ifacetype; char *ifacetype;
char *mtu = "";
int isveth, doencap; int isveth, doencap;
row = mysql_fetch_row(res); row = mysql_fetch_row(res);
...@@ -2490,14 +2496,13 @@ COMMAND_PROTOTYPE(doifconfig) ...@@ -2490,14 +2496,13 @@ COMMAND_PROTOTYPE(doifconfig)
row[1], row[4], row[2], row[7]); row[1], row[4], row[2], row[7]);
/* /*
* XXX MTU should come out of DB. * XXX MTU?
* "9000" if using jumbo frames, * Since we set SPEED=100Mbps, we don't set the MTU
* "1500" if not, * (to be consistent with only setting MTU=9000 when
* "" if not specified in DB (use client default) * the speed is 10Gbps or more).
*/ */
if (vers >= 44) { if (vers >= 44) {
bufp += OUTPUT(bufp, ebufp - bufp, bufp += OUTPUT(bufp, ebufp - bufp, "MTU=");
" MTU=%s", mtu);
} }
OUTPUT(bufp, ebufp - bufp, "\n"); OUTPUT(bufp, ebufp - bufp, "\n");
...@@ -2594,14 +2599,12 @@ COMMAND_PROTOTYPE(doifconfig) ...@@ -2594,14 +2599,12 @@ COMMAND_PROTOTYPE(doifconfig)
bufp += OUTPUT(bufp, ebufp - bufp, " VTAG=%s", tag); bufp += OUTPUT(bufp, ebufp - bufp, " VTAG=%s", tag);
/* /*
* XXX MTU should come out of DB. * XXX MTU?
* "9000" if using jumbo frames, * Maybe should be explicitly set the same as
* "1500" if not, * the physical IF, but for now we just don't set.
* "" if not specified in DB (use client default)
*/ */
if (vers >= 44) { if (vers >= 44) {
bufp += OUTPUT(bufp, ebufp - bufp, bufp += OUTPUT(bufp, ebufp - bufp, " MTU=");
" MTU=%s", mtu);
} }
} }
OUTPUT(bufp, ebufp - bufp, "\n"); OUTPUT(bufp, ebufp - bufp, "\n");
...@@ -7774,7 +7777,8 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey) ...@@ -7774,7 +7777,8 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" r.erole, n.taint_states, " " r.erole, n.taint_states, "
" n.nfsmounts,e.nfsmounts AS enfsmounts, " " n.nfsmounts,e.nfsmounts AS enfsmounts, "
" p.nonlocal_id,NULL, " " p.nonlocal_id,NULL, "
" r.rootkey_private,r.rootkey_public " " r.rootkey_private,r.rootkey_public, "
" e.usejumboframes "
"FROM nodes AS n " "FROM nodes AS n "
"LEFT JOIN reserved AS r ON " "LEFT JOIN reserved AS r ON "
" r.node_id=n.node_id " " r.node_id=n.node_id "
...@@ -7805,7 +7809,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey) ...@@ -7805,7 +7809,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" (SELECT node_id FROM widearea_nodeinfo " " (SELECT node_id FROM widearea_nodeinfo "
" WHERE privkey='%s') " " WHERE privkey='%s') "
" AND notmcdinfo_types.attrvalue IS NULL", " AND notmcdinfo_types.attrvalue IS NULL",
45, nodekey); 46, nodekey);
} }
else if (reqp->isvnode) { else if (reqp->isvnode) {
char clause[BUFSIZ]; char clause[BUFSIZ];
...@@ -7845,7 +7849,8 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey) ...@@ -7845,7 +7849,8 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" r.erole, nv.taint_states, " " r.erole, nv.taint_states, "
" nv.nfsmounts,e.nfsmounts AS enfsmounts, " " nv.nfsmounts,e.nfsmounts AS enfsmounts, "
" p.nonlocal_id,va.attrvalue, " " p.nonlocal_id,va.attrvalue, "
" r.rootkey_private,r.rootkey_public " " r.rootkey_private,r.rootkey_public, "
" e.usejumboframes "
"from nodes as nv " "from nodes as nv "
"left join nodes as np on " "left join nodes as np on "
" np.node_id=nv.phys_nodeid " " np.node_id=nv.phys_nodeid "
...@@ -7872,7 +7877,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey) ...@@ -7872,7 +7877,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" va.vname=r.vname and " " va.vname=r.vname and "
" va.attrkey='routable_control_ip' " " va.attrkey='routable_control_ip' "
"where nv.node_id='%s' and (%s)", "where nv.node_id='%s' and (%s)",
45, reqp->vnodeid, clause); 46, reqp->vnodeid, clause);
} }
else { else {
char clause[BUFSIZ]; char clause[BUFSIZ];
...@@ -7905,7 +7910,8 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey) ...@@ -7905,7 +7910,8 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" r.erole, n.taint_states, " " r.erole, n.taint_states, "
" n.nfsmounts,e.nfsmounts AS enfsmounts, " " n.nfsmounts,e.nfsmounts AS enfsmounts, "
" p.nonlocal_id,NULL, " " p.nonlocal_id,NULL, "
" r.rootkey_private,r.rootkey_public " " r.rootkey_private,r.rootkey_public, "
" e.usejumboframes "
"from interfaces as i " "from interfaces as i "
"left join nodes as n on n.node_id=i.node_id " "left join nodes as n on n.node_id=i.node_id "
"left join reserved as r on " "left join reserved as r on "
...@@ -7935,7 +7941,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey) ...@@ -7935,7 +7941,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
" on n.type=dedicated_wa_types.type " " on n.type=dedicated_wa_types.type "
"where (%s) " "where (%s) "
" and notmcdinfo_types.attrvalue is NULL", " and notmcdinfo_types.attrvalue is NULL",
45, clause); 46, clause);
} }
if (!res) { if (!res) {
...@@ -8114,6 +8120,8 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey) ...@@ -8114,6 +8120,8 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
reqp->experiment_keys |= TB_ROOTKEYS_PRIVATE; reqp->experiment_keys |= TB_ROOTKEYS_PRIVATE;
if (row[44] && atoi(row[44]) > 0) if (row[44] && atoi(row[44]) > 0)
reqp->experiment_keys |= TB_ROOTKEYS_PUBLIC; reqp->experiment_keys |= TB_ROOTKEYS_PUBLIC;
if (row[45] && atoi(row[45]) > 0)
reqp->usejumboframes = 1;
/* If a vnode, copy into the nodeid. Eventually split this properly */ /* If a vnode, copy into the nodeid. Eventually split this properly */
strcpy(reqp->pnodeid, reqp->nodeid); strcpy(reqp->pnodeid, reqp->nodeid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment