Commit b44dda3e authored by Sukanya Rajkhowa's avatar Sukanya Rajkhowa Committed by Robert Greenwalt
Browse files

Modify RIL_Data_Call_Response to include MTU

Include MTU as part of RIL Data Call Response so that the
framework uses the dynamic MTU value provided by network
and updates LinkProperties accordingly.

Upping RIL version to 11.

bug:18391670
Change-Id: I8a85d7f58c99d73278646cdcb2aa466b85ae9a81
parent 6bfaf64c
......@@ -46,7 +46,7 @@ extern "C" {
#define SIM_COUNT 1
#endif
#define RIL_VERSION 10 /* Current version */
#define RIL_VERSION 11 /* Current version */
#define RIL_VERSION_MIN 6 /* Minimum RIL_VERSION supported */
#define CDMA_ALPHA_INFO_BUFFER_LENGTH 64
......@@ -365,7 +365,43 @@ typedef struct {
to point connections. */
char * pcscf; /* the Proxy Call State Control Function address
via PCO(Protocol Configuration Option) for IMS client. */
} RIL_Data_Call_Response_v9; // FIXME: Change to v10
} RIL_Data_Call_Response_v9;
typedef struct {
int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
back-off timer value RIL wants to override the one
pre-configured in FW.
The unit is miliseconds.
The value < 0 means no value is suggested.
The value 0 means retry should be done ASAP.
The value of INT_MAX(0x7fffffff) means no retry. */
int cid; /* Context ID, uniquely identifies this call */
int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1.
For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is
PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported
such as "IP" or "IPV6" */
char * ifname; /* The network interface name */
char * addresses; /* A space-delimited list of addresses with optional "/" prefix length,
e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64".
May not be empty, typically 1 IPv4 or 1 IPv6 or
one of each. If the prefix length is absent the addresses
are assumed to be point to point with IPv4 having a prefix
length of 32 and IPv6 128. */
char * dnses; /* A space-delimited list of DNS server addresses,
e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
May be empty. */
char * gateways; /* A space-delimited list of default gateway addresses,
e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
May be empty in which case the addresses represent point
to point connections. */
char * pcscf; /* the Proxy Call State Control Function address
via PCO(Protocol Configuration Option) for IMS client. */
int mtu; /* MTU received from network
Value <= 0 means network has either not sent a value or
sent an invalid value */
} RIL_Data_Call_Response_v11;
typedef enum {
RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */
......@@ -2010,7 +2046,7 @@ typedef struct {
* For example, "IP", "IPV6", "IPV4V6", or "PPP".
* ((const char **)data)[7] Optional connection property parameters, format to be defined.
*
* "response" is a RIL_Data_Call_Response_v6
* "response" is a RIL_Data_Call_Response_v11
*
* FIXME may need way to configure QoS settings
*
......
......@@ -2408,36 +2408,86 @@ static int responseDataCallListV6(Parcel &p, void *response, size_t responselen)
return 0;
}
static int responseDataCallListV9(Parcel &p, void *response, size_t responselen)
{
if (response == NULL && responselen != 0) {
RLOGE("invalid response: NULL");
return RIL_ERRNO_INVALID_RESPONSE;
}
if (responselen % sizeof(RIL_Data_Call_Response_v9) != 0) {
RLOGE("responseDataCallListV9: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_Data_Call_Response_v9));
return RIL_ERRNO_INVALID_RESPONSE;
}
// Write version
p.writeInt32(10);
int num = responselen / sizeof(RIL_Data_Call_Response_v9);
p.writeInt32(num);
RIL_Data_Call_Response_v9 *p_cur = (RIL_Data_Call_Response_v9 *) response;
startResponse;
int i;
for (i = 0; i < num; i++) {
p.writeInt32((int)p_cur[i].status);
p.writeInt32(p_cur[i].suggestedRetryTime);
p.writeInt32(p_cur[i].cid);
p.writeInt32(p_cur[i].active);
writeStringToParcel(p, p_cur[i].type);
writeStringToParcel(p, p_cur[i].ifname);
writeStringToParcel(p, p_cur[i].addresses);
writeStringToParcel(p, p_cur[i].dnses);
writeStringToParcel(p, p_cur[i].gateways);
writeStringToParcel(p, p_cur[i].pcscf);
appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s],", printBuf,
p_cur[i].status,
p_cur[i].suggestedRetryTime,
p_cur[i].cid,
(p_cur[i].active==0)?"down":"up",
(char*)p_cur[i].type,
(char*)p_cur[i].ifname,
(char*)p_cur[i].addresses,
(char*)p_cur[i].dnses,
(char*)p_cur[i].gateways,
(char*)p_cur[i].pcscf);
}
removeLastChar;
closeResponse;
return 0;
}
static int responseDataCallList(Parcel &p, void *response, size_t responselen)
{
if (s_callbacks.version < 5) {
RLOGD("responseDataCallList: v4");
return responseDataCallListV4(p, response, responselen);
} else if (responselen % sizeof(RIL_Data_Call_Response_v6) == 0) {
return responseDataCallListV6(p, response, responselen);
} else if (responselen % sizeof(RIL_Data_Call_Response_v9) == 0) {
return responseDataCallListV9(p, response, responselen);
} else {
if (response == NULL && responselen != 0) {
RLOGE("invalid response: NULL");
return RIL_ERRNO_INVALID_RESPONSE;
}
// Support v6 or v9 with new rils
if (responselen % sizeof(RIL_Data_Call_Response_v6) == 0) {
RLOGD("responseDataCallList: v6");
return responseDataCallListV6(p, response, responselen);
}
if (responselen % sizeof(RIL_Data_Call_Response_v9) != 0) {
RLOGE("responseDataCallList: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_Data_Call_Response_v9));
if (responselen % sizeof(RIL_Data_Call_Response_v11) != 0) {
RLOGE("invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_Data_Call_Response_v11));
return RIL_ERRNO_INVALID_RESPONSE;
}
// Write version
p.writeInt32(10);
p.writeInt32(11);
int num = responselen / sizeof(RIL_Data_Call_Response_v9);
int num = responselen / sizeof(RIL_Data_Call_Response_v11);
p.writeInt32(num);
RIL_Data_Call_Response_v9 *p_cur = (RIL_Data_Call_Response_v9 *) response;
RIL_Data_Call_Response_v11 *p_cur = (RIL_Data_Call_Response_v11 *) response;
startResponse;
int i;
for (i = 0; i < num; i++) {
......@@ -2451,7 +2501,8 @@ static int responseDataCallList(Parcel &p, void *response, size_t responselen)
writeStringToParcel(p, p_cur[i].dnses);
writeStringToParcel(p, p_cur[i].gateways);
writeStringToParcel(p, p_cur[i].pcscf);
appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s],", printBuf,
p.writeInt32(p_cur[i].mtu);
appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s,mtu=%d],", printBuf,
p_cur[i].status,
p_cur[i].suggestedRetryTime,
p_cur[i].cid,
......@@ -2461,7 +2512,8 @@ static int responseDataCallList(Parcel &p, void *response, size_t responselen)
(char*)p_cur[i].addresses,
(char*)p_cur[i].dnses,
(char*)p_cur[i].gateways,
(char*)p_cur[i].pcscf);
(char*)p_cur[i].pcscf,
p_cur[i].mtu);
}
removeLastChar;
closeResponse;
......
......@@ -51,6 +51,9 @@ static void *noopRemoveWarning( void *a ) { return a; }
/* pathname returned from RIL_REQUEST_SETUP_DATA_CALL / RIL_REQUEST_SETUP_DEFAULT_PDP */
#define PPP_TTY_PATH "eth0"
// Default MTU value
#define DEFAULT_MTU 1500
#ifdef USE_TI_COMMANDS
// Enable a workaround
......@@ -449,8 +452,8 @@ static void requestOrSendDataCallList(RIL_Token *t)
p_cur = p_cur->p_next)
n++;
RIL_Data_Call_Response_v9 *responses =
alloca(n * sizeof(RIL_Data_Call_Response_v9));
RIL_Data_Call_Response_v11 *responses =
alloca(n * sizeof(RIL_Data_Call_Response_v11));
int i;
for (i = 0; i < n; i++) {
......@@ -464,9 +467,10 @@ static void requestOrSendDataCallList(RIL_Token *t)
responses[i].dnses = "";
responses[i].gateways = "";
responses[i].pcscf = "";
responses[i].mtu = 0;
}
RIL_Data_Call_Response_v9 *response = responses;
RIL_Data_Call_Response_v11 *response = responses;
for (p_cur = p_response->p_intermediates; p_cur != NULL;
p_cur = p_cur->p_next) {
char *line = p_cur->line;
......@@ -583,6 +587,7 @@ static void requestOrSendDataCallList(RIL_Token *t)
/* There is only on gateway in the emulator */
responses[i].gateways = "10.0.2.2";
responses[i].mtu = DEFAULT_MTU;
}
else {
/* I don't know where we are, so use the public Google DNS
......@@ -598,11 +603,11 @@ static void requestOrSendDataCallList(RIL_Token *t)
if (t != NULL)
RIL_onRequestComplete(*t, RIL_E_SUCCESS, responses,
n * sizeof(RIL_Data_Call_Response_v9));
n * sizeof(RIL_Data_Call_Response_v11));
else
RIL_onUnsolicitedResponse(RIL_UNSOL_DATA_CALL_LIST_CHANGED,
responses,
n * sizeof(RIL_Data_Call_Response_v9));
n * sizeof(RIL_Data_Call_Response_v11));
return;
......
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