samples: mqtt_publisher: Try connecting a few times before giving up
samples: mqtt_publisher: Try connecting a few times before giving up

Waiting for an NET_EVENT_IF_UP before trying to connect isn't sufficient
in some cases; for instance, on devices using the MCUX HAL, such as the
FRDM-K64F, the interface will have the NET_IF_UP flag set even though
the link negotiation didn't yet complete.

Executing this sample on such board will produce the following output.
Notice the "Enabled 100M..." message right after trying to connect.

    [dev/eth_mcux] [DBG] eth_0_init: MAC 00:04:9f:6f:91:da
    net_context_connect error Is the server (broker) up and running?
    [publisher:247] network_setup: -60 <ERROR>

    Bye!  [dev/eth_mcux] [INF] eth_mcux_phy_event: Enabled 100M
    full-duplex mode.

Even though the returned error is ETIMEDOUT, increasing
net_context_connect()'s timeout parameter to several seconds isn't
sufficient; other steps performed by network_setup() after the link has
been fully established are necessary.  As a stopgap measure, try
connecting a few times before giving up (more than one connection
attempt should be made by application in most cases, anyway.)

It might be the case that we need events to monitor ethernet link
(re)negotation in addition to the NET_IF_UP bit.

Jira: ZEP-2036
Signed-off-by: Leandro Pereira <51c7437a02b34df685e6b4ecb2e9bca23efe2e1a@intel.com>
Signed-off-by: Anas Nashif <0d9952ec84ac43c159f6b7e7ed99a9080c00dd6e@intel.com>

sharronliu/zephyr,kraj/zephyr,runchip/zephyr-cc3220,finikorg/zephyr,zephyriot/zephyr,explora26/zephyr,fbsder/zephyr,zephyrproject-rtos/zephyr,fbsder/zephyr,finikorg/zephyr,fbsder/zephyr,zephyriot/zephyr,pklazy/zephyr,Vudentz/zephyr,aceofall/zephyr-iotos,kraj/zephyr,galak/zephyr,sharronliu/zephyr,punitvara/zephyr,zephyriot/zephyr,mbolivar/zephyr,fractalclone/zephyr-riscv,fbsder/zephyr,holtmann/zephyr,mbolivar/zephyr,sharronliu/zephyr,Vudentz/zephyr,nashif/zephyr,galak/zephyr,kraj/zephyr,punitvara/zephyr,runchip/zephyr-cc3220,ldts/zephyr,zephyriot/zephyr,Vudentz/zephyr,mbolivar/zephyr,mbolivar/zephyr,pklazy/zephyr,runchip/zephyr-cc3220,punitvara/zephyr,runchip/zephyr-cc3220,nashif/zephyr,galak/zephyr,pklazy/zephyr,finikorg/zephyr,Vudentz/zephyr,ldts/zephyr,kraj/zephyr,ldts/zephyr,holtmann/zephyr,GiulianoFranchetto/zephyr,kraj/zephyr,explora26/zephyr,galak/zephyr,fractalclone/zephyr-riscv,pklazy/zephyr,fractalclone/zephyr-riscv,nashif/zephyr,zephyrproject-rtos/zephyr,nashif/zephyr,zephyrproject-rtos/zephyr,fractalclone/zephyr-riscv,holtmann/zephyr,mbolivar/zephyr,Vudentz/zephyr,ldts/zephyr,fractalclone/zephyr-riscv,holtmann/zephyr,finikorg/zephyr,explora26/zephyr,finikorg/zephyr,GiulianoFranchetto/zephyr,punitvara/zephyr,GiulianoFranchetto/zephyr,aceofall/zephyr-iotos,zephyrproject-rtos/zephyr,pklazy/zephyr,aceofall/zephyr-iotos,rsalveti/zephyr,nashif/zephyr,explora26/zephyr,rsalveti/zephyr,GiulianoFranchetto/zephyr,GiulianoFranchetto/zephyr,zephyrproject-rtos/zephyr,aceofall/zephyr-iotos,explora26/zephyr,Vudentz/zephyr,holtmann/zephyr,runchip/zephyr-cc3220,sharronliu/zephyr,ldts/zephyr,sharronliu/zephyr,aceofall/zephyr-iotos,punitvara/zephyr,rsalveti/zephyr,zephyriot/zephyr,galak/zephyr,rsalveti/zephyr,rsalveti/zephyr,fbsder/zephyr