Skip to content

Commit

Permalink
This commit contains the following
Browse files Browse the repository at this point in the history
 - Update RELEASE_NOTES
 - The IOError is captured in upper layers to add failing path name
 - The IOError exception message also contains the last timeout and
   retry numbers
 - The SRP bad read status error is captured in one of the upper
   layers that contains the register name and updates the return
   message with the register Path and throws the error again.
 - Added a cpsw release tag function that informs the current release tag.

Individual file modifications are as follows
    config.mak: Added git tag extraction command and assigning tag to
    passed to code through marco

    src/cpsw_api_user.h: Added new API function prototype returning string of
    current git tag

    src/cpsw_debug.cc: Added new API function returning string of current
    git tag

    src/cpsw_error.h: Added an exception status return method to the class

    src/cpsw_sval.cc: Capture the exception of SRP bad status error, append
    the path information and throw the error again.

    src/cpsw_srp_addr.cc : Prints last timeout and number of retries

    src/cpsw_sval.h : Added the failing path to getVal functions

Conflicts:
	RELEASE_NOTES
  • Loading branch information
dawoodalnajjar committed Jul 12, 2022
1 parent 0b0410f commit 9e7e7e2
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 13 deletions.
32 changes: 31 additions & 1 deletion RELEASE_NOTES
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
R4.4.2:
R4.5.0:

Includes updates in R4.4.1-1.0.1

Made IOError exception reporting messages useful.

- src/cpsw_srp_addr.cc : Prints last timeout and number of retries

- src/cpsw_sval.h : Added the failing path to getVal functions



R4.4.2: (Does not include updates in R4.4.1-1.0.1)

Update the env.slac.sh.in template to support the new buildroot
version 2019.08.
Expand All @@ -7,6 +19,24 @@ R4.4.2:

rssi_bridge: remove infinite while loop from the CMover::threadBody().

R4.4.1-1.0.1:

Made BadStatusError exception reporting messages useful.

- config.mak: Added git tag extraction command and assigning tag to
passed to code through marco

- src/cpsw_api_user.h: Added new API function prototype returning string of
current git tag

- src/cpsw_debug.cc: Added new API function returning string of current
git tag

- src/cpsw_error.h: Added an exception status return method to the class

- src/cpsw_sval.cc: Capture the exception of SRP bad status error, append
the path information and throw the error again.

R4.4.1:

src/makefile: Adding cpsw_stdio.h into list of headers as it needed
Expand Down
4 changes: 4 additions & 0 deletions config.mak
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,7 @@ INSTALL_DIR=$(TOPDIR)
# as seen from the target differ from the installation paths as
# seen from the host...
POSTPROCESS_ENV_SCRIPT_default=true


GIT_RELEASE_TAG := "$(shell git describe --abbrev=4 --dirty --always --tags)"
USR_CPPFLAGS += -DGIT_RELEASE_TAG=\"$(GIT_RELEASE_TAG)\"
5 changes: 5 additions & 0 deletions src/cpsw_api_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -910,4 +910,9 @@ const char *getCPSWVersionString();
*/
int setCPSWVerbosity(const char *component = 0, int value = 0);


/*!
* Get CPSW release tag sctring.
*/
const char * CPSWRealease();
#endif
6 changes: 6 additions & 0 deletions src/cpsw_debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,9 @@ struct Component *c, *f = 0;
}
return 0;
}


const char * CPSWRealease()
{
return GIT_RELEASE_TAG;
}
1 change: 1 addition & 0 deletions src/cpsw_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ class BadStatusError: public CPSWError {
virtual CPSWErrorHdl clone() { return cpsw::make_shared<CPSWError>(*this); }
// every subclass MUST implement 'throwMe'
virtual void throwMe() { throw *this; }
int64_t status() const { return this->status_; }
virtual const char *typeName() const { return "BadStatusError"; }
};

Expand Down
14 changes: 10 additions & 4 deletions src/cpsw_srp_addr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,14 @@ struct timespec retry_then;
nRetries_++;

} while ( ++attempt <= retryCnt_ );


char error[256];
sprintf(error, "No response -- timeout (Retries=%d, Last timeout=%llu)", attempt-1, usrTimeout_.getUs());

if ( useDynTimeout_ )
dynTimeout_.reset( usrTimeout_ );

throw IOError("No response -- timeout");
throw IOError(error);
}


Expand Down Expand Up @@ -798,10 +801,13 @@ int posted = ( POSTED == defaultWriteMode_
nRetries_++;
} while ( ++attempt <= retryCnt_ );

char error[256];
sprintf(error, "Too many retries (Retries=%d, Last timeout=%llu)", attempt-1, usrTimeout_.getUs());

