Skip to content

Cellular: Added BG96 handling for socket closing URC #10411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2019

Conversation

mirelachirica
Copy link
Contributor

@mirelachirica mirelachirica commented Apr 16, 2019

Description

BG96 wasn't handling URC for socket closing at all. Now socket closed flag is set on the arriving of such URC. Also, if the socket was closed but closed flag not yet set at the moment a socket sending/receiving was issued, the socket would get stuck waiting for data. To prevent this, socket event is called also when socket close URC arrives.

Pull request type

[ x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

@ciarmcom ciarmcom requested review from a team April 16, 2019 09:00
@ciarmcom
Copy link
Member

@mirelachirica, thank you for your changes.
@ARMmbed/mbed-os-wan @ARMmbed/mbed-os-maintainers please review.

@mirelachirica mirelachirica force-pushed the bg96_tcp_endpoint_close branch 2 times, most recently from 19fe543 to 66c15d6 Compare April 16, 2019 10:32
@blind-owl
Copy link
Contributor

blind-owl commented Apr 17, 2019

Change request to:
nsapi_error_t SIMCom_SIM7020_CellularStack::socket_close_impl(....) function

Start function with:
CellularSocket *sock = find_socket(sock_id);
MBED_ASSERT(sock != NULL);
if (sock->closed) {
return NSAPI_ERROR_OK;
}

Justification:
When working other modem driver implementation it was discovered during R&D that if one:

  • closes a socket within the modem , which is already closed it returns an error

Also it makes more sense, as closed flag is enforced, not to issue close to a modem as there is no need => performance optimization

@mbed-ci
Copy link

mbed-ci commented Apr 17, 2019

Test run: FAILED

Summary: 5 of 7 test jobs failed
Build number : 2
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_mbed2-build-ARM
  • jenkins-ci/mbed-os-ci_build-IAR
  • jenkins-ci/mbed-os-ci_mbed2-build-GCC_ARM
  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_mbed2-build-IAR

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 17, 2019

Aborted build, we need CI time for 5.12.2 jobs today

@mirelachirica mirelachirica force-pushed the bg96_tcp_endpoint_close branch from 66c15d6 to 88ea0db Compare April 17, 2019 08:26
@mirelachirica
Copy link
Contributor Author

mirelachirica commented Apr 17, 2019

Change request to:
nsapi_error_t SIMCom_SIM7020_CellularStack::socket_close_impl(....) function

Start function with:
CellularSocket *sock = find_socket(sock_id);
MBED_ASSERT(sock != NULL);
if (sock->closed) {
return NSAPI_ERROR_OK;
}

Justification:
When working other modem driver implementation it was discovered during R&D that if one:

  • closes a socket within the modem , which is already closed it returns an error

Also it makes more sense, as closed flag is enforced, not to issue close to a modem as there is no need => performance optimization

For BG96, closed URC can be followed by AT+QICLOSE command, to close the socket, without error because there is a slight distinction in this case between socket and a connection on that socket. This URC indicates connection being closed.

@mirelachirica
Copy link
Contributor Author

@blind-owl are the changes made to address your comments ok?

@blind-owl
Copy link
Contributor

@mirelachirica looks ok.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 18, 2019

Ci started

@mbed-ci
Copy link

mbed-ci commented Apr 18, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 3
Build artifacts

@0xc0170 0xc0170 merged commit 46603f8 into ARMmbed:master Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants