Commit Graph

24 Commits

Author SHA1 Message Date
Heinrich Schuchardt
e1864db60d net: sntp: remove CONFIG_TIMESTAMP constraint
CONFIG_TIMESTAMP is not related to the RTC drivers. It does not make any
sense to let the updating of the RTC by the sntp command depend on it.

Drop the CONFIG_TIMESTAMP checks.

Furthermore function dm_rtc_set() is enabled by CONFIG_DM_RTC. There is no
reason to require CONFIG_CMD_DATE when using a driver model RTC. The UEFI
sub-system can consume the RTC functions even if there is not date command.

Only check CONFIG_CMD_DATE when using a non-driver model RTC.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-12-01 14:12:28 -05:00
Philippe Reynes
912ece4c3d sntp: use udp framework
This commits update the support of sntp to use
the framework udp. This change allows to remove
all the reference to sntp in the main network
file net/net.c.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-30 16:55:03 -04:00
Simon Glass
f7ae49fc4f common: Drop log.h from common header
Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18 21:19:18 -04:00
Simon Glass
17f0ac609b dm: net: rtc: Support using driver model for rtc in sntp
When setting the date, support driver model RTC also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-05-05 20:58:40 -06:00
Simon Glass
9f9276c34c dm: rtc: Rename to_tm() to rtc_to_tm() and add error code
Rename this function so that it is clear that it is provided by the RTC.
Also return an error when it cannot function as expected. This is unlikely
to occur since it works for dates since 1752 and many RTCs do not support
such old dates. Still it is better to be accurate.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
2015-05-05 20:58:20 -06:00
Joe Hershberger
3c56fb8280 net: Fix compile errors when SNTP enabled and not DATE
When SNTP is enabled and DATE is not, to_tm() is not built in. It could
be defined when TIMESTAMP is defined, so check for that.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:35 -06:00
Joe Hershberger
bc0571fc10 net: cosmetic: Fix checkpatch.pl failures in net.c
Finish eliminating CamelCase from net.c and other failures

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:35 -06:00
Joe Hershberger
38ba255874 net: cosmetic: Clean up SNTP variables and functions
Make a thorough pass through all variables and function names contained
within sntp.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:34 -06:00
Joe Hershberger
1203fcceec net: cosmetic: Cleanup internal packet buffer names
This patch cleans up the names of internal packet buffer names that are
used within the network stack and the functions that use them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2015-04-18 11:11:32 -06:00
Joe Hershberger
0adb5b761f net: cosmetic: Name ethaddr variables consistently
Use "_ethaddr" at the end of variables and drop CamelCase.
Make constant values actually 'const'.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:32 -06:00
Joe Hershberger
049a95a775 net: cosmetic: Change IPaddr_t to struct in_addr
This patch is simply clean-up to make the IPv4 type that is used match
what Linux uses. It also attempts to move all variables that are IP
addresses use good naming instead of CamelCase. No functional change.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18 11:11:32 -06:00
Joe Hershberger
ece223b52a net: Refactor to separate the UDP handler from the ARP handler
Call a built-in dummy if none is registered... don't require
protocols to register a handler (eliminating dummies)
NetConsole now uses the ARP handler when waiting on arp
(instead of needing a #define hack in arp.c)
Clear handlers at the end of net loop

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:52:53 -05:00
Joe Hershberger
22f6e99d5b net: Refactor to protect access to the NetState variable
Changes to NetState now go through an accessor function called
net_set_state()

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:21 -05:00
Joe Hershberger
594c26f8a7 net: cosmetic: Un-typedef IP_t
Rename IP header related things to IP_UDP. The existing definition
of IP_t includes UDP header, so name it to accurately describe the
structure.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:00 -05:00
Joe Hershberger
6c3234a343 net: cosmetic: sntp.* checkpatch compliance
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-15 17:16:45 -05:00
Luca Ceresoli
03eb129f8a NET: pass source IP address to packet handlers
This is needed for the upcoming TFTP server implementation.

This also simplifies PingHandler() and fixes rxhand_f documentation.

Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Detlev Zundel <dzu@denx.de>
2011-05-12 19:38:19 +02:00
Robin Getz
0ebf04c607 minor debug cleanups in ./net
Minor ./net cleanups - no functional changes
  - change #ifdef DEBUG printf(); #endif to just debug()
  - changed __FUNCTION__ to __func__
  - got rid of extra whitespace between function and opening brace
  - removed unnecessary braces on if statements

 gcc dead code elimination should make this functionally/size equivalent
 when DEBUG is not defined. (confirmed on Blackfin, with gcc 4.3.3).

 Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-08-07 17:32:16 -07:00
Mike Frysinger
638ed3e296 net/sntp.c: move ifdef into Makefile COBJS-$(...)
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-02-09 22:53:54 -08:00
Bartlomiej Sieka
49f3bdbba8 net: express the first argument to NetSetTimeout() in milliseconds
Enforce millisecond semantics of the first argument to NetSetTimeout() --
the change is transparent for well-behaving boards (CFG_HZ == 1000 and
get_timer() countiing in milliseconds).

Rationale for this patch is to enable millisecond granularity for
network-related timeouts, which is needed for the upcoming automatic
software update feature.

Summary of changes:
- do not scale the first argument to NetSetTimeout() by CFG_HZ
- change timeout values used in the networking code to milliseconds

Signed-off-by: Rafal Czubak <rcz@semihalf.com>
Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-10-18 21:54:00 +02:00
Stefan Roese
3865b1fb78 Fix some compile problems introduced by the latest CFG_CMD_xxx cleanup
Signed-off-by: Stefan Roese <sr@denx.de>
2007-07-11 23:03:06 +02:00
Jon Loeliger
643d1ab239 net/: Remove obsolete references to CONFIG_COMMANDS
Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-09 17:45:14 -05:00
Jon Loeliger
6e2115acb6 net/: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).
This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
    #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
    #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-04 00:23:14 +02:00
wdenk
414eec35e3 Fix problems with SNTP support;
enable SNTP support in some boards.
2005-04-02 22:37:54 +00:00
wdenk
ea287debe1 * Patch by Masami Komiya, 30 Mar 2005:
add SNTP support and expand time server and time offset fields of
  DHCP support. See doc/README.SNTP

* Patch by Steven Scholz, 13 Dec 2004:
  Fix bug in at91rm920 ethernet driver
2005-04-01 00:25:43 +00:00