if ( useDynTimeout_ )
dynTimeout_.reset( usrTimeout_ );

throw IOError("Too many retries");
throw IOError(error);
}

uint64_t CSRPAddressImpl::write(CWriteArgs *args) const
Expand Down
46 changes: 42 additions & 4 deletions src/cpsw_sval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1578,10 +1578,30 @@ unsigned nelms, i;
}
if ( isFloat ) {
DoubleVal val = IDoubleVal::create( p );
val->setVal( d );

try {
val->setVal( d );
}
catch (const BadStatusError &ex) {
throw BadStatusError( (std::string(__FILE__) + std::string(":") +
std::string(__FUNCTION__) + std::string(":") +
std::string(BOOST_STRINGIZE(__LINE__)) + std::string("\n") +
ex.what() + std::string(": ") + p->toString()).c_str(),
ex.status());
}

} else {
ScalVal val = IScalVal::create( p );
val->setVal( u );
try {
val->setVal( u );
}
catch (const BadStatusError &ex) {
throw BadStatusError( (std::string(__FILE__) + std::string(":") +
std::string(__FUNCTION__) + std::string(":") +
std::string(BOOST_STRINGIZE(__LINE__)) + std::string("\n") +
ex.what() + std::string(": ") + p->toString()).c_str(),
ex.status());
}
}
nelms = nelmsFromPath;
} else {
Expand Down Expand Up @@ -1611,10 +1631,28 @@ unsigned nelms, i;
}
if ( isFloat ) {
DoubleVal val = IDoubleVal::create( p );
val->setVal( &valBuf[0].d, nelms );
try {
val->setVal( &valBuf[0].d, nelms );
}
catch (const BadStatusError &ex) {
throw BadStatusError( (std::string(__FILE__) + std::string(":") +
std::string(__FUNCTION__) + std::string(":") +
std::string(BOOST_STRINGIZE(__LINE__)) + std::string("\n") +
ex.what() + std::string(": ") + p->toString()).c_str(),
ex.status());
}
} else {
ScalVal val = IScalVal::create( p );
val->setVal( &valBuf[0].u, nelms );
try {
val->setVal( &valBuf[0].u, nelms );
}
catch (const BadStatusError &ex) {
throw BadStatusError( (std::string(__FILE__) + std::string(":") +
std::string(__FUNCTION__) + std::string(":") +
std::string(BOOST_STRINGIZE(__LINE__)) + std::string("\n") +
ex.what() + std::string(": ") + p->toString()).c_str(),
ex.status());
}
}
}
return nelms;
Expand Down
24 changes: 20 additions & 4 deletions src/cpsw_sval.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,23 +196,39 @@ class IIntEntryAdapt : public IEntryAdapt, public virtual IScalVal_Base {
template <typename E> unsigned getVal(E *e, unsigned nelms, IndexRange *r)
{
SlicedPathIterator it(p_, r);
return getVal( reinterpret_cast<uint8_t*>(e), nelms, sizeof(E), &it );
try {
return getVal( reinterpret_cast<uint8_t*>(e), nelms, sizeof(E), &it );
} catch (const IOError &ex) {
throw IOError((ex.what() + std::string(": ") + p_->toString()).c_str());
}
}

template <typename E> unsigned getVal(AsyncIO aio, E *e, unsigned nelms, IndexRange *r)
{
SlicedPathIterator it(p_, r);
return getVal(aio, reinterpret_cast<uint8_t*>(e), nelms, sizeof(E), &it );
try {
return getVal(aio, reinterpret_cast<uint8_t*>(e), nelms, sizeof(E), &it );
} catch (const IOError &ex) {
throw IOError((ex.what() + std::string(": ") + p_->toString()).c_str());
}
}

template <typename E> unsigned getVal(E *e, unsigned nelms, SlicedPathIterator *it)
{
return getVal( reinterpret_cast<uint8_t*>(e), nelms, sizeof(E), it );
try {
return getVal( reinterpret_cast<uint8_t*>(e), nelms, sizeof(E), it );
} catch (const IOError &ex) {
throw IOError((ex.what() + std::string(": ") + p_->toString()).c_str());
}
}

template <typename E> unsigned getVal(AsyncIO aio, E *e, unsigned nelms, SlicedPathIterator *it)
{
return getVal(aio, reinterpret_cast<uint8_t*>(e), nelms, sizeof(E), it );
try {
return getVal(aio, reinterpret_cast<uint8_t*>(e), nelms, sizeof(E), it );
} catch (const IOError &ex) {
throw IOError((ex.what() + std::string(": ") + p_->toString()).c_str());
}
}


Expand Down

0 comments on commit 9e7e7e2

Please sign in to comment.