net: lwm2m: add full block-wise retries for firmware download
net: lwm2m: add full block-wise retries for firmware download

UDP packets can be lost in heavy traffic.  Normally we can handle this
with pending packet processing for packets which have not been responded
to with an ACK.  However, due to the time it takes for firmware to
download via CoAP, an extra level of retries should be added.

The process works like this:

Normal pending packets will try to send 3 times fairly quickly.
If that fails, then the timeout callback is called for the firmware
download process.  A retry counter is incremented and the timeout
callback perform a new packet send of the block-wise transfer
packet that is missing, until the retry counter hits a limit (3)
and then the transfer is aborted.

This allows for a longer "outage" to happen during firmware transfer
and the process can still succeed.

NOTE: This patch does not fix a current bug where the pending process
is not re-sending the packets correctly, it only makes the process
more stable with a better chance to work.

Signed-off-by: Michael Scott <087571639a1dbb4ff1803c64e3643475ba482686@linaro.org>

aceofall/zephyr-iotos,punitvara/zephyr,zephyriot/zephyr,kraj/zephyr,zephyrproject-rtos/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,GiulianoFranchetto/zephyr,explora26/zephyr,punitvara/zephyr,ldts/zephyr,ldts/zephyr,aceofall/zephyr-iotos,explora26/zephyr,finikorg/zephyr,kraj/zephyr,fbsder/zephyr,finikorg/zephyr,fbsder/zephyr,ldts/zephyr,explora26/zephyr,kraj/zephyr,explora26/zephyr,finikorg/zephyr,mbolivar/zephyr,kraj/zephyr,Vudentz/zephyr,GiulianoFranchetto/zephyr,nashif/zephyr,GiulianoFranchetto/zephyr,ldts/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,galak/zephyr,punitvara/zephyr,nashif/zephyr,Vudentz/zephyr,nashif/zephyr,galak/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,aceofall/zephyr-iotos,zephyriot/zephyr,GiulianoFranchetto/zephyr,fbsder/zephyr,mbolivar/zephyr,kraj/zephyr,ldts/zephyr,mbolivar/zephyr,aceofall/zephyr-iotos,Vudentz/zephyr,fbsder/zephyr,GiulianoFranchetto/zephyr,zephyriot/zephyr,mbolivar/zephyr,explora26/zephyr,punitvara/zephyr,zephyriot/zephyr,fbsder/zephyr,galak/zephyr,Vudentz/zephyr,aceofall/zephyr-iotos,mbolivar/zephyr,zephyriot/zephyr,punitvara/zephyr,nashif/zephyr,Vudentz/zephyr,nashif/zephyr,finikorg/zephyr